Last active
August 1, 2021 21:06
-
-
Save Rahuls66/aad2da6dbfcb2274784396611e53b616 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
from sklearn import metrics | |
from sklearn.model_selection import train_test_split | |
from sklearn.linear_model import ElasticNet | |
df = pd.read_csv('data.csv') | |
x = | |
y = | |
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size = 0.3, random_state = 66) | |
enet = ElasticNet() | |
enet.fit(x_train, y_train) | |
print("ElasticNet Train RMSE:", np.round(np.sqrt(metrics.mean_squared_error(y_train, enet.predict(x_train))),5)) | |
print("ElasticNet Test RMSE:", np.round(np.sqrt(metrics.mean_squared_error(y_test, enet.predict(x_test))),5)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment