Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The number of Columns #8

Open
BanuSelinTosun opened this issue Feb 14, 2018 · 1 comment
Open

The number of Columns #8

BanuSelinTosun opened this issue Feb 14, 2018 · 1 comment

Comments

@BanuSelinTosun
Copy link

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.

@jmc1652
Copy link

jmc1652 commented Feb 19, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants