Fix off-by-one error, fixes #487
parent
98f107eaa0
commit
7c5bbf6c50
|
@ -640,7 +640,7 @@
|
|||
"def plot_learning_curves(model, X, y):\n",
|
||||
" X_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.2, random_state=10)\n",
|
||||
" train_errors, val_errors = [], []\n",
|
||||
" for m in range(1, len(X_train)):\n",
|
||||
" for m in range(1, len(X_train) + 1):\n",
|
||||
" model.fit(X_train[:m], y_train[:m])\n",
|
||||
" y_train_predict = model.predict(X_train[:m])\n",
|
||||
" y_val_predict = model.predict(X_val)\n",
|
||||
|
|
Loading…
Reference in New Issue