N Days_With_Machine_Learning (Part2 )

Day 2 : Classification

What is Classification ?

Spam Classification
Ads targeting

What is Logistic Regression ?

Let’ start Coding

# Imporitng the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
dataset = pd.read_csv('Social_Network_Ads.csv');
X = dataset.iloc[:,[2,3]].values
Y = dataset.iloc[:,4].values

# Splitting the Data into Training Set and Testing 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.25,random_state=0)
# Scaling the data *************from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
X_train = scaler.fit_transform(X_Train)
X_Test =scaler.transform(X_Test)
from sklearn import linear_model
#Prepare our Classifier*********
classifier = linear_model.LogisticRegression(C=1e5)
#Train our classifier
classifier.fit(X_Train,Y_Train);
y_predicted = classifier.predict(X_Test)

Unlisted

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rebai Ahmed

Rebai Ahmed

<script>alert('try your best')</script>