Features and glitches with tag sizes (tflearn)
I am playing with tflearn with the pokemon kaggle dataset. I tried to put the pokemon names as word2vec and the rest as a normal matrix. I am trying to preprocess data.
What I did was change the name to vector using TF learn
word_processor = VocabularyProcessor(100)
trainX = newDF.loc[:, ["Total","HP","Attack","Defense","Sp. Atk", "Sp. Def","Speed","Generation"]].as_matrix()
trainY = np.array(list(word_processor.fit_transform(newDF["Name"])))
trainY[None : 0]
print('shape trainX: ',trainX.shape)
print('shape train Y: ',trainY.shape)
The print operator is showing
shape trainX: (800, 8)
shape train Y: (800, 100)
So I think this is the problem, because when I try to feed this data to my neural network, it shows.
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-53-78ce72c15f14> in <module>()
3 # Start training (apply gradient descent algorithm)
4 # Training
----> 5 model.fit(trainX, trainY, validation_set=0.1, show_metric=True, batch_size=100, n_epoch=8)
/anaconda/envs/MLHardCore/lib/python3.5/site-packages/tflearn/models/dnn.py in fit(self, X_inputs, Y_targets, n_epoch, validation_set, show_metric, batch_size, shuffle, snapshot_epoch, snapshot_step, excl_trainops, validation_batch_size, run_id, callbacks)
181 # TODO: check memory impact for large data and multiple optimizers
182 feed_dict = feed_dict_builder(X_inputs, Y_targets, self.inputs,
--> 183 self.targets)
184 feed_dicts = [feed_dict for i in self.train_ops]
185 val_feed_dicts = None
/anaconda/envs/MLHardCore/lib/python3.5/site-packages/tflearn/utils.py in feed_dict_builder(X, Y, net_inputs, net_targets)
281 X = [X]
282 for i, x in enumerate(X):
--> 283 feed_dict[net_inputs[i]] = x
284 else:
285 # If a dict is provided
IndexError: list index out of range
Here is a neural network just incase
def NN():
net = tflearn.input_data(shape=[None, 8])
net = tflearn.fully_connected(net, 32)
net = tflearn.fully_connected(net, 32)
net = tflearn.fully_connected(net, 2, activation='softmax')
net = tflearn.regression(net)
model = tflearn.DNN(net)
return model
model = NN()
model.fit(trainX, trainY, validation_set=0.1, show_metric=True, batch_size=100, n_epoch=8)
Another new error after restarting python.
Exception in thread Thread-6:
line 187, in slice_array
return X[start]
IndexError: index 359 is out of bounds for axis 0 with size 100
+3
source to share