<ipython-input-9-118d9cffeb5d> in <module>()
1 # Predict using BaggingClassifier on the test data
----> 2 bagging.fit(testing_data)
3
4 # Predict using RandomForestClassifier on the test data
5 clf.fit(testing_data)
TypeError: fit() missing 1 required positional argument: 'y'
I am getting this error while modeling.
From the documentation:
Build a Bagging ensemble of estimators from the training set (X, y).
X : {array-like, sparse matrix} of shape = [n_samples, n_features] The training input samples. Sparse matrices are accepted only if they are supported by the base estimator.
y : array-like, shape = [n_samples] The target values (class labels in classification, real numbers in regression).
You need have one more parameter in the method. Something like:
model.fit(X_test, Y_test)
This will be helpful for understanding the parameters better: https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html
Hope this helps. Good luck.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments