See discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/326866833
Basic Concepts in Neural Networks: Single Layer Perceptron in Python
Presentation · June 2018
DOI: 10.13140/RG.2.2.13053.87522
CITATIONS
0
READS
8
1 author:
Some of the authors of this publication are also working on these related projects:
Wearable Clinic:(Adaptive Sensing & Signal Processing using wearable sensors ) View project
Human Activity Recognition with Inertial Sensors using a Deep Learning Approach View project
Tahmina Zebin
The University of Manchester
17 PUBLICATIONS   19 CITATIONS   
SEE PROFILE
All content following this page was uploaded by Tahmina Zebin on 23 August 2018.
The user has requested enhancement of the downloaded file.
Neural Networks
Basic Concepts and Implementation
Presented by:
Tahmina Zebin
Tahmina.zebin@Manchester.ac.uk
1
WHAT ARE NEURAL NETWORKS?
 A family of Machine Learning techniques inspired by the construction of the human
brain.
 Neural Network approaches are useful for extracting patterns from images, video,
speech and time series data.
Some day to day application of Neural Networks you probably have encountered:
Recurrent Neural Networks(Automatic Text suggestion)
Convolutional Neural networks (Image labeler/Handwritten digit recognizer)
 These models can deal with large amounts of data.
2
TODAY’S FOCUS
 Biological neuron vs Artificial neuron
 A single layer perceptron
 Computational steps for training a Perceptron
 Implementation of a perceptron model in Python
3
From Wikipedia
4
BIOLOGICAL NEURON VS THE
ARTIFICIAL NEURON
SINGLE LAYER PERCEPTRON
BIOLOGICAL NEURON
PERCEPTRON ALGORITHM
The Perceptron receives input signals from examples of training data
that we weight and combine in a linear equation called the activation:
activation = sum(weight_i * x_i) + bias
The activation is then transformed into an output value or prediction
using a transfer function, such as the step transfer function.
prediction = 1.0 if activation >= 0.0 else 0.0
5
Activation Functions
ReLU
TRAINING A PERCEPTRON WITH THE DATA
Gradient Descent is the
process of minimizing a
function by following the
gradients of the cost function.
6
We can estimate the weight values for our training data using stochastic
gradient descent.
W(t+1) = w(t) + learning_rate * (predicted - actual) * x(t)
Stochastic gradient descent requires
two parameters:
Learning Rate
Epochs
Cost function/loss function
COMPUTATIONAL STEPS
7
LET’S MAKE PREDICTIONS FOR A BINARY
CLASSIFICATION PROBLEM.
• Modeling the Sonar Dataset.
• A data set with 207 observations and 61 variable columns.
• The first 60 column of the dataset represent the energy within a particular
frequency band, integrated over a certain period of time.
• The last column contains the class labels.
• There are two classes 0 if the object is a rock, and 1 if the object is a mine (metal
cylinder).
These steps will give us the foundation to implement and
apply the Perceptron algorithm to your own classification
predictive modeling problems.
8
IT’S DEMO TIME..
Spyder IDE (Python 3.6)
9
PRESENTING RESULTS FROM A NEURAL
NETWORK
Confusion Matrix
Accuracy
10
REVIEW
In this tutorial, we discovered how to implement the Perceptron algorithm using stochastic gradient
descent with Python keras and sklearn library.
We Learned:
How to make predictions for a binary classification problem.
How to apply the technique to a real classification predictive modeling problem.
11
QUIZ
How many divisions on the dataset we have created in the example?
Training set(80%), Test Set(20%)
What was the encoding technique we used to convert the categorical
output labels?
LabelEncoder()
Can any of you recall some of the python libraries we used in our code?
Numpy- Numerical toolkits
Pandas – Data Analysis toolkits
Sklearn – Machine learning toolkit in python
Keras- A neural network API with tensorfow/theano backend
12
THANKS FOR YOUR TIME 
QUESTIONS?
13
View publication statsView publication stats

Single layer perceptron in python

  • 1.
    See discussions, stats,and author profiles for this publication at: https://www.researchgate.net/publication/326866833 Basic Concepts in Neural Networks: Single Layer Perceptron in Python Presentation · June 2018 DOI: 10.13140/RG.2.2.13053.87522 CITATIONS 0 READS 8 1 author: Some of the authors of this publication are also working on these related projects: Wearable Clinic:(Adaptive Sensing & Signal Processing using wearable sensors ) View project Human Activity Recognition with Inertial Sensors using a Deep Learning Approach View project Tahmina Zebin The University of Manchester 17 PUBLICATIONS   19 CITATIONS    SEE PROFILE All content following this page was uploaded by Tahmina Zebin on 23 August 2018. The user has requested enhancement of the downloaded file.
  • 2.
    Neural Networks Basic Conceptsand Implementation Presented by: Tahmina Zebin Tahmina.zebin@Manchester.ac.uk 1
  • 3.
    WHAT ARE NEURALNETWORKS?  A family of Machine Learning techniques inspired by the construction of the human brain.  Neural Network approaches are useful for extracting patterns from images, video, speech and time series data. Some day to day application of Neural Networks you probably have encountered: Recurrent Neural Networks(Automatic Text suggestion) Convolutional Neural networks (Image labeler/Handwritten digit recognizer)  These models can deal with large amounts of data. 2
  • 4.
    TODAY’S FOCUS  Biologicalneuron vs Artificial neuron  A single layer perceptron  Computational steps for training a Perceptron  Implementation of a perceptron model in Python 3
  • 5.
    From Wikipedia 4 BIOLOGICAL NEURONVS THE ARTIFICIAL NEURON SINGLE LAYER PERCEPTRON BIOLOGICAL NEURON
  • 6.
    PERCEPTRON ALGORITHM The Perceptronreceives input signals from examples of training data that we weight and combine in a linear equation called the activation: activation = sum(weight_i * x_i) + bias The activation is then transformed into an output value or prediction using a transfer function, such as the step transfer function. prediction = 1.0 if activation >= 0.0 else 0.0 5 Activation Functions ReLU
  • 7.
    TRAINING A PERCEPTRONWITH THE DATA Gradient Descent is the process of minimizing a function by following the gradients of the cost function. 6 We can estimate the weight values for our training data using stochastic gradient descent. W(t+1) = w(t) + learning_rate * (predicted - actual) * x(t) Stochastic gradient descent requires two parameters: Learning Rate Epochs Cost function/loss function
  • 8.
  • 9.
    LET’S MAKE PREDICTIONSFOR A BINARY CLASSIFICATION PROBLEM. • Modeling the Sonar Dataset. • A data set with 207 observations and 61 variable columns. • The first 60 column of the dataset represent the energy within a particular frequency band, integrated over a certain period of time. • The last column contains the class labels. • There are two classes 0 if the object is a rock, and 1 if the object is a mine (metal cylinder). These steps will give us the foundation to implement and apply the Perceptron algorithm to your own classification predictive modeling problems. 8
  • 10.
    IT’S DEMO TIME.. SpyderIDE (Python 3.6) 9
  • 11.
    PRESENTING RESULTS FROMA NEURAL NETWORK Confusion Matrix Accuracy 10
  • 12.
    REVIEW In this tutorial,we discovered how to implement the Perceptron algorithm using stochastic gradient descent with Python keras and sklearn library. We Learned: How to make predictions for a binary classification problem. How to apply the technique to a real classification predictive modeling problem. 11
  • 13.
    QUIZ How many divisionson the dataset we have created in the example? Training set(80%), Test Set(20%) What was the encoding technique we used to convert the categorical output labels? LabelEncoder() Can any of you recall some of the python libraries we used in our code? Numpy- Numerical toolkits Pandas – Data Analysis toolkits Sklearn – Machine learning toolkit in python Keras- A neural network API with tensorfow/theano backend 12
  • 14.
    THANKS FOR YOURTIME  QUESTIONS? 13 View publication statsView publication stats