0% found this document useful (0 votes)
19 views75 pages

EE5075-2024-Lecture 4

Uploaded by

Kalindu Liyanage
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views75 pages

EE5075-2024-Lecture 4

Uploaded by

Kalindu Liyanage
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 75

EE5075

Artificial Intelligence Applications

LECTURE 4

Machine Learning:
Implementation of Regression and
Classification using ANN
By Buddhika Jayasekara ([email protected])
Recap - Artificial Neuron

✓ Neural computing requires a


number of neurons, to be
connected together into a Inputs Weights
neural network. p1 w1

✓ Each neuron within the w2


a
network is usually a simple
p2
w3 f Output
processing unit which takes p3

one or more inputs and 1


produces an output. Bias
a = f (p1 w1 + p2 w2 + p3 w3 + b ) = f ( pi wi + b )
✓ At each neuron, every input
has an associated weight
which modifies the strength of
each input.
2
Recap - Artificial Neuron

3
Recap - Artificial Neuron

4
Recap - Artificial Neuron

5
Recap - Artificial Neuron

6
Recap - Artificial Neuron

7
Recap - Artificial Neuron

8
Recap - Feed-forward Neural Networks

• Information flow is unidirectional


• Data is presented to Input layer
• Passed on to Hidden Layer
• Passed on to Output layer

• Information processing is parallel

Internal representation
(interpretation) of data

9
Recap - Feedforward neural network

✓ Use data set [x,t] = simplefit_dataset;


✓ Plot(x,t)

10

8
Tartget values

X 6 t
Input Target
space 4
space
2

0
0 1 2 3 4 5 6 7 8 9 10
X values

Neural Network

Feed forward neural network


10
Recap - Artificial Neural Network: Learning

11
Recap - Artificial Neural Network: Learning

12
Recap - Artificial Neural Network: Learning

13
Recap - Gradient Descent Algorithm

14
Machine Learning

8/31/2024 7:26 AM 15
Machine Learning - Applications

8/31/2024 7:26 AM 16
What is Deep Learning?

8/31/2024 7:26 AM 17
Activation Functions

8/31/2024 7:26 AM 18
Activation Functions

8/31/2024 7:26 AM 19
Activation Functions

8/31/2024 7:26 AM 20
Activation Functions

8/31/2024 7:26 AM 21
Activation Functions

8/31/2024 7:26 AM 22
Activation Function - Selection

8/31/2024 7:26 AM 23
Recap - Getting Familiar with Libraries

24
Deep Learning Frameworks

8/31/2024 7:26 AM 25
TensorFlow Keras Module

8/31/2024 7:26 AM 26
8/31/2024 7:26 AM 27
8/31/2024 7:26 AM 28
Machine Learning - Regression
✓ Fitting line or curve to set of data points
✓ Supervised learning

29
Machine Learning -Classification

✓ Predict a category or label


✓ Regression –predict a
number
✓ Supervised learning
✓ E.g line to separate data
points

30
Machine Learning -Classification

✓ Decision boundary may not be linear,


▪ line or hyperplane

31
Classification models

✓ Use of Line for 2D Classification

𝑌 = 𝑚𝑋 + 𝑏

32
Classification

33
Classification

34
8/31/2024 7:26 AM 35
8/31/2024 7:26 AM 36
8/31/2024 7:26 AM 37
8/31/2024 7:26 AM 38
8/31/2024 7:26 AM 39
Student Activity

✓ Download the workbook and follow the class activities

8/31/2024 7:26 AM 40
8/31/2024 7:26 AM 41
8/31/2024 7:26 AM 42
8/31/2024 7:26 AM 43
8/31/2024 7:26 AM 44
8/31/2024 7:26 AM 45
8/31/2024 7:26 AM 46
8/31/2024 7:26 AM 47
8/31/2024 7:26 AM 48
8/31/2024 7:26 AM 49
8/31/2024 7:26 AM 50
8/31/2024 7:26 AM 51
8/31/2024 7:26 AM 52
8/31/2024 7:26 AM 53
Example -Regression

54
55
56
57
Self Study and Assignment Q1 - Classification
Example
✓ Use sklearn.datasets
load_breast_cancer
Ref: https://scikit-learn.org/stable/datasets/toy_dataset.html

58
59
Benign: These are not cancerous.

Malignant: These are cancerous.

60
NN Model

61
62
https://scikit-
learn.org/stable/modules/generated/sklearn.preprocessing.StandardScaler.html
63
Additional References

✓ tf.keras.layers.Dense:
https://www.tensorflow.org/api_docs/python/tf/keras/layers/De
nse
✓ tf.keras.optimizers.Adam:
https://www.tensorflow.org/api_docs/python/tf/keras/optimizer
s/Adam
✓ tf.keras.losses.BinaryCrossentropy:
https://www.tensorflow.org/api_docs/python/tf/keras/losses/Bi
naryCrossentropy

64
The Sequential model - tf.keras.Sequential

✓ Ref: https://www.tensorflow.org/guide/keras/sequential_model

65
NN Model and Training

A Neuron

66
NN Model and Training

67
68
69
Use the NN model for Prediction

70
71
72
Assignment Q1 - Classification
✓ Use sklearn.datasets
And select any other dataset and develop an
ANN with hidden layer with many neurons
Ref: https://scikit-learn.org/stable/datasets/toy_dataset.html

73
Self Study

✓ Logistic regression vs Linear regression


✓ Use of logistic regression for classification
✓ Loss functions
▪ Binary cross entropy
▪ Mean squared error

74
Thank You

8/31/2024 7:26 AM 75

You might also like