I am working on building a multivariate regression analysis on sklearn , I did a thorough look at the documentation. When I run the predict()
function I get the error : predict()
takes 2 positional arguments but 3 were given
X is a data frame , y is column; I have tried to convert the data frame to array / matrix but still get the error.
Have added a snippet showing the x and y arrays.
reg.coef_
reg.predict(x,y)
x_train=train.drop('y-variable',axis =1)
y_train=train['y-variable']
x_test=test.drop('y-variable',axis =1)
y_test=test['y-variable']
x=x_test.as_matrix()
y=y_test.as_matrix()
reg = linear_model.LinearRegression()
reg.fit(x_train,y_train)
reg.predict(x,y)