ageron / ageron/handson-ml2

[BUG] when fitting model (page 303)

Open
#606 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
30k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

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](command:workbench.action.openSettings?[). Open the full output data [in a text editor](command:workbench.action.openLargeOutput?ec6bc7b6-78d4-488d-ad17-82b5b993044d)
---------------------------------------------------------------------------
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](https://user-images.githubusercontent.com/40718112/220468874-429c4c80-b50d-46ec-b424-dcd4b9270de5.png)

**Versions (please complete the following information):**
- OS: [win10]
- Python: [Python 3.10.10]
- TensorFlow: [2.8.1]

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.