SlideShare a Scribd company logo
國立臺北護理健康大學 NTUHS
Model Simulation
Orozco Hsu
2021-05-06
1
About me
• Education
• NCU (MIS)、NCCU (CS)
• Work Experience
• Telecom big data Innovation
• AI projects
• Retail marketing technology
• User Group
• TW Spark User Group
• TW Hadoop User Group
• Taiwan Data Engineer Association Director
• Research
• Big Data/ ML/ AIOT/ AI Columnist
2
「How can you not get romantic about baseball ? 」
Tutorial
Content
3
Simulation vs. Machine Learning
Monte Carlo Simulation
Monte Carlo Simulation Application
Homework
Code
• Download code
• https://github.com/orozcohsu/ntunhs_2020/tree/master/alg_20210506
4
Simulation vs. Machine Learning
• Simulation and machine learning are related in that they both revolve
around models, but they are very different.
• In fact, simulation and machine learning are almost opposites.
5
Simulation vs. Machine Learning
• Simulation Characteristics
• With simulation the model is often known (we know how to take input values,
make a calculation, and determine the output).
• Inputs are unknown. Inputs (at least some of them) are random variables and
we don't know their values exactly.
• Historical data is used to fit a probability distribution to the input or a
probability distribution is constructed from expert estimates.
• The goal is to find a range of outcomes by randomly sampling input values
and calculating output repeatedly.
6
Simulation vs. Machine Learning
7
Simulation vs. Machine Learning
• Machine Learning Characteristics
• In a machine learning problem the model is unknown initially.
• We have no way of determining the output value based on input values.
• If we have a set of data where inputs and the corresponding output are
known, we can use supervised learning to train a machine learning model.
• Supervised learning means we keep track of how well the machine learning
model is predicting versus the known outputs. Each iteration of the learning
process refines the model to improve prediction.
8
Simulation vs. Machine Learning
Before Training After Training
9
Simulation vs. Machine Learning
• Summary
• In simulation, the main source of uncertainty is in the inputs.
• We have to repeatedly simulate to get a range of possible outputs and make
statements about outcome probabilities.
• In machine learning, the main source of uncertainty is in the model. When
making a prediction, the model is often not 100% certain of the prediction.
Model Performance Evaluation
10
Monte Carlo Simulation
• Unlike a normal forecasting model, Monte Carlo Simulation predicts a
set of outcomes based on an estimated range of values versus a set of
fixed input values.
• By leveraging a probability distribution, such as a uniform or normal
distribution, for any variable that has inherent uncertainty. Then,
recalculates the results over and over, each time using a different set
of random numbers between the minimum and maximum values.
• This exercise can be repeated thousands of times to produce a large
number of likely outcomes.
11
Monte Carlo Simulation
• Monte Carlo Simulations are also utilized for long-term predictions
due to their accuracy. As the number of inputs increase, the number
of forecasts also grows, allowing you to project outcomes farther out
in time with more accuracy. When a Monte Carlo Simulation is
complete, it yields a range of possible outcomes with the probability
of each result occurring.
• One simple example of a Monte Carlo Simulation is to consider
calculating the probability of rolling two standard dice. There are 36
combinations of dice rolls.Using a Monte Carlo Simulation, you can
simulate rolling the dice 10,000 times (or more) to achieve more
accurate predictions.
12
Monte Carlo Simulation
• Firstly define the target.
• Let the computer shoot N darts blindfolded,
and then remove the dart that hit the
target, and then use the N you just shot
out and the X that hit the target.
• Estimate how big this target is.
13
Monte Carlo Simulation
• Assuming that our N=100 and the dart hits 78 rounds (X=78), we can
estimate that the pi (π) is approximately: (78/100)*4 = 3.12.
14
Monte Carlo Simulation
• Monte Carlo simulation based on law of large numbers.
• It is inherently a risk analysis tool since we assign probability
distributions to all random variable model inputs.
• The input variables are randomly sampled and the output is
recorded. This is repeated thousands of times resulting in a histogram
of output values and their frequency.
• Its average value will be closer to the theoretical value.
15
https://en.wikipedia.org/wiki/Law_of_large_numbers
Rolling 2 dice 1000 times
Monte Carlo Simulation
• As long as you have probability
distribution, you can use Monte
Carlo Simulation to sampling value.
16
monte_carlo_simpling_distribution.ipynb
Monte Carlo Simulation
17
Monte Carlo Simulation Application
• Production lines
• Sales forecast
• Reliability Analysis
• Waiting Lines
• Budget forecast
• Project Management
18
• Cost estimation
• Industrial process
• Project selection
• Acceptance sampling
• Markov Chains (MCMC)
• Imbalanced dataset
• And more
Monte Carlo Simulation Application
• PMBOK (Project Management Body of Knowledge)
• It is an important technique in risk management that many PMP and PMI-
RMP exam study books.
• It is a quantitative risk analysis technique used in identifying the risk level of
achieving objectives.
19
https://www.pmi.org/pmbok-guide-standards
https://pmstudycircle.com/2015/02/monte-carlo-simulation/
Monte Carlo Simulation Application
• Project Management – risk
assessment
• Blue bar is the probability of
completion days, the 58th day is
the most possible completion
day (9%); probability of
completion within 54 days is
22% or can’t completion
probability is (100%-22%=78%)
• Orange line (S curve) is the
quantitative risk assessment of
PMBOK, we use Monte Carlo
simulation (normal distribution)
20
22%
9%
simulation.xlsx Homework 1
Monte Carlo Simulation Application
• Imbalanced dataset
• Most practical situations are lack of data, or
data is difficult to generate.
• We can generate false samples based on a
certain method that has been determined. The
method of generation is actually the basis of
statistics, which is to generate random
observations from a limited population.
• If the process itself is random, or can be
converted into a certain random number, we
can simulate it through Monte Carlo, and then
use these simulations.
21
Monte Carlo Simulation Application
• Sales commissions prediction next year
22
Commission Amount = Actual Sales * Commission Rate
Monte Carlo Simulation Application
• Assume everyone makes 100% of their target and earn 4%
commission rate
• Or
23
Budget
forecast!!
Monte Carlo Simulation Application
24
• A Monte Carlo simulation is a useful tool for predicting future results
by calculating a formula multiple times with different random inputs.
• Using numpy and pandas to build a model and generate multiple
potential results and analyze them is relatively straightforward.
• The other added benefit is that analysts can run many scenarios by
changing the inputs and can move on to much more sophisticated
models in the future if the needs arise.
monde_carlo_simulation_with_commission_prediction.ipynb
Homework 2
Homework
• Please fill-in the value of table for your investigation of simulation.
• Some simple input changes you can make to see how the results change:
• Increase top commission rate to 5% (original is 4%)
• Decrease the number of sales people (change num_reps=500)
• Change the expected standard deviation to a higher amount (change std_dev=.1)
• Modify the distribution of targets (change distribution from normal to others)
25

