From fc8c162b542518f4d1e810bb5e5c109c534a6e25 Mon Sep 17 00:00:00 2001 From: Peter Harrington Date: Fri, 19 Oct 2012 13:20:12 -0700 Subject: [PATCH] Update errata.rst --- errata.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/errata.rst b/errata.rst index a304f1a7..32cbef4b 100644 --- a/errata.rst +++ b/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() @@ -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')