<jupyter_start><jupyter_text>Lasso Regression<jupyter_code>from sklearn.linear_model import Lasso
lam = Lasso(alpha=5, normalize=True)
lam.fit(x_train, y_train)
pd.Series(lam.coef_, x.columns).sort_values()
lam.score(x_train, y_train)
y_predict = lam.predict(x_test)
plot_variance(y_predict, y_test)
lam.score(x_test, y_test)
sqrt(mean_squared_error(y_predict, y_test))<jupyter_output><empty_output><jupyter_text>Ridge Regression<jupyter_code>from sklearn.linear_model import Ridge
rlm = Ridge(alpha=.5, normalize=True)
rlm.fit(x_train, y_train)
pd.Series(rlm.coef_, x.columns).sort_values()
rlm.score(x_train, y_train)
y_pred = rlm.predict(x_test)
plot_variance(y_pred, y_test)
rlm.score(x_test, y_test)
sqrt(mean_squared_error(y_predict, y_test))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12724935732647816, 'fraction_numerical': 0.002570694087403599, 'mean_word_length': 10.803030303030303, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '500683', 'license': 'MIT', 'n_tokens_mistral': 333, 'n_tokens_neox': 324, 'n_words': 43, 'path': 'MachineLearning/Regression/Automobile Price - Lasso.ipynb', 'repo_name': 'santho3110/Data-Science', 'size': '778'}