ageron / ageron/handson-ml2

Chapter 4: Early Stopping

Offen
#226 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Jupyter Notebook
Sterne
30k
Forks
13.1k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.