ageron / ageron/handson-ml2

Chapter 4: Early Stopping

未關閉
#226 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Jupyter Notebook
星號
30k
分支
13.1k
PR 合併指標
30 天內沒有已合併 PR

描述

In the book is not mentioned to use the method ravel in the y_train, but if I don't use it the code crushes. The variables X_train, x_val, y_train and y_val, I created them with the method split.

X_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.2)

for epoch in range(1000):
sgd_reg.fit(X_train_poly_scaled, y_train.ravel()) # continues where it left off
y_val_predict = sgd_reg.predict(X_val_poly_scaled)
val_error = mean_squared_error(y_val, y_val_predict)
if val_error < minimum_val_error:
minimum_val_error = val_error
best_epoch = epoch
best_model = deepcopy(sgd_reg)

If I'm doing something wrong please can anyone tell me what I'm doing wrong!!

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。