0% found this document useful (0 votes)
11 views

Week 1 - Lab

Uploaded by

saad.bashir1431
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Week 1 - Lab

Uploaded by

saad.bashir1431
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

[Introduction to Fuzzy/Neural Systems]

1
[Laboratory Orientation Introduction to Python]

Module 1 Exp 1 Laboratory Orientation


Introduction to Python

Course Learning Outcomes:


C4. Conduct experiments using advanced tools related to fuzzy and neural
systems.
C5. Extend existing knowledge in designing a feedback fuzzy controller and
single/multilayer neural networks based on the given Industrial
requirements.
C7. Interpret and evaluate through written and oral forms.
C8. Lead multiple groups and projects with decision making responsibilities.
Topics
Laboratory Orientation
Introduction to Python
Lab orientation
Introduction
This laboratory is used for undergraduate laboratory experiments in the field of Bachelor of
Science in Mechatronics Engineering ( BSME)

3rd year / 3rd trimester

Orientation
 Setting of “house” rules.
 Lab Rules and Regulations
 Safety Precaution

Setting of “house” rules.


 Turn your cell phone off or to vibrate before the start of class.
 No food or drinks are allowed in the class.
 No playing or running, and no throwing of objects of any kind in class rooms. Be alert
and attentive at all times.
 Do not converse with other students while the teacher taking the class.
 Class begins promptly at the beginning of the class period. It is advisable that you be
in your seat and ready to start participating in class at that time.
 Always bring the required supplies and be ready to be actively engaged in the learning
process. This communicates preparedness and interest.
 Don’t read the newspaper during class! Put it away before the start of class. Your
attention should be focused on the business at hand – the class, its content, and the
professor.

Course Module
 Your professor expects your full attention for the entire class period. If you know that
you’ll need to leave before the class is over, try to sit as close to the door as possible
so as not to disrupt others. Similarly, if you arrive in class late, just slip in as quietly
as possible and take the first available seat you come to.
 Do not sleep in class! Laying your head on the desk or sleeping in class is rude, and it
is distracting to others. Turn in assignments on time.
 Being courteous in class does not mean that you have to agree with everything that is
being said. However, your point will be much more credible if conveyed without
rudeness, aggression, or hostility. If you strongly disagree with your professor, it is a
good idea to speak with him/her after class.
 When you have a question or comment, please raise your hand first as a courtesy to
your classmates and the professor. Remember, your questions are NOT an imposition
– they are welcome. Chances are, if you have a question, someone else is thinking the
same thing but is too shy to ask it. So, ask questions! You’ll learn more, it makes the
class more interesting, and you are helping others learn as well.
 If an emergency arises that requires an absence from a session, it is your
responsibility to get the notes and all other information that was covered in class from
a colleague you trust.

Lab Rules and Regulations


 Besides the General Rules of Laboratories and the Computer Utilization Policy, there
are other specific rule that apply to this laboratory:
 The laboratory facilities are to be used only for academic purposes.
 Academic experiment sessions will be given priority. Other user may use the
laboratory when there is no experiment going on. Prior permission must be obtained
from the laboratory staff before the students are allowed to use the laboratory
 Use of the Engineering laboratory is restricted to engineering students. Students from
other faculties need to obtain approval from the laboratory supervisor first before
using the laboratory.
 No food or beverages are allowed in the laboratories. Bags must be left at the
indicated place.
 All students must observe the University Dress Code. Don’t wear loose or baggy
clothing or jewellery when using tools. Tie back dangling, long hair when using tools.
 Wear eye protection, and gloves when necessary.
 Never touch a spinning or rotating tool.
 Ask the instructor to check all electrical circuits and make sure all switches are in the
off position before you turn on the power.
 When working with electrical circuits, be sure that the current is turned off before
making adjustments in the circuit.
 Do not connect the terminals of a battery or power supply to each other with a wire.
Such a wire will become dangerously hot.
 The laboratory timetable must be followed strictly. Prior permissions from the
laboratory staff must be obtained in order to use the laboratory during times other
than the laboratory sessions. Students must be punctual for laboratory experiments.
 Students who are unable to attend laboratory sessions (with valid reasons) must
inform the laboratory staff; through an official letter.
 Experiments conducted in the laboratory must be finished within the allocated time.
Refer to the laboratory instructor/staff if you are not sure how to operate the
laboratory equipment.
[Introduction to Fuzzy/Neural Systems]
3
[Laboratory Orientation Introduction to Python]

 All equipment must be returned to their original location after being used. Workspace
must be kept clean and tidy at all times.
 Abuse of the laboratory hardware, software, and/or systems will result in dismissal
from the laboratory and disciplinary action.
 Laboratory users are strictly prohibited from taking anything out from the laboratory
without prior consent from the laboratory staff.
 Laboratory users are not allowed to repair the laboratory equipment themselves.
Please report immediately to the laboratory staff if you discover any problem with
the equipment/software. Please adhere to standard equipment operating procedure
at all times and handle all equipment with care.
 Students should follow the instructions on the lab manual whenever possible.
Students are also encouraged to be creative and come up their own ways to achieve
the experiment's goal. However, if there is any change to the experimental apparatus
or the way of conducting the experiment, for safety reason, students should get the
instructor's permission before you try something original.
 All laboratory users are liable for any damage to equipment due to their own
negligence.

Safety Precaution
 Work with a dry hand.
 Do not open up equipment casing.
 Do not unplug any electrical connection.
 Please refer to the lab sheet for other safety precautions in each individual
experiment.

Introduction to python
Introduction to Python Programming language

Python is developed by Guido van Rossum. Guido van Rossum started implementing
Python in 1989. Python is a very simple programming language so even if you are new to
programming, you can learn python without facing any issues.

Interesting fact: Python is named after the comedy television show Monty Python’s Flying
Circus. It is not named after the Python snake.

Course Module
Features of Python programming language

1. Readable: Python is a very readable language.

2. Easy to Learn: Learning python is easy as this is a expressive and high level programming
language, which means it is easy to understand the language and thus easy to learn.

3. Cross platform: Python is available and can run on various operating systems such as
Mac, Windows, Linux, Unix etc. This makes it a cross platform and portable language.

4. Open Source: Python is a open source programming language.

5. Large standard library: Python comes with a large standard library that has some handy
codes and functions which we can use while writing code in Python.

6. Free: Python is free to download and use. This means you can download it for free and use
it in your application. See: Open Source Python License. Python is an example of a FLOSS
(Free/Libre Open Source Software), which means you can freely distribute copies of this
software, read its source code and modify it.

7. Supports exception handling: If you are new, you may wonder what is an exception? An
exception is an event that can occur during program exception and can disrupt the normal
flow of program. Python supports exception handling which means we can write less error
prone code and can test various scenarios that can cause an exception later on.

8. Advanced features: Supports generators and list comprehensions. We will cover these
features later.

9. Automatic memory management: Python supports automatic memory management


which means the memory is cleared and freed automatically. You do not have to bother
clearing the memory.
[Introduction to Fuzzy/Neural Systems]
5
[Laboratory Orientation Introduction to Python]

How to install Python

Python installation is pretty simple, you can install it on any operating system such as
Windows, Mac OS X, Ubuntu etc.

How to Install Python

You can install Python on any operating system such as Windows, Mac OS X, Linux/Unix and
others.

To install the Python on your operating system, go to this


link: https://www.python.org/downloads/. You will see a screen like this.

This is the official Python website and it will detect the operating system and based on that
it would recommend you to download Python. Here I am using Mac OS X so it gave me the
download options for Python 2 and Python 3 for Mac OS X. I would recommend you to
download the latest version of Python 3 (Python 3.6.4 in the screenshot).

Installation steps are pretty simple. You just have to accept the agreement and finish the
installation.

If you are using Mac OS X then you may notice that Python is already installed in your system,
however it would most likely be a Python 2 so you can download the latest Python 3 version
from here and install it in your system.

Course Module
How to Get Started on Kaggle

Next, we'll give you a step-by-step action plan for gently ramping up and competing
on Kaggle.

Step 1: Pick a programming language.

First, we recommend picking one programming language and sticking with it. Both Python
and R are popular on Kaggle and in the broader data science community.

If you're starting with a blank slate, we recommend Python because it's a general-purpose
programming language that you can use from end-to-end.

 R vs Python for Data Science


 How to Learn Python for Data Science

Step 2: Learn the basics of exploring data.

The ability to load, navigate, and plot your data (i.e. exploratory analysis) is the first step in
data science because it informs the various decisions you'll make throughout model training.

If you go the route of Python, then we recommend the Seaborn library, which was designed
specifically for this purpose. It has high-level functions for plotting many of the most
common and useful charts.
 Python Seaborn Tutorial

Step 3: Train your first machine learning model.

Before jumping into Kaggle, we recommend training a model on an easier, more manageable
dataset. This will allow you to become familiar with machine learning libraries and the lay of
the land.

The key is to start developing good habits, such as splitting your dataset into separate
training and testing sets, cross-validating to avoid overfitting, and using proper performance
metrics.

For Python, the best general-purpose machine learning library is Scikit-Learn.


 Python Scikit-Learn Tutorial

Step 4: Tackle the 'Getting Started' competitions.

Now we're ready to try Kaggle competitions, which fall into several categories. The most
common ones are:

 Featured - These are usually sponsored by companies, organizations, or even


governments. They have the largest prize pools.
[Introduction to Fuzzy/Neural Systems]
7
[Laboratory Orientation Introduction to Python]

 Research - These are research-oriented and have little to no prize money. They also
have non-traditional submission processes.
 Recruitment - These are sponsored by companies who want to hire data scientists.
These are still relatively uncommon.
 Getting Started - These are structured like featured competitions, but they have no
prize pools. They feature easier datasets, plenty of tutorials, and rolling submission windows
so you can enter them at any time.
The 'Getting Started' competitions are great for beginners because they give you a low-stakes
environment to learn, and they are also supported by many community-created tutorials.

Step 5: Compete to maximize learnings, not earnings.

With that foundation laid, it's time to progress to 'Featured' competitions. In general, these
will require much more time and effort to rank well.

For that reason, we recommend picking your battles wisely. Enter competitions that will
expose you to techniques and technologies that align with your long-term goals.

While prize money is nice, the more valuable (and reliable) reward will be the skills you'll
develop for your career.

Tips for Enjoying Kaggle

Finally, we'll cover our 7 favorite tips for making the most out of your time on Kaggle.

Tip #1: Set incremental goals.

If you've ever played an addicting video game, you'll know the power of incremental goals.
That's how great games get you hooked. Each goal is big enough for a sense of
accomplishment, yet realistic enough to be within reach.

Course Module
Most Kaggle participants will never win a single competition, and that's completely fine. If
you set that as your very first milestone, you may feel discouraged and lose motivation after
a few tries.

Incremental targets make the journey more enjoyable. For example:

 Make a submission that beats the benchmark solution.


 Score in the top 50% in one competition.
 Score in the top 25% in one competition.
 Score in the top 25% in three competitions.
 Score in the top 10% in one competition.
 Win a competition!

This strategy will allow you to measure your progress and improvement along the way.

Tip #2: Review most voted kernels.

Kaggle has a cool feature in which participants can submit "kernels," which are short
scripts that explore a concept, showcase a technique, or even share a solution.
[Introduction to Fuzzy/Neural Systems]
9
[Laboratory Orientation Introduction to Python]

When you start a competition or when you hit a plateau, reviewing popular kernels can spark
more ideas.

Tip #3: Ask questions on the forums.

Don't be afraid to ask "stupid" questions.

After all, what's the worst thing that could happen? Maybe you get ignored... and that's all.

On the other hand, you have plenty to gain, including advice and coaching from more
experienced data scientists.

Tip #4: Work solo to develop core skills.

In the beginning, we recommend working alone. This will force you to tackle every step of
the applied machine learning process, including exploratory analysis, data cleaning, feature
engineering, and model training.

If you start teaming up too early, you could miss opportunities to develop those cornerstone
skills.

Course Module
Tip #5: Team up to push your boundaries.

With that said, teaming up in future competitions can be a great way to push your boundaries
and learn from others. Many past winners have been teams who joined forces to combine
their knowledge.

In addition, once you master the technical skills of machine learning, you can collaborate
with others who may have more domain knowledge than you do, further expanding your
opportunities.

Tip #6: Remember that Kaggle can be a stepping stone.

Remember, you're not necessarily committing to be a long-term Kaggler. If you find out that
you dislike the format, then it's no big deal.

In fact, many people use Kaggle as a stepping stone before moving onto their own projects
or becoming full-time data scientists.

This is another reason to focus on learning as much as you can. For the long run, it's better
to target competitions that will give you relevant experience than to chase the biggest prize
pools.

Tip #7: Don't worry about low ranks.

Some beginners never start because they're worried about low ranks showing up in their
profile. Of course, competition anxiety is a real phenomenon, and it isn't limited to Kaggle.

However, low ranks are really not a big deal. No one else will judge you because they were
all beginners at one point.

Even so, if you're still really worried about low rankings in your profile, you could also create
a separate practice account for learning the ropes. Once you feel comfortable, you can start
using your "main account" to build your trophy case.
[Introduction to Fuzzy/Neural Systems]
11
[Laboratory Orientation Introduction to Python]

(Again, this is totally unnecessary!)

Conclusion

In this guide, we shared the 5 steps for getting started on Kaggle:

1. Pick a programming language.


2. Learn the basics of exploring data.
3. Train your first machine learning model.
4. Tackle the 'Getting Started' competitions.
5. Compete to maximize learnings, not earnings.

Finally, we shared our 7 favorite tips for enjoying your time on the platform:

 Set incremental goals.


 Review most voted kernels.
 Asks questions on the forums.
 Work solo to develop core skills.
 Team up to push your boundaries.
 Remember that Kaggle can be a stepping stone.
 Don't worry about low ranks.

Introduction to ANN using MATLAB


1. MATLAB
Step 1: create a dataset with input and output neurons
See datset.xlsx
Step 2: In MATLAB, use xlsread command to read the dataset file

Course Module
Step 3: Split the inputs from the dataset
inputs=a(:,1:6)’;

Step 4: Split the outputs from the dataset


outputs=a(:,7:8)’;
[Introduction to Fuzzy/Neural Systems]
13
[Laboratory Orientation Introduction to Python]

Step 5: use nntool command to create the Artificial Neural Network

Step 6: use import button to add the inputs and targets to create the Artificial Neural
Network

Course Module
Step 7: use New button to create the Artificial Neural Network by specifying the
parameters for the ANN
[Introduction to Fuzzy/Neural Systems]
15
[Laboratory Orientation Introduction to Python]

Step 8: use Create button to create the Artificial Neural Network

Course Module
Step 9: Double click the network to see the ANN and train the network

Step 10: click train button and set the training info and training parameters (inputs and
Targets)
[Introduction to Fuzzy/Neural Systems]
17
[Laboratory Orientation Introduction to Python]

Step 11: Train the network

Course Module
Step 12: export the network_outputs
[Introduction to Fuzzy/Neural Systems]
19
[Laboratory Orientation Introduction to Python]

Step 12: open the network_outputs from workspace and compare with the actual outputs
to check the accuracy of the NN learining

Course Module
If the value is greater than 0.9 then it is 1
If the value is less than 0.1 then it is 0

Repeat the procedure for anytype of application

<Exercise 1. Implement artificial neural network model using python and Matlab
programming environment.

References and Supplementary Materials


Books and Journals
[Introduction to Fuzzy/Neural Systems]
21
[Laboratory Orientation Introduction to Python]

1. Van Rossum, G. (2007). Python Programming Language. In USENIX annual technical


conference (Vol. 41, p. 36).
2. SN, S. (2003). Introduction to artificial neural networks.
3. Rashid, T. (2016). Make your own neural network. CreateSpace Independent Publishing
Platform.

Online Supplementary Reading Materials

1. Chaitanya Singh; How to Install Python. (n.d.). Retrieved 14 May 2020, from
https://beginnersbook.com/2018/01/python-installation/; 14-05-2020

Course Module

You might also like