More Related Content

PPT
Or ppt,new
PPTX
The monte carlo method
PPTX
Monte carlo simulation
PDF
High Dimensional Quasi Monte Carlo Method in Finance
PDF
Monte carlo simulation
PDF
The use of Monte Carlo simulation in quantitative risk assessment of IT projects
PDF
Optimization
PPT
Monte Carlo Simulation Of Heston Model In Matlab(1)
Or ppt,new
The monte carlo method
Monte carlo simulation
High Dimensional Quasi Monte Carlo Method in Finance
Monte carlo simulation
The use of Monte Carlo simulation in quantitative risk assessment of IT projects
Optimization
Monte Carlo Simulation Of Heston Model In Matlab(1)

What's hot (20)

PPT
Monte carlo integration, importance sampling, basic idea of markov chain mont...
PPT
Monte Carlo Simulation - Paul wilmott
ODT
Probability and random processes project based learning template.pdf
PPTX
Monte carlo simulation
PPTX
Monte carlo simulation
PPT
Operational Research
PPTX
Monte Carlo and Markov Chain
PPTX
Monte Carlo Simulation
PDF
An introduction to machine learning and statistics
PPTX
Monte carlo presentation for analysis of business growth
PDF
Anomaly detection
PPTX
Unit2 montecarlosimulation
PPTX
Midsquare method- simulation system
PPTX
Machine learning algorithms
PPTX
Pseudorandom number generators powerpoint
PPTX
Machine learning: Stock Price Prediction
PPTX
Factorial of a number in python
PPTX
Machine Learning Project - 1994 U.S. Census
PDF
Modelling and evaluation
PDF
L2. Evaluating Machine Learning Algorithms I
Monte carlo integration, importance sampling, basic idea of markov chain mont...
Monte Carlo Simulation - Paul wilmott
Probability and random processes project based learning template.pdf
Monte carlo simulation
Monte carlo simulation
Operational Research
Monte Carlo and Markov Chain
Monte Carlo Simulation
An introduction to machine learning and statistics
Monte carlo presentation for analysis of business growth
Anomaly detection
Unit2 montecarlosimulation
Midsquare method- simulation system
Machine learning algorithms
Pseudorandom number generators powerpoint
Machine learning: Stock Price Prediction
Factorial of a number in python
Machine Learning Project - 1994 U.S. Census
Modelling and evaluation
L2. Evaluating Machine Learning Algorithms I
Ad

