Chapter 3: Applied python in industrial Engineering - Machine
learning Approach
Lê Đức Đạo, Phd
Industrial System Enginerring Department
Faculty of Mechanical Engineering
Ho Chi Minh City University Of Science and Technology
Phone: 0937286746
Email: ducdao92@[Link]
STRUCTURE OF LECTURER
Machine LEARNING general concepts
Supervised learning
Unsupervised learning
Iris data set introduction
Machine learning based on Python linear regression tool
MACHINE LEARNING
Machine learning is an application of artificial intelligence that involves algorithms and data that
automatically analyse and make decision by itself without human intervention. It describes how
computer perform tasks on their own by previous experiences . It is not dependent on any explicit
programming but the data fed into it . It is a complicated process. . Therefore we can say in machine
language artificial intelligence is generated on the basis of experience
MACHINE LEARNING
APPLICATION
1. Application in production system
• Demand forecasting
• Predictive Inventory planning
2. In Financial Services :-
• Credit worthiness evaluation
3. Health care & Life science :-
• Predictive health Management
• Healthcare provider sentiment analysis
MACHINE LEARNING
CONCEPTS
Gathering Data :- For the purpose of developing our machine learning model, our first step would
be to gather relevant data that can be used to differentiate.
Preparing that Data :- Once we have gathered the data for the two features, our next step
would be to prepare data for further steps. A key focus of this stage is to recognize and minimize any
potential biases (will learn in forecasting course)
Choosing a Model :- The selection of the model type is our next course of action once we are
done with the data-centric steps. There are various existing models developed by data scientists which
can be used for different purposes. These models are designed with different goals in mind.
MACHINE LEARNING
CONCEPTS
Training :- At the heart of the machine learning process is the training of the model. Bulk of the
“learning” is done at this stage. Here we use the part of data set allocated for training to teach
our model to differentiate
Evaluation :- With the model trained, it needs to be tested to see if it would operate well in real
world situations. That is why the part of the data set created for evaluation is used to check the
model’s proficiency. This puts the model in a scenario where it encounters situations that were
not a part of its training.
Prediction :- The final step of the machine learning process is prediction. This is the stage
where we consider the model to be ready for practical applications
TYPE OF MACHINE
LEARNING
SUPERVISED LEARNING
Supervised learning is one, where you can consider the learning is guided by a teacher. We have a
dataset which acts as a teacher and its role is to train the model or the machine. Once the model gets
trained it can start making a prediction or decision when data is given to it.
SUPERVISED LEARNING
CAR
CAR
+ BIKE = Training Dataset
BIKE
Samples Labels
[In supervised learning, we need some thing called a Labelled Training Dataset ]
9
SUPERVISED LEARNING
CAR
𝑓( ,
)=
CAR
+ BIKE = Training Dataset
BIKE
Samples Labels
[ Given a labelled dataset, the task is to devise a function which takes the dataset, and a new sample, and
produces an output value.]
10
SUPERVISED LEARNING
CAR
𝑓( ,
)=
CAR
+ BIKE = Training Dataset
BIKE
Samples Labels
[ Given a labelled dataset, the task is to devise a function which takes the dataset, and a new sample, and
produces an output value.]
11
SUPERVISED LEARNING
CAR
𝑓( , )= CAR
CAR
+ BIKE = Training Dataset
BIKE
Samples Labels
[ Given a labelled dataset, the task is to devise a function which takes the dataset, and a new sample, and
produces an output value.]
12
SUPERVISED LEARNING
CAR
𝑓( , )= CAR
Classification
CAR
+ BIKE = Training Dataset
BIKE
Samples Labels
[ If the possible output values of the function are predefined and discrete/categorical, it is called
Classification
33
SUPERVISED LEARNING
CAR
𝑓( , )= CAR
Classification
CAR
+ BIKE = Training Dataset
BIKE
Samples Labels
[ Predefined classes means, it will produce output only from the labels defined in the dataset. For example,
even if we input a bus, it will produce either CAR or BIKE ]
14
SUPERVISED LEARNING
Elephant
Elephant
Classifier
Tiger Identify the Animal ?
Dataset
15
SUPERVISED
LEARNING
Dataset
[ If the possible output values of the function are continuous real values, then it is called Regression
16
UNSUPERVISED LEARNING
The model learns through observation and finds structures in the data. Once the model is given a dataset, it
automatically finds patterns and relationships in the dataset by creating clusters in it.
[Link]
tch?v=KzJORp8bgqs
Example of K-mean method
WHAT IS
UNSUPERVISED
LEARNING CAR
CAR
BIKE
BIKE
Dataset
[ In the unsupervised learning, we do not need to know the labels or Ground truth
values ] 18
WHAT IS UNSUPERVISED
LEARNING
Clustering
Dataset
[ The task is to identify the patterns like group the similar objects together ]
39
MORE EXAMPLE
UNSUPERVISED
LEARNING
Dataset
20
SEMI-SUPERVISED
LEARNING
Semi-supervised learning comprises characteristics of both supervised and unsupervised
machine learning. It uses the combination of labeled and unlabeled datasets to train its
algorithms. Using both types of datasets, semi-supervised learning overcomes the drawbacks
of the options mentioned above
• Consider an example of a college student. A student learning a concept under a
teacher’s supervision in college is termed supervised learning. In unsupervised
learning, a student self-learns the same concept at home without a teacher’s
guidance. Meanwhile, a student revising the concept after learning under the
direction of a teacher in college is a semi-supervised form of learning.
Ex. [Link]
REINFORCEMENT
LEARNING
22
ANOTHER
EXAMPLE
Agent Task Environment
23
REINFORCEME
NT LEARNING
Punishment
24
REINFORCEMENT
LEARNING
Reward
25
REINFORCEME
NT LEARNING
Reward
Baby Learn from the Trials and Errors
Reinforcement Learning 26
USING PYTHON FOR
PREDICTION- SUPERVISED
LEARNING
Introduction to Iris data set
USING PYTHON FOR
PREDICTION- SUPERVISED
LEARNING Training set usually 60-70% of data set
Label Testing set usually 30% of data set
Species
Training is the process of making
the system able to learn
Testing is the process to ensure the
quality of learning system
USING PYTHON FOR
PREDICTION- SUPERVISED
LEARNING Import data set Iris
Set x to
petal_length
Set y to petal_width
Input Leaning model
output
Petal Supervised Petal
length learning width
USING PYTHON FOR
PREDICTION- SUPERVISED
LEARNING
Visualize Iris data set
Data is qualified for linear regression analysi
USING PYTHON FOR
PREDICTION- SUPERVISED
LEARNING
Split data for training and testing
60% for training and 40% for Testing
USING PYTHON FOR
PREDICTION- SUPERVISED
LEARNING
Reshape the data to one column
Similar for y_test
USING PYTHON FOR
PREDICTION- SUPERVISED
LEARNING Reshape the data to one column
Similar for y_train the model
USING PYTHON FOR
PREDICTION- SUPERVISED
LEARNING
Predict petal width from petal_length
USING PYTHON FOR
PREDICTION- SUPERVISED
LEARNING
Simple function for predict
output y_pred_train1 from x_train
USING PYTHON FOR
PREDICTION- SUPERVISED
LEARNING
Visualize the predict y_train set
Fit line for linear regression is determined
USING PYTHON FOR
PREDICTION- SUPERVISED
LEARNING
Visualize the predict y_test
IN CLASS EXERCISES
User linear-regression model for
predict weight from height
SEFT-LEARNING TOOL AT
HOME
LSTM tool for Forecasting ([Link]
v=CbTU92pbDKw)
K-mean algorithm (
[Link]
[Link] (semi-
supervised)