Correction in "Testing and Training Sets" section#1
Open
fratzola wants to merge 1 commit intoHarvard-IACS:masterfrom
Open
Correction in "Testing and Training Sets" section#1fratzola wants to merge 1 commit intoHarvard-IACS:masterfrom
fratzola wants to merge 1 commit intoHarvard-IACS:masterfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.