tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

The number of Columns

Open BanuSelinTosun opened this issue 7 years ago • 1 comments

Hi, There is a mistake in the calculation of the # of columns in the ipython book. '''n_features = len(rows[0]) - 1 # number of columns''' does define the number of samples -1, not the number of columns. This should be replaced with: n_features = rows.shape(1) for getting the number of columns. The code in the example works, because of the number of the rows and columns are not way too off from each other.

BanuSelinTosun avatar Feb 14 '18 06:02 BanuSelinTosun

Hi, I think the code is correct. rows[0] is the first row of data in the training set. We then get the length of this row which includes the headers and the last class column. And then we subtract 1 to get the number of headers only.

I tried this with my own, completely separate training set and the implementation worked fine.

jmc1652 avatar Feb 19 '18 19:02 jmc1652