AttributeError when training CNN 1D with Python Keras










3















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 )









share|improve this question
























  • Which version is this? pip install --upgrade keras to ensure you are on the latest version.

    – nuric
    Nov 12 '18 at 11:45











  • Done, so I am currently using the last version of Keras. The error is still there...

    – isabella
    Nov 12 '18 at 12:04















3















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 )









share|improve this question
























  • Which version is this? pip install --upgrade keras to ensure you are on the latest version.

    – nuric
    Nov 12 '18 at 11:45











  • Done, so I am currently using the last version of Keras. The error is still there...

    – isabella
    Nov 12 '18 at 12:04













3












3








3








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 )









share|improve this question
















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 )






python machine-learning keras progress-bar conv-neural-network






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 '18 at 12:22









today

10.9k22037




10.9k22037










asked Nov 12 '18 at 9:43









isabellaisabella

183




183












  • Which version is this? pip install --upgrade keras to ensure you are on the latest version.

    – nuric
    Nov 12 '18 at 11:45











  • Done, so I am currently using the last version of Keras. The error is still there...

    – isabella
    Nov 12 '18 at 12:04

















  • Which version is this? pip install --upgrade keras to ensure you are on the latest version.

    – nuric
    Nov 12 '18 at 11:45











  • Done, so I am currently using the last version of Keras. The error is still there...

    – isabella
    Nov 12 '18 at 12:04
















Which version is this? pip install --upgrade keras to ensure you are on the latest version.

– nuric
Nov 12 '18 at 11:45





Which version is this? pip install --upgrade keras to ensure you are on the latest version.

– nuric
Nov 12 '18 at 11:45













Done, so I am currently using the last version of Keras. The error is still there...

– isabella
Nov 12 '18 at 12:04





Done, so I am currently using the last version of Keras. The error is still there...

– isabella
Nov 12 '18 at 12:04












1 Answer
1






active

oldest

votes


















2














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).






share|improve this answer

























  • thank you so much, i did not see it. but it is so strange because i have 1154 samples, not 1.

    – isabella
    Nov 12 '18 at 14:13






  • 1





    @isabella I don't think so. After the stack trace you can see this: X shape is :(1,1154,1024), that means you have one sample of shape (1154, 1024) (i.e. 1154 timesteps of length 1024 as one sample).

    – today
    Nov 12 '18 at 14:26











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53259434%2fattributeerror-when-training-cnn-1d-with-python-keras%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














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).






share|improve this answer

























  • thank you so much, i did not see it. but it is so strange because i have 1154 samples, not 1.

    – isabella
    Nov 12 '18 at 14:13






  • 1





    @isabella I don't think so. After the stack trace you can see this: X shape is :(1,1154,1024), that means you have one sample of shape (1154, 1024) (i.e. 1154 timesteps of length 1024 as one sample).

    – today
    Nov 12 '18 at 14:26
















2














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).






share|improve this answer

























  • thank you so much, i did not see it. but it is so strange because i have 1154 samples, not 1.

    – isabella
    Nov 12 '18 at 14:13






  • 1





    @isabella I don't think so. After the stack trace you can see this: X shape is :(1,1154,1024), that means you have one sample of shape (1154, 1024) (i.e. 1154 timesteps of length 1024 as one sample).

    – today
    Nov 12 '18 at 14:26














2












2








2







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).






share|improve this answer















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).







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 12 '18 at 12:30

























answered Nov 12 '18 at 12:19









todaytoday

10.9k22037




10.9k22037












  • thank you so much, i did not see it. but it is so strange because i have 1154 samples, not 1.

    – isabella
    Nov 12 '18 at 14:13






  • 1





    @isabella I don't think so. After the stack trace you can see this: X shape is :(1,1154,1024), that means you have one sample of shape (1154, 1024) (i.e. 1154 timesteps of length 1024 as one sample).

    – today
    Nov 12 '18 at 14:26


















  • thank you so much, i did not see it. but it is so strange because i have 1154 samples, not 1.

    – isabella
    Nov 12 '18 at 14:13






  • 1





    @isabella I don't think so. After the stack trace you can see this: X shape is :(1,1154,1024), that means you have one sample of shape (1154, 1024) (i.e. 1154 timesteps of length 1024 as one sample).

    – today
    Nov 12 '18 at 14:26

















thank you so much, i did not see it. but it is so strange because i have 1154 samples, not 1.

– isabella
Nov 12 '18 at 14:13





thank you so much, i did not see it. but it is so strange because i have 1154 samples, not 1.

– isabella
Nov 12 '18 at 14:13




1




1





@isabella I don't think so. After the stack trace you can see this: X shape is :(1,1154,1024), that means you have one sample of shape (1154, 1024) (i.e. 1154 timesteps of length 1024 as one sample).

– today
Nov 12 '18 at 14:26






@isabella I don't think so. After the stack trace you can see this: X shape is :(1,1154,1024), that means you have one sample of shape (1154, 1024) (i.e. 1154 timesteps of length 1024 as one sample).

– today
Nov 12 '18 at 14:26




















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53259434%2fattributeerror-when-training-cnn-1d-with-python-keras%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)