Skip to content

Instantly share code, notes, and snippets.

@gustavoschmoeller
Last active January 11, 2021 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gustavoschmoeller/98e8a0baf4d88be2b52efb7c074c4c87 to your computer and use it in GitHub Desktop.
Save gustavoschmoeller/98e8a0baf4d88be2b52efb7c074c4c87 to your computer and use it in GitHub Desktop.
# Multiple Linear Regression
lr_regressor = LinearRegression()
lr_regressor.fit(X_train, y_train)
# Predição do conjunto de teste
y_pred = lr_regressor.predict(X_test)
mae = metrics.mean_absolute_error(y_test, y_pred)
mse = metrics.mean_squared_error(y_test, y_pred)
rmse = np.sqrt(metrics.mean_squared_error(y_test, y_pred))
r2 = metrics.r2_score(y_test, y_pred)
results = pd.DataFrame([['Multiple Linear Regression', mae, mse, rmse, r2]],
columns = ['Model', 'MAE', 'MSE', 'RMSE', 'R2 Score'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment