Untitled

 avatar
unknown
plain_text
3 years ago
567 B
5
Indexable
# Import the LinearRegression model from sklearn.linear_model
from sklearn.linear_model import LinearRegression
# Instantiate the LinearRegression as 'lr'
lr = LinearRegression()
# Fit the model to the training dataset
lr.fit(X_train_scaled, y_train)
# Predict the training targets
train_pred = lr.predict(X_train_scaled)
# Evaluate the model using the r2_score amd rmse_score
r2_scores= np.round(r2_score(y_train, train_pred), 3)
rmse_score = np.round((mean_squared_error(y_train, train_pred))**0.5, 3)
# Print out the values
print(rmse_score, r2_scores)
Editor is loading...