I have a random state with a fixed seed I am using to make my predictive results replicable:
rng = np.random.RandomState(101)
len(finalTestSentences) = 500
I am trying to use this seed to generate an array of random categorical variables using a unique list of possibilities. Here's an example (I used set on my training labels to generate the unique labels I have):
unique_train_labels = set([u'bla', u'blee', u'blu', u'ma'])
I then do:
categorical_random = np.array[rng.choice(unique_train_labels, len(finalTestSentences))]
But I am getting:
categorical_random = np.array[rng.choice(unique_train_labels, len(finalTestSentences))]
File "mtrand.pyx", line 1072, in mtrand.RandomState.choice (numpy/random/mtrand/mtrand.c:11545)
ValueError: a must be 1-dimensional or an integer
Note, this was from this workaround here
What is going wrong and how can I achieve my aim?
Aucun commentaire:
Enregistrer un commentaire