In [69]:
from sklearn.linear_model import LinearRegression
linear_reg = LinearRegression()
linear_reg.fit(train_prepared, y_train)
Out[69]:
LinearRegression(copy_X=True, fit_intercept=True, n_jobs=1, normalize=False)
In [ ]:
#Let's test our results! The competition measures models based on R2 score
In [70]:
from sklearn.metrics import r2_score
y_pred = linear_reg.predict(test_prepared)
r2_score = r2_score(y_test.values, y_pred)
r2_score
Out[70]:
-2.6135586138571601e+25