ageron / ageron/handson-ml2

Chapter 4: Early Stopping

Open
#226 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
30k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

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!!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.