<jupyter_start><jupyter_text><jupyter_code>from google.colab import drive
drive.mount('/content/gdrive')
!wget http://www.superdatascience.com/wp-content/uploads/2017/02/Logistic_Regression.zip
!unzip Logistic_Regression.zip -d gdrive/My\ \Drive/MachineLearning
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
dataset = pd.read_csv("gdrive/My Drive/MachineLearning/Logistic_Regression/Social_Network_Ads.csv")
dataset.drop(["User ID"],inplace=True,axis =1)
dataset.head()
#Converting dataframe to Arrays
X=dataset.iloc[:,:-1].values
Y=dataset.iloc[:,3].values
#Imputing the missing values
from sklearn.preprocessing import Imputer
imputer = Imputer(missing_values='NaN',strategy= 'mean',axis=0)
imputer =imputer.fit(X[:,0:2])
X[:,0:2]=imputer.transform(X[:,0:2])
#Converting categorical data to label-encoder
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
labelencoder_X = LabelEncoder()
X[:,0]=labelencoder_X.fit_transform(X[:,0])
labelencoder_Y = LabelEncoder()
Y=labelencoder_Y.fit_transform(Y)
#Converting LabelEncoder to ONe hot Encoder
onehotencoder = OneHotEncoder(categorical_features=[0])
X= onehotencoder.fit_transform(X).toarray()


#Splittig Data into train and test
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 = 42)
#Feature Scaling 
from sklearn.preprocessing import StandardScaler
sc_X = StandardScaler()
X = sc_X.fit_transform(X)

from sklearn.neighbors import KNeighborsClassifier
classifier=KNeighborsClassifier()
classifier.fit(X_train,Y_train)
y_pred=classifier.predict(X_test)
from sklearn.metrics import confusion_matrix
cm=confusion_matrix(Y_test,y_pred)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11418685121107267, 'fraction_numerical': 0.0132641291810842, 'mean_word_length': 8.80225988700565, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '151704', 'license': 'MIT', 'n_tokens_mistral': 623, 'n_tokens_neox': 606, 'n_words': 112, 'path': 'Classification/KNN.ipynb', 'repo_name': 'agarwalanant/CNN-on-CIFAR-10', 'size': '1734'}