Linear Models for Regression — Applied Machine Learning in Python

PHOTO EMBED

Sat Oct 28 2023 07:03:48 GMT+0000 (Coordinated Universal Time)

Saved by @elham469

import pandas as pd
from sklearn.linear_model import Ridge, LinearRegression
from sklearn.model_selection import cross_validate

# run cross-validation, convert the results to a pandas dataframe for analysis
# return_train_score=True means that the training score is also computed
res = pd.DataFrame(cross_validate(LinearRegression(), X_train, y_train, return_train_score=True))
res
content_copyCOPY

https://amueller.github.io/aml/02-supervised-learning/05-linear-models-regression.html