'"model.fit()" sometimes takes Y_train (i.e, label/category) and sometimes not why?
in some cases we do not send any Y_train(Category/classes) and the code still works For Example:-
history = model.fit( train, epochs=epochs, batch_size=Batch, verbose=1, validation_data=validate ) Here we have sent only the x_train and not its labels.
But in some cases we pass both X_train and Y_train to the model.fit() then also the model works. For Example:-
model.fit(X_train, y_train, epochs=10)
What is the difference between these 2 ways and why the labels are not passes in the first case?
Solution 1:[1]
If you have a dataset that contains both the features as well as labels, then you should not explicitly mention y. The fit method will try to extract the labels from the x itself.
For more information please refer: https://keras.io/api/models/model_training_apis/#fit-method
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sourin Karmakar |
