random-forests/tutorials

The number of Columns

BanuSelinTosun opened this issue · 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.

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.