Model Training Using Unscaled Data
Learn to train data when it is unscaled.
We'll cover the following...
Let's move on and separate the features and the target in (X
, y
) and then split the data into the train (X_train
, y_train
) and test (X_test
, y_test
) using train_test_split()
.
Press + to interact
from sklearn.model_selection import train_test_split# Separating features and the targetX = df.drop('Result', axis = 1) # features in Xy = df['Result'] # targets/labels in yprint("features are in X and the target is in y now! ")# Splitting datatest_size=0.30; random_state=42X_train, X_test, y_train, y_test = train_test_split(X,y,test_size=test_size,random_state=random_state)print("train and test data sets are ready with test_size = {} and random_state = {}".format(test_size,random_state))
Since we have our data ready, let's train a model.
Model training on unscaled data
Our focus is to develop a model that can predict the class in the Result
column for any new data point. For the KNN algorithm, the