Код: Выделить всё
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
x = df.drop(['MedHouseVal'], axis=1)
y = df['MedHouseVal']
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.2, random_state=0)
model = LinearRegression()
model.fit(x_train, y_train)
model.score(x_test, y_test)
from sklearn.model_selection import cross_val_score
scores = cross_val_score(model, x, y, cv=100)
plt.plot(scores)
Введите здесь описание изображения
Извините за плохой английский (; ))
Подробнее здесь: https://stackoverflow.com/questions/787 ... tive-value