handson-ml2 icon indicating copy to clipboard operation
handson-ml2 copied to clipboard

[BUG] when fitting model (page 303)

Open Cunoo opened this issue 2 years ago • 0 comments

Thanks for helping us improve this project!

hello

Describe the bug hello i have problem with evaluating the model (page 303 2nd edition) when i do history = model.fit(X_train, y_train, epochs=30, validation_data=(X_valid, y_valid))

i got:

`Epoch 1/30 Output exceeds the size limit. Open the full output data in a text editor

ValueError Traceback (most recent call last) Cell In[126], line 1 ----> 1 history = model.fit(X_train, y_train, epochs=30, 2 validation_data=(X_valid, y_valid))

File c:\Users\rain\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\utils\traceback_utils.py:67, in filter_traceback..error_handler(*args, **kwargs) 65 except Exception as e: # pylint: disable=broad-except 66 filtered_tb = _process_traceback_frames(e.traceback) ---> 67 raise e.with_traceback(filtered_tb) from None 68 finally: 69 del filtered_tb

File c:\Users\rain\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow\python\framework\func_graph.py:1147, in func_graph_from_py_func..autograph_handler(*args, **kwargs) 1145 except Exception as e: # pylint:disable=broad-except 1146 if hasattr(e, "ag_error_metadata"): -> 1147 raise e.ag_error_metadata.to_exception(e) 1148 else: 1149 raise

ValueError: in user code:

File "c:\Users\rain\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\engine\training.py", line 1021, in train_function  *
    return step_function(self, iterator)
File "c:\Users\rain\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\engine\training.py", line 1010, in step_function  **

... File "c:\Users\rain\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\backend.py", line 5083, in categorical_crossentropy target.shape.assert_is_compatible_with(output.shape)

ValueError: Shapes (None, 1) and (None, 10) are incompatible`

To Reproduce

Screenshots image

Versions (please complete the following information):

  • OS: [win10]
  • Python: [Python 3.10.10]
  • TensorFlow: [2.8.1]

Cunoo avatar Feb 21 '23 22:02 Cunoo