Skip to content

Commit

Permalink
Update errata.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
pbharrin committed Oct 19, 2012
1 parent e7c00ac commit fc8c162
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions errata.rst
@@ -1,7 +1,7 @@
Listing 2.2 bottom of page 25-page26

A better version of the function file2matrix() is given below. The code in the book will work.
`
``
def file2matrix(filename):
fr = open(filename)
arrayOLines = fr.readlines()
Expand All @@ -16,7 +16,7 @@ def file2matrix(filename):
classLabelVector.append(int(listFromLine[-1]))
index += 1
return returnMat,classLabelVector
`
``
Page 26:

datingDataMat, datingLabels = kNN.file2matrix('datingTestSet.txt')
Expand Down

0 comments on commit fc8c162

Please sign in to comment.