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)

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

#2. a Machine Learning Journey — ML Landscape

Face Detection with a Sliding Window

Decision Trees easy intuitive way with python

Machine Learning black boxes (Training Models)

Gettier Problems in Machine Learning

Summary: Language Models are Few-Shot Learners

Using RudderStack To Power Your Machine Learning Models

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>

More from Medium

Activation functions

Hand Tracking in Python | MediaPipe | OpenCv | Dushyant Singh | Truth Power Info | 2022

Gender Recognition using Support Vector Machine (SVM) Algorithm

How to split data in Tensorflow