I have tried to build a CNN 1D but the interpreter says me:
AttributeError: 'ProgbarLogger' object has no attribute 'log_values'
Here is the code snippet:
model = Sequential()
model.add(Conv1D(200, 20, activation='relu', padding='same',input_shape=(1154,1024))
print(model.summary())
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
history=model.fit(X, y,batch_size=10, epochs=25,validation_split=0.7)
and this is the error:
Layer (type) Output Shape Param #
=================================================================
conv1d_1 (Conv1D) (None, 1154, 200) 4096200
=================================================================
Total params: 4,096,200
Trainable params: 4,096,200
Non-trainable params: 0
_________________________________________________________________
None
Train on 0 samples, validate on 1 samples
Epoch 1/25
Traceback (most recent call last):
File "binary_classification.py", line 59, in <module>
history=model.fit(X, y,batch_size=10, epochs=25,validation_split=0.7)
File "/home/isabella/.local/lib/python3.6/site-packages/keras/engine/training.py",
line 1039, in fit
validation_steps=validation_steps)
File "/home/isabella/.local/lib/python3.6/site-packages/keras/engine/training_arrays.py",
line 217, in fit_loop
callbacks.on_epoch_end(epoch, epoch_logs)
File "/home/isabella/.local/lib/python3.6/site-packages/keras/callbacks.py",
line 79, in on_epoch_end
callback.on_epoch_end(epoch, logs)
File "/home/isabella/.local/lib/python3.6/site-packages/keras/callbacks.py",
line 338, in on_epoch_end
self.progbar.update(self.seen, self.log_values)
AttributeError: 'ProgbarLogger' object has no attribute 'log_values'
X shape is :(1,1154,1024),
y shape is :(1,1154, 1 )
If you look carefully you will see this line right before stack trace output:
Train on 0 samples, validate on 1 samples
There is no training data! Why? That's because you have set the validation_split
to 0.7
so at first 70% of the data points in X
(and y
) are put aside for validation and the remaining 30% is used for training. Probably the number of data points in X
is less than 4 and therefore its 30% would amount to less than 1 which means zero data points remains for training. Either use more than 4 data points or remove the validation_split
argument (or lower it such that at least one sample remains for training).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With