Skip to content

Instantly share code, notes, and snippets.

@orico
Created April 18, 2018 14:55
Show Gist options
  • Save orico/2081a868eef427feb0f7a0b190d899cf to your computer and use it in GitHub Desktop.
Save orico/2081a868eef427feb0f7a0b190d899cf to your computer and use it in GitHub Desktop.
AL-get_k_random_samples
def get_k_random_samples(initial_labeled_samples, X_train_full,
y_train_full):
random_state = check_random_state(0)
permutation = np.random.choice(trainset_size,
initial_labeled_samples,
replace=False)
print ()
print ('initial random chosen samples', permutation.shape),
# permutation)
X_train = X_train_full[permutation]
y_train = y_train_full[permutation]
X_train = X_train.reshape((X_train.shape[0], -1))
bin_count = np.bincount(y_train.astype('int64'))
unique = np.unique(y_train.astype('int64'))
print (
'initial train set:',
X_train.shape,
y_train.shape,
'unique(labels):',
bin_count,
unique,
)
return (permutation, X_train, y_train)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment