Untitled

Anonymous
plain_text
12/11/2022 3:43 PM
756 B
20
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...