<jupyter_start><jupyter_text>Ridge Regularization (L2) Cross Validation<jupyter_code>from sklearn.linear_model import RidgeCV
ridgecv_model = RidgeCV(alphas = (0.1,1.0,10.0), scoring = 'neg_mean_absolute_error')
from sklearn.metrics import SCORERS
SCORERS
ridgecv_model.fit(scaled_X_train, y_train)
ridgecv_model.alpha_
ridgecv_predict = ridgecv_model.predict(scaled_X_test)
from sklearn.metrics import mean_absolute_error, mean_squared_error 
mean_absolute_error(y_test, ridgecv_predict)
np.sqrt(mean_squared_error(y_test, ridgecv_predict))<jupyter_output><empty_output><jupyter_text>Lasso Regression (L1)<jupyter_code>from sklearn.linear_model import LassoCV 
lassocv_model = LassoCV(eps=0.001, n_alphas=100, cv = 5, max_iter = 100000000)
lassocv_model.fit(scaled_X_train, y_train)
lassocv_predict = lassocv_model.predict(scaled_X_test)
lassocv_model.alpha_
mean_absolute_error(y_test, lassocv_predict)
np.sqrt(mean_squared_error(y_test, lassocv_predict))<jupyter_output><empty_output><jupyter_text>Elastic Net (L1+L2)<jupyter_code>from sklearn.linear_model import ElasticNetCV 
elasticnetcv_model = ElasticNetCV(l1_ratio=0.5, eps=0.001, n_alphas=100, max_iter = 100000000)
elasticnetcv_model.fit(scaled_X_train, y_train)
elasticnetcv_predict = elasticnetcv_model.predict(scaled_X_test)
mean_absolute_error(y_test, elasticnetcv_predict)
np.sqrt(mean_squared_error(y_test, elasticnetcv_predict))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.091164095371669, 'fraction_numerical': 0.03295932678821879, 'mean_word_length': 12.212962962962964, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '321718', 'license': 'MIT', 'n_tokens_mistral': 598, 'n_tokens_neox': 551, 'n_words': 72, 'path': 'RidgeCV/Ridge_Lasso_CV.ipynb', 'repo_name': 'samynitrr/ML-Live-Class', 'size': '1426'}