Similar to model simulating (20)

DOCX
Modelling with simulation
PDF
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)
PPTX
Estimating default risk in fund structures
PPTX
Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...
PPT
Machine learning introduction to unit 1.ppt
PPT
MIS637_Final_Project_Rahul_Bhatia
PPTX
Applications of Machine Learning in High Frequency Trading
PPTX
Week14_Business Simulation Modeling MSBA.pptx
PDF
Complete picture of Ensemble-Learning, boosting, bagging
PPTX
Discrete event simulation
PPT
Lecture: introduction to Machine Learning.ppt
PPTX
An Introduction to Simulation in the Social Sciences
PPTX
Robust Design And Variation Reduction Using DiscoverSim
PDF
When Should I Use Simulation?
PPT
Simulation and monte carlo some general principles
PPTX
Ml ppt at
PPTX
Model Development And Evaluation in ML.pptx
PPTX
Machine-Learning-Overview a statistical approach
PPTX
Applications of simulation in Business with Example
PDF
Monte Carlo Simulation lecture.pdf
Modelling with simulation
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)
Estimating default risk in fund structures
Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...
Machine learning introduction to unit 1.ppt
MIS637_Final_Project_Rahul_Bhatia
Applications of Machine Learning in High Frequency Trading
Week14_Business Simulation Modeling MSBA.pptx
Complete picture of Ensemble-Learning, boosting, bagging
Discrete event simulation
Lecture: introduction to Machine Learning.ppt
An Introduction to Simulation in the Social Sciences
Robust Design And Variation Reduction Using DiscoverSim
When Should I Use Simulation?
Simulation and monte carlo some general principles
Ml ppt at
Model Development And Evaluation in ML.pptx
Machine-Learning-Overview a statistical approach
Applications of simulation in Business with Example
Monte Carlo Simulation lecture.pdf
Ad

More from FEG (20)

PDF
Supervised learning in decision tree algorithm
 
PDF
Unsupervised learning in data clustering
 
PDF
CNN_Image Classification for deep learning.pdf
 
PDF
Sequence Model with practicing hands on coding.pdf
 
PDF
Seq2seq Model introduction with practicing hands on coding.pdf
 
PDF
AIGEN introduction with practicing hands on coding.pdf
 
PDF
資料視覺化_Exploation_Data_Analysis_20241015.pdf
 
PDF
Operation_research_Linear_programming_20241015.pdf
 
PDF
Operation_research_Linear_programming_20241112.pdf
 
PDF
非監督是學習_Kmeans_process_visualization20241110.pdf
 
PDF
Sequence Model pytorch at colab with gpu.pdf
 
PDF
學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf
 
PDF
資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf
 
PDF
Pytorch cnn netowork introduction 20240318
 
PDF
2023 Decision Tree analysis in business practices
 
PDF
2023 Clustering analysis using Python from scratch
 
PDF
2023 Data visualization using Python from scratch
 
PDF
2023 Supervised Learning for Orange3 from scratch
 
PDF
2023 Supervised_Learning_Association_Rules
 
PDF
202312 Exploration Data Analysis Visualization (English version)
 
Supervised learning in decision tree algorithm
 
Unsupervised learning in data clustering
 
CNN_Image Classification for deep learning.pdf
 
Sequence Model with practicing hands on coding.pdf
 
Seq2seq Model introduction with practicing hands on coding.pdf
 
AIGEN introduction with practicing hands on coding.pdf
 
資料視覺化_Exploation_Data_Analysis_20241015.pdf
 
Operation_research_Linear_programming_20241015.pdf
 
Operation_research_Linear_programming_20241112.pdf
 
非監督是學習_Kmeans_process_visualization20241110.pdf
 
Sequence Model pytorch at colab with gpu.pdf
 
學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf
 
資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf
 
Pytorch cnn netowork introduction 20240318
 
2023 Decision Tree analysis in business practices
 
2023 Clustering analysis using Python from scratch
 
2023 Data visualization using Python from scratch
 
2023 Supervised Learning for Orange3 from scratch
 
2023 Supervised_Learning_Association_Rules
 
202312 Exploration Data Analysis Visualization (English version)
 

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Electronic commerce courselecture one. Pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
KodekX | Application Modernization Development
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
A Presentation on Artificial Intelligence
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Approach and Philosophy of On baking technology
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Encapsulation_ Review paper, used for researhc scholars
Electronic commerce courselecture one. Pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Mobile App Security Testing_ A Comprehensive Guide.pdf
KodekX | Application Modernization Development
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
A Presentation on Artificial Intelligence
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Advanced methodologies resolving dimensionality complications for autism neur...
The AUB Centre for AI in Media Proposal.docx
Approach and Philosophy of On baking technology
Digital-Transformation-Roadmap-for-Companies.pptx

