Home > Blockchain >  "model.fit()" sometimes takes Y_train (i.e, label/category) and sometimes not why?
"model.fit()" sometimes takes Y_train (i.e, label/category) and sometimes not why?

Time:05-15

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?

CodePudding user response:

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

  • Related