diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-01-06 18:33:37 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-01-06 18:33:37 +0100 |
| commit | 7ea77a044ca9de9d8089bf382640fb4a7bfabc0f (patch) | |
| tree | 7f344845e3346e5f27f7f533b487c74408bab27f /cli/app/search | |
| parent | 4d0db1188bc94970550c02ff55f16110c5e86700 (diff) | |
create_labels_uniform
Diffstat (limited to 'cli/app/search')
| -rw-r--r-- | cli/app/search/vector.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/app/search/vector.py b/cli/app/search/vector.py index 89cd949..b118ef3 100644 --- a/cli/app/search/vector.py +++ b/cli/app/search/vector.py @@ -18,3 +18,11 @@ def create_labels(batch_size, vocab_size, num_classes): label[i, j] = random.random() label[i] /= label[i].sum() return label + +def create_labels_uniform(batch_size, vocab_size): + label = np.zeros((batch_size, vocab_size)) + for i in range(batch_size): + for j in range(vocab_size): + label[i, j] = random.uniform(1 / vocab_size, 2 / vocab_size) + label[i] /= label[i].sum() + return label |
