# linear regression

import numpy as np from sklearn.datasets import make_regression from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score # Train a linear regression model model = LinearRegression() model.fit(X_train_sscaler, y_train) #Make predictions y_pred = model.predict(X_test_sscaler) #Calculate regression metrics mse = mean_squared_error(y_test, y_pred) rmse = np.sqrt(mse) mae = mean_absolute_error(y_test, y_pred) r2 = r2_score(y_test, y_pred) print(f"MSE: {mse:.2f}, nRMSE: {rmse:.2f}, nMAE: {mae:.2f}, nR-squared: {r2:.2f}")