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

Correction in "Testing and Training Sets" section #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fratzola
Copy link

Correction in "Testing and Training Sets" section, in:
df=pd.DataFrame(dict(x=x[indexes],f=f[indexes],y=y[indexes]))

from sklearn.cross_validation import train_test_split
datasize=df.shape[0]
#split dataset using the index, as we have x,f, and y that we want to split.
itrain,itest = train_test_split(range(30),train_size=24, test_size=6)
xtrain= df.x[indexes[itrain]].values
ftrain = df.f[indexes[itrain]].values
ytrain = df.y[indexes[itrain]].values
xtest= df.x[indexes[itest]].values
ftest = df.f[indexes[itest]].values
ytest = df.y[indexes[itest]].values

Dict creates different indexing so in order for the itrain and itest indices to be correct they have to pass through 'indexes'!!

otherwise there's a lot of Nan values that should be there.

Correction in "Testing and Training Sets" section, in:
df=pd.DataFrame(dict(x=x[indexes],f=f[indexes],y=y[indexes]))

from sklearn.cross_validation import train_test_split
datasize=df.shape[0]
#split dataset using the index, as we have x,f, and y that we want to split.
itrain,itest = train_test_split(range(30),train_size=24, test_size=6)
xtrain= df.x[indexes[itrain]].values
ftrain = df.f[indexes[itrain]].values
ytrain = df.y[indexes[itrain]].values
xtest= df.x[indexes[itest]].values
ftest = df.f[indexes[itest]].values
ytest = df.y[indexes[itest]].values
# Dict creates different indexing so in order for the itrain and itest indices to be correct they have to pass through 'indexes'!!
# otherwise there's a lot of Nan values that should be there.
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

Successfully merging this pull request may close these issues.

1 participant