TypeError: fit() missing 1 required positional argument: ‘y’
Nov 11, 2020
As I was trying to fit my linear model (Logistic Regression ) to my train data, I encountered this error as I wrote my lines of code ;
TypeError: fit() missing 1 required positional argument: ‘y’
This is what was on my notebook initially;
from sklearn.linear_model import LogisticRegressionlogreg = LogisticRegressionlogreg.fit(X_train,y_train)
But something I love with programming, simple errors require quick fix don’t waste your time on this;
Apparently I had left the parenthesis ‘()’ out:
logreg = LogisticRegression()