Skip to content

Commit e45b187

Browse files
committed
clarify cost_ in the docstrings
1 parent 29b22a0 commit e45b187

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

code/ch02/ch02.ipynb

+6-5
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@
266266
" w_ : 1d-array\n",
267267
" Weights after fitting.\n",
268268
" errors_ : list\n",
269-
" Number of misclassifications in every epoch.\n",
269+
" Number of misclassifications (updates) in each epoch.\n",
270270
"\n",
271271
" \"\"\"\n",
272272
" def __init__(self, eta=0.01, n_iter=10):\n",
@@ -1040,8 +1040,8 @@
10401040
" -----------\n",
10411041
" w_ : 1d-array\n",
10421042
" Weights after fitting.\n",
1043-
" errors_ : list\n",
1044-
" Number of misclassifications in every epoch.\n",
1043+
" cost_ : list\n",
1044+
" Sum-of-squares cost function value in each epoch.\n",
10451045
"\n",
10461046
" \"\"\"\n",
10471047
" def __init__(self, eta=0.01, n_iter=50):\n",
@@ -1280,8 +1280,9 @@
12801280
" -----------\n",
12811281
" w_ : 1d-array\n",
12821282
" Weights after fitting.\n",
1283-
" errors_ : list\n",
1284-
" Number of misclassifications in every epoch.\n",
1283+
" cost_ : list\n",
1284+
" Sum-of-squares cost function value averaged over all\n",
1285+
" training samples in each epoch.\n",
12851286
" shuffle : bool (default: True)\n",
12861287
" Shuffles training data every epoch if True to prevent cycles.\n",
12871288
" random_state : int (default: None)\n",

code/optional-py-scripts/ch02.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Perceptron(object):
3030
w_ : 1d-array
3131
Weights after fitting.
3232
errors_ : list
33-
Number of misclassifications in every epoch.
33+
Number of misclassifications (updates) in each epoch.
3434
3535
"""
3636
def __init__(self, eta=0.01, n_iter=10):
@@ -188,8 +188,8 @@ class AdalineGD(object):
188188
-----------
189189
w_ : 1d-array
190190
Weights after fitting.
191-
errors_ : list
192-
Number of misclassifications in every epoch.
191+
cost_ : list
192+
Sum-of-squares cost function value in each epoch.
193193
194194
"""
195195
def __init__(self, eta=0.01, n_iter=50):
@@ -302,8 +302,9 @@ class AdalineSGD(object):
302302
-----------
303303
w_ : 1d-array
304304
Weights after fitting.
305-
errors_ : list
306-
Number of misclassifications in every epoch.
305+
cost_ : list
306+
Sum-of-squares cost function value averaged over all
307+
training samples in each epoch.
307308
shuffle : bool (default: True)
308309
Shuffles training data every epoch if True to prevent cycles.
309310
random_state : int (default: None)

0 commit comments

Comments
 (0)