0% found this document useful (0 votes)
70 views12 pages

ASML LabManual2023

This document provides laboratory safety information and instructions for implementing artificial neural networks in Python. It outlines objectives like designing perceptron and feedforward neural networks with backpropagation, and using decision trees for classification. Students are asked to complete two labs - one implementing an OR gate with a perceptron neural network, and another implementing a line-following robot with a feedforward network. Proper laboratory safety procedures and first aid instructions are also reviewed.

Uploaded by

tayzarlwintun
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)
70 views12 pages

ASML LabManual2023

This document provides laboratory safety information and instructions for implementing artificial neural networks in Python. It outlines objectives like designing perceptron and feedforward neural networks with backpropagation, and using decision trees for classification. Students are asked to complete two labs - one implementing an OR gate with a perceptron neural network, and another implementing a line-following robot with a feedforward network. Proper laboratory safety procedures and first aid instructions are also reviewed.

Uploaded by

tayzarlwintun
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/ 12

Department of Mechatronics and Autonomous Systems

(Academic Year 2023)

LABORATORY MANUAL
(6513ELEMM/ Autonomous Systems and Machine Learning)

Prepared By
Dr. Theint Theint Thu
Laboratory Safety Information

Introduction
The danger of injury or death from electrical shock, fire, or explosion is present while
conducting experiments in the laboratory. To work safely, it is important that you understand the
prudent practices necessary to minimize the risks and what to do if there is an accident.

Electrical Shock
Avoid contact with conductors in energized electrical circuits. The typical cannot let go (the
current in which a person cannot let go) current is about 6-30 mA. Muscle contractions can prevent
the person from moving away the energized circuit. Possible death can occur as low 50 mA. For a
person that is wet the body resistance can be as low as 1000 ohms. A voltage of 50 volts can result
in death.
Do not touch someone who is being shocked while still in contact with the electrical
conductor or you may also be electrocuted. Instead, press the Emergency Disconnect to shut off all
power. Make sure your hands are dry. The resistance of dry, unbroken skin is relatively high and
thus reduces the risk of shock. Skin that is broken, wet, or damp with sweat has a low resistance.
When working with an energized circuit, work with only your right hand, keeping your left hand
away from all conductive material. This reduces the likelihood of an accident that results in current
passing through your heart. Be cautious of rings, watches, and necklaces. Skin beneath a ring or
watch is damp, lowering the skin resistance. Shoes covering the feet are much safer than sandals.
If the victim is not breathing, find someone certified in Cardiopulmonary resuscitation
(CPR). Be quick! If the victim is unconscious or needs an ambulance, contact the Department
Office for help or call 192 or 01-256112 or 01-384493.

Fire
Transistors and other components can become extremely hot and cause severe burns if
touched. If resistors or other components on your proto-board catch fire, turn off the power supply
and notify the instructor. If electronic instruments catch fire, press the Emergency Disconnect (red
button). These small electrical fires extinguish quickly after the power is shut off. Avoid using fire
extinguishers on electronic instruments. If need any help, contact the Department Office or call 191
or 01-252011 or 01-252022.

First Aid
A first aid kit is located on the wall near the door. Contact the Department Office, if needed.

Page 2 of 12
Artificial Neural Network (ANN) Implementation in Python

Aim
Design perceptron type and feed forward type artificial neural networks with back
propagation and implement decision tree classifier using scikit-learn in Python

I. Objectives
The objectives of today’s experiment are:
• to make the digital circuits design and autonomous mobile robot using artificial neural
network in python
• to study and understand the digital logic gates, robotics, artificial neural network, forward
and back propagation
• to observe the circuits behaviour, robot perception and localization using python
• to understand sensors and actuators
• to test the result of digital circuits using artificial neural network and python
• to apply the decision tree algorithm in machine learning for classification problems
• to create a classification model that predicts the value of a target variable by learning
simple decision rules inferred from the data features
• to understand how to split data into training data and testing data
• to evaluate the performance of a classification model with confusion matrix
• to understand the calculation of precision, recall, f1-score, accuracy, macro average metrics
and weighted average metrics in the confusion matrix

II. Lab report


Each student turns in all lab reports by May 10, 2023. Students must avoid plagiarism on
lab reports.

