SlideShare a Scribd company logo
1 of 25
Download to read offline
國立臺北護理健康大學 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

What's hot

Monte carlo integration, importance sampling, basic idea of markov chain mont...
Monte carlo integration, importance sampling, basic idea of markov chain mont...Monte carlo integration, importance sampling, basic idea of markov chain mont...
Monte carlo integration, importance sampling, basic idea of markov chain mont...BIZIMANA Appolinaire
 
Monte Carlo Simulation - Paul wilmott
Monte Carlo Simulation - Paul wilmottMonte Carlo Simulation - Paul wilmott
Monte Carlo Simulation - Paul wilmottAguinaldo Flor
 
Probability and random processes project based learning template.pdf
Probability and random processes project based learning template.pdfProbability and random processes project based learning template.pdf
Probability and random processes project based learning template.pdfVedant Srivastava
 
Monte carlo simulation
Monte carlo simulationMonte carlo simulation
Monte carlo simulationAnurag Jaiswal
 
Monte carlo simulation
Monte carlo simulationMonte carlo simulation
Monte carlo simulationMissAnam
 
Operational Research
Operational ResearchOperational Research
Operational ResearchRoy Thomas
 
Monte Carlo Simulation
Monte Carlo SimulationMonte Carlo Simulation
Monte Carlo SimulationDeepti Singh
 
An introduction to machine learning and statistics
An introduction to machine learning and statisticsAn introduction to machine learning and statistics
An introduction to machine learning and statisticsSpotle.ai
 
Monte carlo presentation for analysis of business growth
Monte carlo presentation for analysis of business growthMonte carlo presentation for analysis of business growth
Monte carlo presentation for analysis of business growthAsif Anik
 
Unit2 montecarlosimulation
Unit2 montecarlosimulationUnit2 montecarlosimulation
Unit2 montecarlosimulationDevaKumari Vijay
 
Midsquare method- simulation system
Midsquare method- simulation systemMidsquare method- simulation system
Midsquare method- simulation systemArman Hossain
 
Machine learning algorithms
Machine learning algorithmsMachine learning algorithms
Machine learning algorithmsShalitha Suranga
 
Pseudorandom number generators powerpoint
Pseudorandom number generators powerpointPseudorandom number generators powerpoint
Pseudorandom number generators powerpointDavid Roodman
 
Machine learning: Stock Price Prediction
Machine learning: Stock Price PredictionMachine learning: Stock Price Prediction
Machine learning: Stock Price Predictioneurosigdoc acm
 
Factorial of a number in python
Factorial of a number in pythonFactorial of a number in python
Factorial of a number in pythonvarshachhajera
 
Machine Learning Project - 1994 U.S. Census
Machine Learning Project - 1994 U.S. CensusMachine Learning Project - 1994 U.S. Census
Machine Learning Project - 1994 U.S. CensusTim Enalls
 
Modelling and evaluation
Modelling and evaluationModelling and evaluation
Modelling and evaluationeShikshak
 
L2. Evaluating Machine Learning Algorithms I
L2. Evaluating Machine Learning Algorithms IL2. Evaluating Machine Learning Algorithms I
L2. Evaluating Machine Learning Algorithms IMachine Learning Valencia
 

What's hot (20)

Monte carlo integration, importance sampling, basic idea of markov chain mont...
Monte carlo integration, importance sampling, basic idea of markov chain mont...Monte carlo integration, importance sampling, basic idea of markov chain mont...
Monte carlo integration, importance sampling, basic idea of markov chain mont...
 
Monte Carlo Simulation - Paul wilmott
Monte Carlo Simulation - Paul wilmottMonte Carlo Simulation - Paul wilmott
Monte Carlo Simulation - Paul wilmott
 
Probability and random processes project based learning template.pdf
Probability and random processes project based learning template.pdfProbability and random processes project based learning template.pdf
Probability and random processes project based learning template.pdf
 
Monte carlo simulation
Monte carlo simulationMonte carlo simulation
Monte carlo simulation
 
Monte carlo simulation
Monte carlo simulationMonte carlo simulation
Monte carlo simulation
 
Operational Research
Operational ResearchOperational Research
Operational Research
 
Monte Carlo and Markov Chain
Monte Carlo and Markov ChainMonte Carlo and Markov Chain
Monte Carlo and Markov Chain
 
Monte Carlo Simulation
Monte Carlo SimulationMonte Carlo Simulation
Monte Carlo Simulation
 
An introduction to machine learning and statistics
An introduction to machine learning and statisticsAn introduction to machine learning and statistics
An introduction to machine learning and statistics
 
Monte carlo presentation for analysis of business growth
Monte carlo presentation for analysis of business growthMonte carlo presentation for analysis of business growth
Monte carlo presentation for analysis of business growth
 
Anomaly detection
Anomaly detectionAnomaly detection
Anomaly detection
 
Unit2 montecarlosimulation
Unit2 montecarlosimulationUnit2 montecarlosimulation
Unit2 montecarlosimulation
 
Midsquare method- simulation system
Midsquare method- simulation systemMidsquare method- simulation system
Midsquare method- simulation system
 
Machine learning algorithms
Machine learning algorithmsMachine learning algorithms
Machine learning algorithms
 
Pseudorandom number generators powerpoint
Pseudorandom number generators powerpointPseudorandom number generators powerpoint
Pseudorandom number generators powerpoint
 
Machine learning: Stock Price Prediction
Machine learning: Stock Price PredictionMachine learning: Stock Price Prediction
Machine learning: Stock Price Prediction
 
Factorial of a number in python
Factorial of a number in pythonFactorial of a number in python
Factorial of a number in python
 
Machine Learning Project - 1994 U.S. Census
Machine Learning Project - 1994 U.S. CensusMachine Learning Project - 1994 U.S. Census
Machine Learning Project - 1994 U.S. Census
 
Modelling and evaluation
Modelling and evaluationModelling and evaluation
Modelling and evaluation
 
L2. Evaluating Machine Learning Algorithms I
L2. Evaluating Machine Learning Algorithms IL2. Evaluating Machine Learning Algorithms I
L2. Evaluating Machine Learning Algorithms I
 

Similar to model simulating

Modelling with simulation
Modelling with simulation Modelling with simulation
Modelling with simulation Jessica Aldea
 
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)Ivan Corneillet
 
Estimating default risk in fund structures
Estimating default risk in fund structuresEstimating default risk in fund structures
Estimating default risk in fund structuresIFMR
 
Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...
Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...
Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...Alok Singh
 
MIS637_Final_Project_Rahul_Bhatia
MIS637_Final_Project_Rahul_BhatiaMIS637_Final_Project_Rahul_Bhatia
MIS637_Final_Project_Rahul_BhatiaRahul Bhatia
 
Applications of Machine Learning in High Frequency Trading
Applications of Machine Learning in High Frequency TradingApplications of Machine Learning in High Frequency Trading
Applications of Machine Learning in High Frequency TradingAyan Sengupta
 
Discrete event simulation
Discrete event simulationDiscrete event simulation
Discrete event simulationssusera970cc
 
An Introduction to Simulation in the Social Sciences
An Introduction to Simulation in the Social SciencesAn Introduction to Simulation in the Social Sciences
An Introduction to Simulation in the Social Sciencesfsmart01
 
Robust Design And Variation Reduction Using DiscoverSim
Robust Design And Variation Reduction Using DiscoverSimRobust Design And Variation Reduction Using DiscoverSim
Robust Design And Variation Reduction Using DiscoverSimJohnNoguera
 
Machine-Learning-Overview a statistical approach
Machine-Learning-Overview a statistical approachMachine-Learning-Overview a statistical approach
Machine-Learning-Overview a statistical approachAjit Ghodke
 
MONTE CARLO SimulationChapter 14 PowerPointManagement
 MONTE CARLO SimulationChapter 14 PowerPointManagement MONTE CARLO SimulationChapter 14 PowerPointManagement
MONTE CARLO SimulationChapter 14 PowerPointManagementTatianaMajor22
 
Applications of simulation in Business with Example
Applications of simulation in Business with ExampleApplications of simulation in Business with Example
Applications of simulation in Business with ExamplePratima Ray
 
Monte Carlo Simulation lecture.pdf
Monte Carlo Simulation lecture.pdfMonte Carlo Simulation lecture.pdf
Monte Carlo Simulation lecture.pdfWellingtonIsraelQuim
 
Verification challenges and methodologies - SoC and ASICs
Verification challenges and methodologies - SoC and ASICsVerification challenges and methodologies - SoC and ASICs
Verification challenges and methodologies - SoC and ASICsDr. Shivananda Koteshwar
 
Stop Flying Blind! Quantifying Risk with Monte Carlo Simulation
Stop Flying Blind! Quantifying Risk with Monte Carlo SimulationStop Flying Blind! Quantifying Risk with Monte Carlo Simulation
Stop Flying Blind! Quantifying Risk with Monte Carlo SimulationSam McAfee
 
credit card fraud detection
credit card fraud detectioncredit card fraud detection
credit card fraud detectionjagan477830
 
QBA Simulation and Inventory.pptx
QBA Simulation and Inventory.pptxQBA Simulation and Inventory.pptx
QBA Simulation and Inventory.pptxArthurRanola
 

Similar to model simulating (20)

Modelling with simulation
Modelling with simulation Modelling with simulation
Modelling with simulation
 
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)
 
Estimating default risk in fund structures
Estimating default risk in fund structuresEstimating default risk in fund structures
Estimating default risk in fund structures
 
Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...
Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...
Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...
 
MIS637_Final_Project_Rahul_Bhatia
MIS637_Final_Project_Rahul_BhatiaMIS637_Final_Project_Rahul_Bhatia
MIS637_Final_Project_Rahul_Bhatia
 
Applications of Machine Learning in High Frequency Trading
Applications of Machine Learning in High Frequency TradingApplications of Machine Learning in High Frequency Trading
Applications of Machine Learning in High Frequency Trading
 
Discrete event simulation
Discrete event simulationDiscrete event simulation
Discrete event simulation
 
An Introduction to Simulation in the Social Sciences
An Introduction to Simulation in the Social SciencesAn Introduction to Simulation in the Social Sciences
An Introduction to Simulation in the Social Sciences
 
Robust Design And Variation Reduction Using DiscoverSim
Robust Design And Variation Reduction Using DiscoverSimRobust Design And Variation Reduction Using DiscoverSim
Robust Design And Variation Reduction Using DiscoverSim
 
When Should I Use Simulation?
When Should I Use Simulation?When Should I Use Simulation?
When Should I Use Simulation?
 
Ml ppt at
Ml ppt atMl ppt at
Ml ppt at
 
Machine-Learning-Overview a statistical approach
Machine-Learning-Overview a statistical approachMachine-Learning-Overview a statistical approach
Machine-Learning-Overview a statistical approach
 
MONTE CARLO SimulationChapter 14 PowerPointManagement
 MONTE CARLO SimulationChapter 14 PowerPointManagement MONTE CARLO SimulationChapter 14 PowerPointManagement
MONTE CARLO SimulationChapter 14 PowerPointManagement
 
Applications of simulation in Business with Example
Applications of simulation in Business with ExampleApplications of simulation in Business with Example
Applications of simulation in Business with Example
 
Monte Carlo Simulation lecture.pdf
Monte Carlo Simulation lecture.pdfMonte Carlo Simulation lecture.pdf
Monte Carlo Simulation lecture.pdf
 
Verification challenges and methodologies - SoC and ASICs
Verification challenges and methodologies - SoC and ASICsVerification challenges and methodologies - SoC and ASICs
Verification challenges and methodologies - SoC and ASICs
 
Stop Flying Blind! Quantifying Risk with Monte Carlo Simulation
Stop Flying Blind! Quantifying Risk with Monte Carlo SimulationStop Flying Blind! Quantifying Risk with Monte Carlo Simulation
Stop Flying Blind! Quantifying Risk with Monte Carlo Simulation
 
credit card fraud detection
credit card fraud detectioncredit card fraud detection
credit card fraud detection
 
QBA Simulation and Inventory.pptx
QBA Simulation and Inventory.pptxQBA Simulation and Inventory.pptx
QBA Simulation and Inventory.pptx
 
cs1538.ppt
cs1538.pptcs1538.ppt
cs1538.ppt
 

More from FEG

Pytorch cnn netowork introduction 20240318
Pytorch cnn netowork introduction 20240318Pytorch cnn netowork introduction 20240318
Pytorch cnn netowork introduction 20240318FEG
 
2023 Decision Tree analysis in business practices
2023 Decision Tree analysis in business practices2023 Decision Tree analysis in business practices
2023 Decision Tree analysis in business practicesFEG
 
2023 Clustering analysis using Python from scratch
2023 Clustering analysis using Python from scratch2023 Clustering analysis using Python from scratch
2023 Clustering analysis using Python from scratchFEG
 
2023 Data visualization using Python from scratch
2023 Data visualization using Python from scratch2023 Data visualization using Python from scratch
2023 Data visualization using Python from scratchFEG
 
2023 Supervised Learning for Orange3 from scratch
2023 Supervised Learning for Orange3 from scratch2023 Supervised Learning for Orange3 from scratch
2023 Supervised Learning for Orange3 from scratchFEG
 
2023 Supervised_Learning_Association_Rules
2023 Supervised_Learning_Association_Rules2023 Supervised_Learning_Association_Rules
2023 Supervised_Learning_Association_RulesFEG
 
202312 Exploration Data Analysis Visualization (English version)
202312 Exploration Data Analysis Visualization (English version)202312 Exploration Data Analysis Visualization (English version)
202312 Exploration Data Analysis Visualization (English version)FEG
 
202312 Exploration of Data Analysis Visualization
202312 Exploration of Data Analysis Visualization202312 Exploration of Data Analysis Visualization
202312 Exploration of Data Analysis VisualizationFEG
 
Transfer Learning (20230516)
Transfer Learning (20230516)Transfer Learning (20230516)
Transfer Learning (20230516)FEG
 
Image Classification (20230411)
Image Classification (20230411)Image Classification (20230411)
Image Classification (20230411)FEG
 
Google CoLab (20230321)
Google CoLab (20230321)Google CoLab (20230321)
Google CoLab (20230321)FEG
 
Supervised Learning
Supervised LearningSupervised Learning
Supervised LearningFEG
 
UnSupervised Learning Clustering
UnSupervised Learning ClusteringUnSupervised Learning Clustering
UnSupervised Learning ClusteringFEG
 
Data Visualization in Excel
Data Visualization in ExcelData Visualization in Excel
Data Visualization in ExcelFEG
 
6_Association_rule_碩士班第六次.pdf
6_Association_rule_碩士班第六次.pdf6_Association_rule_碩士班第六次.pdf
6_Association_rule_碩士班第六次.pdfFEG
 
5_Neural_network_碩士班第五次.pdf
5_Neural_network_碩士班第五次.pdf5_Neural_network_碩士班第五次.pdf
5_Neural_network_碩士班第五次.pdfFEG
 
4_Regression_analysis.pdf
4_Regression_analysis.pdf4_Regression_analysis.pdf
4_Regression_analysis.pdfFEG
 
3_Decision_tree.pdf
3_Decision_tree.pdf3_Decision_tree.pdf
3_Decision_tree.pdfFEG
 
2_Clustering.pdf
2_Clustering.pdf2_Clustering.pdf
2_Clustering.pdfFEG
 
1_大二班_資料視覺化_20221028.pdf
1_大二班_資料視覺化_20221028.pdf1_大二班_資料視覺化_20221028.pdf
1_大二班_資料視覺化_20221028.pdfFEG
 

More from FEG (20)

Pytorch cnn netowork introduction 20240318
Pytorch cnn netowork introduction 20240318Pytorch cnn netowork introduction 20240318
Pytorch cnn netowork introduction 20240318
 
2023 Decision Tree analysis in business practices
2023 Decision Tree analysis in business practices2023 Decision Tree analysis in business practices
2023 Decision Tree analysis in business practices
 
2023 Clustering analysis using Python from scratch
2023 Clustering analysis using Python from scratch2023 Clustering analysis using Python from scratch
2023 Clustering analysis using Python from scratch
 
2023 Data visualization using Python from scratch
2023 Data visualization using Python from scratch2023 Data visualization using Python from scratch
2023 Data visualization using Python from scratch
 
2023 Supervised Learning for Orange3 from scratch
2023 Supervised Learning for Orange3 from scratch2023 Supervised Learning for Orange3 from scratch
2023 Supervised Learning for Orange3 from scratch
 
2023 Supervised_Learning_Association_Rules
2023 Supervised_Learning_Association_Rules2023 Supervised_Learning_Association_Rules
2023 Supervised_Learning_Association_Rules
 
202312 Exploration Data Analysis Visualization (English version)
202312 Exploration Data Analysis Visualization (English version)202312 Exploration Data Analysis Visualization (English version)
202312 Exploration Data Analysis Visualization (English version)
 
202312 Exploration of Data Analysis Visualization
202312 Exploration of Data Analysis Visualization202312 Exploration of Data Analysis Visualization
202312 Exploration of Data Analysis Visualization
 
Transfer Learning (20230516)
Transfer Learning (20230516)Transfer Learning (20230516)
Transfer Learning (20230516)
 
Image Classification (20230411)
Image Classification (20230411)Image Classification (20230411)
Image Classification (20230411)
 
Google CoLab (20230321)
Google CoLab (20230321)Google CoLab (20230321)
Google CoLab (20230321)
 
Supervised Learning
Supervised LearningSupervised Learning
Supervised Learning
 
UnSupervised Learning Clustering
UnSupervised Learning ClusteringUnSupervised Learning Clustering
UnSupervised Learning Clustering
 
Data Visualization in Excel
Data Visualization in ExcelData Visualization in Excel
Data Visualization in Excel
 
6_Association_rule_碩士班第六次.pdf
6_Association_rule_碩士班第六次.pdf6_Association_rule_碩士班第六次.pdf
6_Association_rule_碩士班第六次.pdf
 
5_Neural_network_碩士班第五次.pdf
5_Neural_network_碩士班第五次.pdf5_Neural_network_碩士班第五次.pdf
5_Neural_network_碩士班第五次.pdf
 
4_Regression_analysis.pdf
4_Regression_analysis.pdf4_Regression_analysis.pdf
4_Regression_analysis.pdf
 
3_Decision_tree.pdf
3_Decision_tree.pdf3_Decision_tree.pdf
3_Decision_tree.pdf
 
2_Clustering.pdf
2_Clustering.pdf2_Clustering.pdf
2_Clustering.pdf
 
1_大二班_資料視覺化_20221028.pdf
1_大二班_資料視覺化_20221028.pdf1_大二班_資料視覺化_20221028.pdf
1_大二班_資料視覺化_20221028.pdf
 

Recently uploaded

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 

Recently uploaded (20)

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 

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