model simulating

  • 2. About me • Education • NCU (MIS)、NCCU (CS) • Work Experience • Telecom big data Innovation • AI projects • Retail marketing technology • User Group • TW Spark User Group • TW Hadoop User Group • Taiwan Data Engineer Association Director • Research • Big Data/ ML/ AIOT/ AI Columnist 2 「How can you not get romantic about baseball ? 」
  • 3. Tutorial Content 3 Simulation vs. Machine Learning Monte Carlo Simulation Monte Carlo Simulation Application Homework
  • 4. Code • Download code • https://github.com/orozcohsu/ntunhs_2020/tree/master/alg_20210506 4
  • 5. Simulation vs. Machine Learning • Simulation and machine learning are related in that they both revolve around models, but they are very different. • In fact, simulation and machine learning are almost opposites. 5
  • 6. Simulation vs. Machine Learning • Simulation Characteristics • With simulation the model is often known (we know how to take input values, make a calculation, and determine the output). • Inputs are unknown. Inputs (at least some of them) are random variables and we don't know their values exactly. • Historical data is used to fit a probability distribution to the input or a probability distribution is constructed from expert estimates. • The goal is to find a range of outcomes by randomly sampling input values and calculating output repeatedly. 6
  • 8. Simulation vs. Machine Learning • Machine Learning Characteristics • In a machine learning problem the model is unknown initially. • We have no way of determining the output value based on input values. • If we have a set of data where inputs and the corresponding output are known, we can use supervised learning to train a machine learning model. • Supervised learning means we keep track of how well the machine learning model is predicting versus the known outputs. Each iteration of the learning process refines the model to improve prediction. 8
  • 9. Simulation vs. Machine Learning Before Training After Training 9
  • 10. Simulation vs. Machine Learning • Summary • In simulation, the main source of uncertainty is in the inputs. • We have to repeatedly simulate to get a range of possible outputs and make statements about outcome probabilities. • In machine learning, the main source of uncertainty is in the model. When making a prediction, the model is often not 100% certain of the prediction. Model Performance Evaluation 10
  • 11. Monte Carlo Simulation • Unlike a normal forecasting model, Monte Carlo Simulation predicts a set of outcomes based on an estimated range of values versus a set of fixed input values. • By leveraging a probability distribution, such as a uniform or normal distribution, for any variable that has inherent uncertainty. Then, recalculates the results over and over, each time using a different set of random numbers between the minimum and maximum values. • This exercise can be repeated thousands of times to produce a large number of likely outcomes. 11
  • 12. Monte Carlo Simulation • Monte Carlo Simulations are also utilized for long-term predictions due to their accuracy. As the number of inputs increase, the number of forecasts also grows, allowing you to project outcomes farther out in time with more accuracy. When a Monte Carlo Simulation is complete, it yields a range of possible outcomes with the probability of each result occurring. • One simple example of a Monte Carlo Simulation is to consider calculating the probability of rolling two standard dice. There are 36 combinations of dice rolls.Using a Monte Carlo Simulation, you can simulate rolling the dice 10,000 times (or more) to achieve more accurate predictions. 12
  • 13. Monte Carlo Simulation • Firstly define the target. • Let the computer shoot N darts blindfolded, and then remove the dart that hit the target, and then use the N you just shot out and the X that hit the target. • Estimate how big this target is. 13
  • 14. Monte Carlo Simulation • Assuming that our N=100 and the dart hits 78 rounds (X=78), we can estimate that the pi (π) is approximately: (78/100)*4 = 3.12. 14
  • 15. Monte Carlo Simulation • Monte Carlo simulation based on law of large numbers. • It is inherently a risk analysis tool since we assign probability distributions to all random variable model inputs. • The input variables are randomly sampled and the output is recorded. This is repeated thousands of times resulting in a histogram of output values and their frequency. • Its average value will be closer to the theoretical value. 15 https://en.wikipedia.org/wiki/Law_of_large_numbers Rolling 2 dice 1000 times
  • 16. Monte Carlo Simulation • As long as you have probability distribution, you can use Monte Carlo Simulation to sampling value. 16 monte_carlo_simpling_distribution.ipynb
  • 18. Monte Carlo Simulation Application • Production lines • Sales forecast • Reliability Analysis • Waiting Lines • Budget forecast • Project Management 18 • Cost estimation • Industrial process • Project selection • Acceptance sampling • Markov Chains (MCMC) • Imbalanced dataset • And more
  • 19. Monte Carlo Simulation Application • PMBOK (Project Management Body of Knowledge) • It is an important technique in risk management that many PMP and PMI- RMP exam study books. • It is a quantitative risk analysis technique used in identifying the risk level of achieving objectives. 19 https://www.pmi.org/pmbok-guide-standards https://pmstudycircle.com/2015/02/monte-carlo-simulation/
  • 20. Monte Carlo Simulation Application • Project Management – risk assessment • Blue bar is the probability of completion days, the 58th day is the most possible completion day (9%); probability of completion within 54 days is 22% or can’t completion probability is (100%-22%=78%) • Orange line (S curve) is the quantitative risk assessment of PMBOK, we use Monte Carlo simulation (normal distribution) 20 22% 9% simulation.xlsx Homework 1
  • 21. Monte Carlo Simulation Application • Imbalanced dataset • Most practical situations are lack of data, or data is difficult to generate. • We can generate false samples based on a certain method that has been determined. The method of generation is actually the basis of statistics, which is to generate random observations from a limited population. • If the process itself is random, or can be converted into a certain random number, we can simulate it through Monte Carlo, and then use these simulations. 21
  • 22. Monte Carlo Simulation Application • Sales commissions prediction next year 22 Commission Amount = Actual Sales * Commission Rate
  • 23. Monte Carlo Simulation Application • Assume everyone makes 100% of their target and earn 4% commission rate • Or 23 Budget forecast!!
  • 24. Monte Carlo Simulation Application 24 • A Monte Carlo simulation is a useful tool for predicting future results by calculating a formula multiple times with different random inputs. • Using numpy and pandas to build a model and generate multiple potential results and analyze them is relatively straightforward. • The other added benefit is that analysts can run many scenarios by changing the inputs and can move on to much more sophisticated models in the future if the needs arise. monde_carlo_simulation_with_commission_prediction.ipynb Homework 2
  • 25. Homework • Please fill-in the value of table for your investigation of simulation. • Some simple input changes you can make to see how the results change: • Increase top commission rate to 5% (original is 4%) • Decrease the number of sales people (change num_reps=500) • Change the expected standard deviation to a higher amount (change std_dev=.1) • Modify the distribution of targets (change distribution from normal to others) 25