Created
May 9, 2020 12:49
-
-
Save VincentTatan/51257105b171ddff969079f4b313aedd to your computer and use it in GitHub Desktop.
This file contains 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
def split_train_test (df, target_feature,test_size=0.2): | |
filtered_list = list(df._get_numeric_data().columns) | |
filtered_list.remove(target_feature) | |
X = df[filtered_list] | |
y = df[target_feature] | |
X_train, X_test, y_train,y_test= train_test_split(X,y,test_size=test_size) | |
print(''' X_train size : {} | |
y_train size : {} | |
X_test size : {} | |
y_test size : {} | |
'''.format( X_train.shape, X_test.shape, y_train.shape,y_test.shape)) | |
return X_train, X_test, y_train,y_test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment