Skip to content

Instantly share code, notes, and snippets.

@purva91
Last active September 10, 2019 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save purva91/db39bbe91f852dac8af113a64a050e66 to your computer and use it in GitHub Desktop.
Save purva91/db39bbe91f852dac8af113a64a050e66 to your computer and use it in GitHub Desktop.
y = data_df["target"].values
x = data_df.drop(["target"],axis=1)
#Scaling - mandatory for knn
from sklearn.preprocessing import StandardScaler
ss = StandardScaler()
x = ss.fit_transform(x)
#SPlitting into train and test
X_train, X_test, y_train, y_test = train_test_split(x, y, test_size = 0.3) # 70% training and 30% test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment