# Data Preprocessing Template for most models

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

# Importing the dataset
dataset = pd.read_csv("Data.csv")
# Matrix of features
x = dataset.iloc[:, :-1].values
# IV array
y = dataset.iloc[:, -1].values

# Splitting the dataset into the Training set and Test set
from sklearn.model_selection import train_test_split
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size = 0.2, random_state = 0)

# Feature Scaling
from sklearn.preprocessing import StandardScaler
sc_x = StandardScaler()
x_train = sc_x.fit_transform(x_train)
# Dont need to fit again because it was done in the line above fitted to the training set
x_test = sc_x.transform(x_test)