III. Explanation
This experiment is an introduction to the Python interface (Anaconda Graphical User
Interface (GUI)) and covers the perceptron type and feed forward type neural networks with back
propagation and decision tree classifier. Anaconda Navigator is a desktop GUI that comes with
Anaconda Individual Edition. It makes it easy to launch applications and manage packages and
environments without using command-line commands.

How to Setup a Python Environment for Machine Learning and Deep Learning

Step 1: To download Anaconda, open a web browser and type “anaconda”.

anaconda

Page 3 of 12
Step 2: Click on “Individual Edition - Anaconda”.

Click Here

Step 3: Next, scroll down the web page. In “Anaconda Individual Edition”, choose the right
operating system from three operating systems: Windows, MacOS X and Linux. Click “64-Bit
Graphical Installer” (recommended). After that, Anaconda will be downloaded to “Downloads”
folder. Select bit size is required for Windows User. To check your computer bit size for Windows
10 and Windows 8.1, select the Start button, then select Settings -> System -> About.

Choose Operating System

Select Bit Size

Page 4 of 12
Step 4: Double click the downloaded file to start the installation.

Step 5: Click the continue button, install button until the installation completed successfully.

Page 5 of 12
Page 6 of 12
Getting Started with Anaconda Navigator

MacOS

Step 1: Use Cmd+Space to open Spotlight Search. Type “Navigator” to open the program.

Navigator

(or) Click Here

Click Here

Windows

Step 1: Click start, search or select Anaconda Navigator from the menu.

Page 7 of 12
Launching Anaconda Navigator

Icon

Click Here

Scientific Python Development Environment (Spyder)

RUN Debugging tools Working directory

Variable Explorer
Text Editor

Spyder Icon

IPython Console

Page 8 of 12
Lab 1: Implementing OR Gate using Perceptron Type Neural Network with
Back Propagation
Use ANN classification method to find the corresponding class for [1 1] based on the following
training data without using any machine learning library. Assum learning rate is 0.5 and error
threshold is 0.01.
Training Data Test Data

x1 x2 y x1 x2 y
1 1 1 1 1 ?
1 0 1

0 1 1
0 0 0

x1 w1
I

w2 O
x2 f(I) y

Sigmoid Function
x3=1 w3

Bias

w I O Error
x f(I)

Back Propagation

Page 9 of 12
Lab 2: Implementing a Line Follower Robot using Feed Forward Type Neural Network with
Back Propagation

A line follower robot has two sensors (S1 and S2) to sense the line as shown in the following figure.
If both sensors are ON, robot will move forward and can follow a path. Otherwise, robot will not
move forward. Rotation is not considered in this case. Perform ANN classification method to find
the relationship between sensors and motor. Assum learning rate is 0.5 and error threshold is 0.01.

Test Data

x1 x2 y

1 1 ?

S1 S2

w1
x1 f(Ih1) N1
w2
w7
w3
O
w4 N2 w8
x2 f(Ih2) f(Io) y

w5
w9

x3=1 w6 1

Bias
Page 10 of 12
Lab 3: Decision Tree Classifier in Python with Scikit-learn

Use scikit-learn library to build the decision tree model with iris flower dataset. It can download
from https://www.kaggle.com/uciml/iris or import from the scikit-learn dataset library. Firstly, read
iris dataset and print the head of it to discover the features and labels of three flowers. Assume
training size is 0.75 for training model. Apply decision tree classifier model for prediction. Print
classification report to evaluate the performance of decision tree. Then, perform a python data
visualization library, seaborn, to visualize a heatmap. Calculate precision, recall and f1-score from
confusion matrix using equations. Results must be same with classification report through sklearn.

Three species of Iris Flowers from iris flowers dataset

Iris setosa Iris versicolor Iris virginica

TP FN
a b c
a b+c
d e f FP TN
d+g e+f+h+i
g h i

Example: Converting Confusion Matrix (3x3) to (2x2)

Page 11 of 12
References:
• http://www.ece.ucf.edu/files/labs/EEE3342LabManual.pdf
• “Image Processing and Analysis Using Matlab”, Dr. Nay Zar Aung
• https://www.anaconda.com
• https://docs.anaconda.com/anaconda/install/verify-install/
• https://www.alamy.com/walle-the-robot-walle-walle-wall-e-2008-image152751914.html
• https://www.accelebrate.com/library/tutorials/machine-learning-part1
• https://www.scikit-learn.org

Page 12 of 12

You might also like