Created
April 18, 2018 14:55
-
-
Save orico/2081a868eef427feb0f7a0b190d899cf to your computer and use it in GitHub Desktop.
AL-get_k_random_samples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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