What does calling fit() multiple times on the same model do?

后端 未结 2 737
闹比i
闹比i 2021-02-05 00:48

After I instantiate a scikit model (e.g. LinearRegression), if I call its fit() method multiple times (with different X and y

2条回答
  •  误落风尘
    2021-02-05 01:16

    You can use term fit() and train() word interchangeably in machine learning. Based on classification model you have instantiated, may be a clf = GBNaiveBayes() or clf = SVC(), your model uses specified machine learning technique.
    And as soon as you call clf.fit(features_train, label_train) your model starts training using the features and labels that you have passed.

    you can use clf.predict(features_test) to predict.
    If you will again call clf.fit(features_train2, label_train2) it will start training again using passed data and will remove the previous results. Your model will reset the following inside model:

    • Weights
    • Fitted Coefficients
    • Bias
    • And other training related stuff...

    You can use partial_fit() method as well if you want your previous calculated stuff to stay and additionally train using next data

提交回复
热议问题