def get_data(self, anom_idx, x, y, normal_label=0):
    x = x.cpu().data.numpy()
    y = y.cpu().data.numpy()
    anom_x = x[anom_idx]
    noml_idx = np.where((y == normal_label))[0]
    x_noml = x[noml_idx]
    nbrs_local = NearestNeighbors(n_neighbors=self.nbrs_num).fit(x_noml)
    nbr_indices = noml_idx[nbrs_local.kneighbors([anom_x])[1].flatten()]
    rand_canddt = np.setdiff1d(noml_idx, nbr_indices)
    rand_indices = np.random.choice(rand_canddt, self.rand_num, replace=False)
    dim = x.shape[1]
    anom_lst = []
    anom_lst.append(anom_x)
    for i in range(((self.rand_num + self.nbrs_num) - 1)):
        new_anom_x = anom_x.copy()
        choose_f = np.random.choice(np.arange(dim), 3)
        for a in choose_f:
            new_anom_x[a] = (anom_x[a] * 1.01)
        anom_lst.append(new_anom_x)
    data_idx = np.hstack([rand_indices, nbr_indices])
    norm_data = x[data_idx]
    data = np.vstack([np.array(anom_lst), norm_data])
    target = np.hstack([np.ones(10), np.zeros(len(rand_indices), dtype=int), np.zeros(len(nbr_indices), dtype=int)])
    return (torch.FloatTensor(data), torch.LongTensor(target))
def get_data(self, anom_idx, x, y, normal_label=0):
    x = x.cpu().data.numpy()
    y = y.cpu().data.numpy()
    anom_x = x[anom_idx]
    noml_idx = np.where((y == normal_label))[0]
    x_noml = x[noml_idx]
    nbrs_local = NearestNeighbors(n_neighbors=self.nbrs_num).fit(x_noml)
    nbr_indices = noml_idx[nbrs_local.kneighbors([anom_x])[1].flatten()]
    rand_canddt = np.setdiff1d(noml_idx, nbr_indices)
    rand_indices = np.random.choice(rand_canddt, self.rand_num, replace=False)
    dim = x.shape[1]
    anom_lst = []
    anom_lst.append(anom_x)
    for i in range(((self.rand_num + self.nbrs_num) - 1)):
        new_anom_x = anom_x.copy()
        choose_f = np.random.choice(np.arange(dim), 3)
        for a in choose_f:
            new_anom_x[a] = (anom_x[a] * 1.01)
        anom_lst.append(new_anom_x)
    data_idx = np.hstack([rand_indices, nbr_indices])
    norm_data = x[data_idx]
    data = np.vstack([np.array(anom_lst), norm_data])
    target = np.hstack([np.ones(10), np.zeros(len(rand_indices), dtype=int), np.zeros(len(nbr_indices), dtype=int)])
    return (torch.FloatTensor(data), torch.LongTensor(target))