Skip to content

Instantly share code, notes, and snippets.

@YiChengRepo
Created September 17, 2019 21:51
Show Gist options
  • Save YiChengRepo/c5990cb64d73a7ab2b950b9bbf4f343b to your computer and use it in GitHub Desktop.
Save YiChengRepo/c5990cb64d73a7ab2b950b9bbf4f343b to your computer and use it in GitHub Desktop.
train_test_split
# -*- coding: utf-8 -*-
from sklearn.model_selection import train_test_split
import pandas as pd
import numpy as np
filepath="C:\\Saved_data.csv"
data = pd.read_csv(filepath, sep=',',header=None)
X = data.iloc[:,0:5].values
y = data.iloc[:,5].values
x_train, x_test, y_train, y_test = train_test_split(X, y, train_size=.7, random_state = 100)
print("x_train boyutu =" +str(np.shape(x_train)))
print("x_test boyutu =" +str(np.shape(x_test)))
print("y_train boyutu =" +str(np.shape(y_train)))
print("y_test boyutu =" +str(np.shape(y_test)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment