Skip to content

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