Polynomial Regression in Python – Step 2.) Split the Training Set and Testing Set

with No Comments

# Import the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

# Import the CSV Data
dataset = pd.read_csv(‘Poly_Data.csv’)
X = dataset.iloc[:, 1:2].values
y = dataset.iloc[:, 2].values

# Split the dataset into Training set and Test set
from sklearn.cross_validation import train_test_split
xtrain, xtest, ytrain, ytest = train_test_split(X, y, test_size = 0.2, random_state = 0)

Leave a Reply