SlideShare a Scribd company logo
Programming for Data
Analysis
Week 11
Dr. Ferdin Joe John Joseph
Faculty of Information Technology
Thai – Nichi Institute of Technology, Bangkok
Today’s lesson
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
2
• Binary Classification
• Naïve Bayes Classifier
• Support Vector Machine
Naïve Bayes Classifier
• Conditional Probability Model of Classification
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
3
Conditional Probability Model of Classification
• The conditional probability can be calculated using the joint
probability, although it would be intractable.
• Bayes Theorem provides a principled way for calculating the
conditional probability.
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
4
Bayes Theorem
• P(A|B) = P(B|A) * P(A) / P(B)
• We can frame classification as a conditional classification problem
with Bayes Theorem as follows:
P(yi | x1, x2, …, xn) = P(x1, x2, …, xn | yi) * P(yi) / P(x1, x2, …, xn)
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
5
Naïve Bayes
• For simplifying the calculation
• The Bayes Theorem assumes that each input variable is dependent
upon all other variables.
• This is a cause of complexity in the calculation.
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
6
Calculation of Prior and Conditional
Probabilities
• P(yi) = examples with yi / total examples
• In the case of categorical variables, such as counts or labels, a
multinomial distribution can be used.
• If the variables are binary, such as yes/no or true/false, a binomial
distribution can be used.
• If a variable is numerical, such as a measurement, often a Gaussian
distribution is used.
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
7
Naïve Bayes Distribution
• Binomial Naïve Bayes: Naïve Bayes that uses a binomial distribution.
• Multinomial Naïve Bayes: Naïve Bayes that uses a multinomial
distribution.
• Gaussian Naïve Bayes: Naïve Bayes that uses a Gaussian distribution.
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
8
Preparation of dataset
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
9
Fitting Probability Distribution
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
10
Sorting Data
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
11
Calculate Priors
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
12
Fit Distribution
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
13
Summary
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
14
Independent Conditional Probability
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
15
Taking a sample
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
16
Probability Scores
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
17
Wrap Up
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
18
Gaussian Naïve Bayes
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
19
Lab Exercise
• Use this source code and make a classification report which gives
accuracy, precision, recall and F1-score
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
20
Support Vector Machine
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
21
SVM Objective
• A training set, S, for an SVM is comprised of m samples.
• The features, x, consist of real numbers and the classifications, y,
must be -1 or 1.
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
22
SVM Hyperplane
• The SVM hyperlane is defined by the weight vector, w, and the bias, b,
and is defined as:
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
23
Example for 2 Feature
• Hyperplane for two features can be written as:
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
24
Libraries
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
25
Data Clusters
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
26
Data Clusters
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
27
Prepare Datasets
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
28
Learning Rate
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
29
Learning Rate
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
30
Draw Decision Boundary
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
31
Plot Data
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
32
Plot Data
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
33
Test Classifier
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
34
Test Classifier
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
35
Output
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
36
Lab Exercise
• Create Confusion Matrix and classification report for SVM
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
37
DSA 207 – Binary Classifier
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
38
Ad

More Related Content

Similar to Week 11: Programming for Data Analysis (20)

Week 1: Programming for Data Analysis
Week 1: Programming for Data AnalysisWeek 1: Programming for Data Analysis
Week 1: Programming for Data Analysis
Ferdin Joe John Joseph PhD
 
Data Wrangling Week 4
Data Wrangling Week 4Data Wrangling Week 4
Data Wrangling Week 4
Ferdin Joe John Joseph PhD
 
Data wrangling week3
Data wrangling week3Data wrangling week3
Data wrangling week3
Ferdin Joe John Joseph PhD
 
Week2: Programming for Data Analysis
Week2: Programming for Data AnalysisWeek2: Programming for Data Analysis
Week2: Programming for Data Analysis
Ferdin Joe John Joseph PhD
 
Data Wrangling Week 7
Data Wrangling Week 7Data Wrangling Week 7
Data Wrangling Week 7
Ferdin Joe John Joseph PhD
 
Unit 5 Quantization
Unit 5 QuantizationUnit 5 Quantization
Unit 5 Quantization
Dr Piyush Charan
 
Prototype System for Recommending Academic Subjects for Students' Self Design...
Prototype System for Recommending Academic Subjects for Students' Self Design...Prototype System for Recommending Academic Subjects for Students' Self Design...
Prototype System for Recommending Academic Subjects for Students' Self Design...
siramatu-lab
 
Data wrangling week 5
Data wrangling week 5Data wrangling week 5
Data wrangling week 5
Ferdin Joe John Joseph PhD
 
Deep Learning and CNN Architectures
Deep Learning and CNN ArchitecturesDeep Learning and CNN Architectures
Deep Learning and CNN Architectures
Ferdin Joe John Joseph PhD
 
2019 DSA 105 Introduction to Data Science Week 3
2019 DSA 105 Introduction to Data Science Week 32019 DSA 105 Introduction to Data Science Week 3
2019 DSA 105 Introduction to Data Science Week 3
Ferdin Joe John Joseph PhD
 
IRJET- Stabilization of Black Cotton Soil using Rice Husk Ash and Lime
IRJET- Stabilization of Black Cotton Soil using Rice Husk Ash and LimeIRJET- Stabilization of Black Cotton Soil using Rice Husk Ash and Lime
IRJET- Stabilization of Black Cotton Soil using Rice Husk Ash and Lime
IRJET Journal
 
IRJET- Student Placement Prediction using Machine Learning
IRJET- Student Placement Prediction using Machine LearningIRJET- Student Placement Prediction using Machine Learning
IRJET- Student Placement Prediction using Machine Learning
IRJET Journal
 
Smart SE: Recurrent Education Program of IoT and AI for Business
Smart SE: Recurrent Education Program of IoT and AI for BusinessSmart SE: Recurrent Education Program of IoT and AI for Business
Smart SE: Recurrent Education Program of IoT and AI for Business
Hironori Washizaki
 
Data wrangling week 6
Data wrangling week 6Data wrangling week 6
Data wrangling week 6
Ferdin Joe John Joseph PhD
 
Application of a Novel Subject Classification Scheme for a Bibliographic Data...
Application of a Novel Subject Classification Scheme for a Bibliographic Data...Application of a Novel Subject Classification Scheme for a Bibliographic Data...
Application of a Novel Subject Classification Scheme for a Bibliographic Data...
National Institute of Informatics
 
DETECTION OF PHISHING WEBSITE FROM URL'S BY USING CLASSIFICATION TECHNIQUES p...
DETECTION OF PHISHING WEBSITE FROM
URL'S BY USING CLASSIFICATION
TECHNIQUES p...DETECTION OF PHISHING WEBSITE FROM
URL'S BY USING CLASSIFICATION
TECHNIQUES p...
DETECTION OF PHISHING WEBSITE FROM URL'S BY USING CLASSIFICATION TECHNIQUES p...
PavanSomisetty1
 
Educational Data Mining to Analyze Students Performance – Concept Plan
Educational Data Mining to Analyze Students Performance – Concept PlanEducational Data Mining to Analyze Students Performance – Concept Plan
Educational Data Mining to Analyze Students Performance – Concept Plan
IRJET Journal
 
cache teaching analogy dataa naylatics Download PDF(Updated Curriculum in Bo...
cache teaching  analogy dataa naylatics Download PDF(Updated Curriculum in Bo...cache teaching  analogy dataa naylatics Download PDF(Updated Curriculum in Bo...
cache teaching analogy dataa naylatics Download PDF(Updated Curriculum in Bo...
Mayurkumarpatil1
 
IRJET- Big Data and Bayes Theorem used Analyze the Student’s Performance in E...
IRJET- Big Data and Bayes Theorem used Analyze the Student’s Performance in E...IRJET- Big Data and Bayes Theorem used Analyze the Student’s Performance in E...
IRJET- Big Data and Bayes Theorem used Analyze the Student’s Performance in E...
IRJET Journal
 
Intelligent Career Guidance System.pptx
Intelligent Career Guidance System.pptxIntelligent Career Guidance System.pptx
Intelligent Career Guidance System.pptx
Anonymous366406
 
Prototype System for Recommending Academic Subjects for Students' Self Design...
Prototype System for Recommending Academic Subjects for Students' Self Design...Prototype System for Recommending Academic Subjects for Students' Self Design...
Prototype System for Recommending Academic Subjects for Students' Self Design...
siramatu-lab
 
2019 DSA 105 Introduction to Data Science Week 3
2019 DSA 105 Introduction to Data Science Week 32019 DSA 105 Introduction to Data Science Week 3
2019 DSA 105 Introduction to Data Science Week 3
Ferdin Joe John Joseph PhD
 
IRJET- Stabilization of Black Cotton Soil using Rice Husk Ash and Lime
IRJET- Stabilization of Black Cotton Soil using Rice Husk Ash and LimeIRJET- Stabilization of Black Cotton Soil using Rice Husk Ash and Lime
IRJET- Stabilization of Black Cotton Soil using Rice Husk Ash and Lime
IRJET Journal
 
IRJET- Student Placement Prediction using Machine Learning
IRJET- Student Placement Prediction using Machine LearningIRJET- Student Placement Prediction using Machine Learning
IRJET- Student Placement Prediction using Machine Learning
IRJET Journal
 
Smart SE: Recurrent Education Program of IoT and AI for Business
Smart SE: Recurrent Education Program of IoT and AI for BusinessSmart SE: Recurrent Education Program of IoT and AI for Business
Smart SE: Recurrent Education Program of IoT and AI for Business
Hironori Washizaki
 
Application of a Novel Subject Classification Scheme for a Bibliographic Data...
Application of a Novel Subject Classification Scheme for a Bibliographic Data...Application of a Novel Subject Classification Scheme for a Bibliographic Data...
Application of a Novel Subject Classification Scheme for a Bibliographic Data...
National Institute of Informatics
 
DETECTION OF PHISHING WEBSITE FROM URL'S BY USING CLASSIFICATION TECHNIQUES p...
DETECTION OF PHISHING WEBSITE FROM
URL'S BY USING CLASSIFICATION
TECHNIQUES p...DETECTION OF PHISHING WEBSITE FROM
URL'S BY USING CLASSIFICATION
TECHNIQUES p...
DETECTION OF PHISHING WEBSITE FROM URL'S BY USING CLASSIFICATION TECHNIQUES p...
PavanSomisetty1
 
Educational Data Mining to Analyze Students Performance – Concept Plan
Educational Data Mining to Analyze Students Performance – Concept PlanEducational Data Mining to Analyze Students Performance – Concept Plan
Educational Data Mining to Analyze Students Performance – Concept Plan
IRJET Journal
 
cache teaching analogy dataa naylatics Download PDF(Updated Curriculum in Bo...
cache teaching  analogy dataa naylatics Download PDF(Updated Curriculum in Bo...cache teaching  analogy dataa naylatics Download PDF(Updated Curriculum in Bo...
cache teaching analogy dataa naylatics Download PDF(Updated Curriculum in Bo...
Mayurkumarpatil1
 
IRJET- Big Data and Bayes Theorem used Analyze the Student’s Performance in E...
IRJET- Big Data and Bayes Theorem used Analyze the Student’s Performance in E...IRJET- Big Data and Bayes Theorem used Analyze the Student’s Performance in E...
IRJET- Big Data and Bayes Theorem used Analyze the Student’s Performance in E...
IRJET Journal
 
Intelligent Career Guidance System.pptx
Intelligent Career Guidance System.pptxIntelligent Career Guidance System.pptx
Intelligent Career Guidance System.pptx
Anonymous366406
 

More from Ferdin Joe John Joseph PhD (20)

Invited Talk DGTiCon 2022
Invited Talk DGTiCon 2022Invited Talk DGTiCon 2022
Invited Talk DGTiCon 2022
Ferdin Joe John Joseph PhD
 
Week 12: Cloud AI- DSA 441 Cloud Computing
Week 12: Cloud AI- DSA 441 Cloud ComputingWeek 12: Cloud AI- DSA 441 Cloud Computing
Week 12: Cloud AI- DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 11: Cloud Native- DSA 441 Cloud Computing
Week 11: Cloud Native- DSA 441 Cloud ComputingWeek 11: Cloud Native- DSA 441 Cloud Computing
Week 11: Cloud Native- DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 10: Cloud Security- DSA 441 Cloud Computing
Week 10: Cloud Security- DSA 441 Cloud ComputingWeek 10: Cloud Security- DSA 441 Cloud Computing
Week 10: Cloud Security- DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud ComputingWeek 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud ComputingWeek 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
Ferdin Joe John Joseph PhD
 
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
Ferdin Joe John Joseph PhD
 
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud ComputingWeek 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
Ferdin Joe John Joseph PhD
 
Week 2: Virtualization and VM Ware - DSA 441 Cloud Computing
Week 2: Virtualization and VM Ware - DSA 441 Cloud ComputingWeek 2: Virtualization and VM Ware - DSA 441 Cloud Computing
Week 2: Virtualization and VM Ware - DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
Week 1: Introduction to Cloud Computing - DSA 441 Cloud ComputingWeek 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
Week 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculum
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculumSept 6 2021 BTech Artificial Intelligence and Data Science curriculum
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculum
Ferdin Joe John Joseph PhD
 
Hadoop in Alibaba Cloud
Hadoop in Alibaba CloudHadoop in Alibaba Cloud
Hadoop in Alibaba Cloud
Ferdin Joe John Joseph PhD
 
Cloud Computing Essentials in Alibaba Cloud
Cloud Computing Essentials in Alibaba CloudCloud Computing Essentials in Alibaba Cloud
Cloud Computing Essentials in Alibaba Cloud
Ferdin Joe John Joseph PhD
 
Transforming deep into transformers – a computer vision approach
Transforming deep into transformers – a computer vision approachTransforming deep into transformers – a computer vision approach
Transforming deep into transformers – a computer vision approach
Ferdin Joe John Joseph PhD
 
Deep learning - Introduction
Deep learning - IntroductionDeep learning - Introduction
Deep learning - Introduction
Ferdin Joe John Joseph PhD
 
Data wrangling week 10
Data wrangling week 10Data wrangling week 10
Data wrangling week 10
Ferdin Joe John Joseph PhD
 
Data wrangling week 11
Data wrangling week 11Data wrangling week 11
Data wrangling week 11
Ferdin Joe John Joseph PhD
 
Data wrangling week 9
Data wrangling week 9Data wrangling week 9
Data wrangling week 9
Ferdin Joe John Joseph PhD
 
Week 11: Cloud Native- DSA 441 Cloud Computing
Week 11: Cloud Native- DSA 441 Cloud ComputingWeek 11: Cloud Native- DSA 441 Cloud Computing
Week 11: Cloud Native- DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 10: Cloud Security- DSA 441 Cloud Computing
Week 10: Cloud Security- DSA 441 Cloud ComputingWeek 10: Cloud Security- DSA 441 Cloud Computing
Week 10: Cloud Security- DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud ComputingWeek 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud ComputingWeek 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
Ferdin Joe John Joseph PhD
 
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
Ferdin Joe John Joseph PhD
 
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud ComputingWeek 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
Ferdin Joe John Joseph PhD
 
Week 2: Virtualization and VM Ware - DSA 441 Cloud Computing
Week 2: Virtualization and VM Ware - DSA 441 Cloud ComputingWeek 2: Virtualization and VM Ware - DSA 441 Cloud Computing
Week 2: Virtualization and VM Ware - DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
Week 1: Introduction to Cloud Computing - DSA 441 Cloud ComputingWeek 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
Week 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculum
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculumSept 6 2021 BTech Artificial Intelligence and Data Science curriculum
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculum
Ferdin Joe John Joseph PhD
 
Transforming deep into transformers – a computer vision approach
Transforming deep into transformers – a computer vision approachTransforming deep into transformers – a computer vision approach
Transforming deep into transformers – a computer vision approach
Ferdin Joe John Joseph PhD
 
Ad

Recently uploaded (20)

新西兰文凭奥克兰理工大学毕业证书AUT成绩单补办
新西兰文凭奥克兰理工大学毕业证书AUT成绩单补办新西兰文凭奥克兰理工大学毕业证书AUT成绩单补办
新西兰文凭奥克兰理工大学毕业证书AUT成绩单补办
Taqyea
 
Deloitte Analytics - Applying Process Mining in an audit context
Deloitte Analytics - Applying Process Mining in an audit contextDeloitte Analytics - Applying Process Mining in an audit context
Deloitte Analytics - Applying Process Mining in an audit context
Process mining Evangelist
 
Impact_of_AI_on_Everyday_Life and info.pptx
Impact_of_AI_on_Everyday_Life and info.pptxImpact_of_AI_on_Everyday_Life and info.pptx
Impact_of_AI_on_Everyday_Life and info.pptx
swatibhusari5
 
indonesia-gen-z-report-2024 Gen Z (born between 1997 and 2012) is currently t...
indonesia-gen-z-report-2024 Gen Z (born between 1997 and 2012) is currently t...indonesia-gen-z-report-2024 Gen Z (born between 1997 and 2012) is currently t...
indonesia-gen-z-report-2024 Gen Z (born between 1997 and 2012) is currently t...
disnakertransjabarda
 
Principles of information security Chapter 5.ppt
Principles of information security Chapter 5.pptPrinciples of information security Chapter 5.ppt
Principles of information security Chapter 5.ppt
EstherBaguma
 
文凭证书美国SDSU文凭圣地亚哥州立大学学生证学历认证查询
文凭证书美国SDSU文凭圣地亚哥州立大学学生证学历认证查询文凭证书美国SDSU文凭圣地亚哥州立大学学生证学历认证查询
文凭证书美国SDSU文凭圣地亚哥州立大学学生证学历认证查询
Taqyea
 
chapter3 Central Tendency statistics.ppt
chapter3 Central Tendency statistics.pptchapter3 Central Tendency statistics.ppt
chapter3 Central Tendency statistics.ppt
justinebandajbn
 
录取通知书加拿大TMU毕业证多伦多都会大学电子版毕业证成绩单
录取通知书加拿大TMU毕业证多伦多都会大学电子版毕业证成绩单录取通知书加拿大TMU毕业证多伦多都会大学电子版毕业证成绩单
录取通知书加拿大TMU毕业证多伦多都会大学电子版毕业证成绩单
Taqyea
 
03 Daniel 2-notes.ppt seminario escatologia
03 Daniel 2-notes.ppt seminario escatologia03 Daniel 2-notes.ppt seminario escatologia
03 Daniel 2-notes.ppt seminario escatologia
Alexander Romero Arosquipa
 
3. Univariable and Multivariable Analysis_Using Stata_2025.pdf
3. Univariable and Multivariable Analysis_Using Stata_2025.pdf3. Univariable and Multivariable Analysis_Using Stata_2025.pdf
3. Univariable and Multivariable Analysis_Using Stata_2025.pdf
axonneurologycenter1
 
Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..
yuvarajreddy2002
 
定制(意大利Rimini毕业证)布鲁诺马代尔纳嘉雷迪米音乐学院学历认证
定制(意大利Rimini毕业证)布鲁诺马代尔纳嘉雷迪米音乐学院学历认证定制(意大利Rimini毕业证)布鲁诺马代尔纳嘉雷迪米音乐学院学历认证
定制(意大利Rimini毕业证)布鲁诺马代尔纳嘉雷迪米音乐学院学历认证
Taqyea
 
Oral Malodor.pptx jsjshdhushehsidjjeiejdhfj
Oral Malodor.pptx jsjshdhushehsidjjeiejdhfjOral Malodor.pptx jsjshdhushehsidjjeiejdhfj
Oral Malodor.pptx jsjshdhushehsidjjeiejdhfj
maitripatel5301
 
AWS-AIML-PRESENTATION RELATED TO DATA SCIENCE TO DATA
AWS-AIML-PRESENTATION RELATED TO DATA SCIENCE TO DATAAWS-AIML-PRESENTATION RELATED TO DATA SCIENCE TO DATA
AWS-AIML-PRESENTATION RELATED TO DATA SCIENCE TO DATA
SnehaBoja
 
Process Mining and Official Statistics - CBS
Process Mining and Official Statistics - CBSProcess Mining and Official Statistics - CBS
Process Mining and Official Statistics - CBS
Process mining Evangelist
 
GenAI for Quant Analytics: survey-analytics.ai
GenAI for Quant Analytics: survey-analytics.aiGenAI for Quant Analytics: survey-analytics.ai
GenAI for Quant Analytics: survey-analytics.ai
Inspirient
 
MASAkkjjkttuyrdquesjhjhjfc44dddtions.docx
MASAkkjjkttuyrdquesjhjhjfc44dddtions.docxMASAkkjjkttuyrdquesjhjhjfc44dddtions.docx
MASAkkjjkttuyrdquesjhjhjfc44dddtions.docx
santosh162
 
chapter 4 Variability statistical research .pptx
chapter 4 Variability statistical research .pptxchapter 4 Variability statistical research .pptx
chapter 4 Variability statistical research .pptx
justinebandajbn
 
Process Mining at Dimension Data - Jan vermeulen
Process Mining at Dimension Data - Jan vermeulenProcess Mining at Dimension Data - Jan vermeulen
Process Mining at Dimension Data - Jan vermeulen
Process mining Evangelist
 
E-Book-TOEFL-Masuk-PTN.pdf hahahahaahahahah
E-Book-TOEFL-Masuk-PTN.pdf hahahahaahahahahE-Book-TOEFL-Masuk-PTN.pdf hahahahaahahahah
E-Book-TOEFL-Masuk-PTN.pdf hahahahaahahahah
RyanRahardjo2
 
新西兰文凭奥克兰理工大学毕业证书AUT成绩单补办
新西兰文凭奥克兰理工大学毕业证书AUT成绩单补办新西兰文凭奥克兰理工大学毕业证书AUT成绩单补办
新西兰文凭奥克兰理工大学毕业证书AUT成绩单补办
Taqyea
 
Deloitte Analytics - Applying Process Mining in an audit context
Deloitte Analytics - Applying Process Mining in an audit contextDeloitte Analytics - Applying Process Mining in an audit context
Deloitte Analytics - Applying Process Mining in an audit context
Process mining Evangelist
 
Impact_of_AI_on_Everyday_Life and info.pptx
Impact_of_AI_on_Everyday_Life and info.pptxImpact_of_AI_on_Everyday_Life and info.pptx
Impact_of_AI_on_Everyday_Life and info.pptx
swatibhusari5
 
indonesia-gen-z-report-2024 Gen Z (born between 1997 and 2012) is currently t...
indonesia-gen-z-report-2024 Gen Z (born between 1997 and 2012) is currently t...indonesia-gen-z-report-2024 Gen Z (born between 1997 and 2012) is currently t...
indonesia-gen-z-report-2024 Gen Z (born between 1997 and 2012) is currently t...
disnakertransjabarda
 
Principles of information security Chapter 5.ppt
Principles of information security Chapter 5.pptPrinciples of information security Chapter 5.ppt
Principles of information security Chapter 5.ppt
EstherBaguma
 
文凭证书美国SDSU文凭圣地亚哥州立大学学生证学历认证查询
文凭证书美国SDSU文凭圣地亚哥州立大学学生证学历认证查询文凭证书美国SDSU文凭圣地亚哥州立大学学生证学历认证查询
文凭证书美国SDSU文凭圣地亚哥州立大学学生证学历认证查询
Taqyea
 
chapter3 Central Tendency statistics.ppt
chapter3 Central Tendency statistics.pptchapter3 Central Tendency statistics.ppt
chapter3 Central Tendency statistics.ppt
justinebandajbn
 
录取通知书加拿大TMU毕业证多伦多都会大学电子版毕业证成绩单
录取通知书加拿大TMU毕业证多伦多都会大学电子版毕业证成绩单录取通知书加拿大TMU毕业证多伦多都会大学电子版毕业证成绩单
录取通知书加拿大TMU毕业证多伦多都会大学电子版毕业证成绩单
Taqyea
 
3. Univariable and Multivariable Analysis_Using Stata_2025.pdf
3. Univariable and Multivariable Analysis_Using Stata_2025.pdf3. Univariable and Multivariable Analysis_Using Stata_2025.pdf
3. Univariable and Multivariable Analysis_Using Stata_2025.pdf
axonneurologycenter1
 
Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..
yuvarajreddy2002
 
定制(意大利Rimini毕业证)布鲁诺马代尔纳嘉雷迪米音乐学院学历认证
定制(意大利Rimini毕业证)布鲁诺马代尔纳嘉雷迪米音乐学院学历认证定制(意大利Rimini毕业证)布鲁诺马代尔纳嘉雷迪米音乐学院学历认证
定制(意大利Rimini毕业证)布鲁诺马代尔纳嘉雷迪米音乐学院学历认证
Taqyea
 
Oral Malodor.pptx jsjshdhushehsidjjeiejdhfj
Oral Malodor.pptx jsjshdhushehsidjjeiejdhfjOral Malodor.pptx jsjshdhushehsidjjeiejdhfj
Oral Malodor.pptx jsjshdhushehsidjjeiejdhfj
maitripatel5301
 
AWS-AIML-PRESENTATION RELATED TO DATA SCIENCE TO DATA
AWS-AIML-PRESENTATION RELATED TO DATA SCIENCE TO DATAAWS-AIML-PRESENTATION RELATED TO DATA SCIENCE TO DATA
AWS-AIML-PRESENTATION RELATED TO DATA SCIENCE TO DATA
SnehaBoja
 
Process Mining and Official Statistics - CBS
Process Mining and Official Statistics - CBSProcess Mining and Official Statistics - CBS
Process Mining and Official Statistics - CBS
Process mining Evangelist
 
GenAI for Quant Analytics: survey-analytics.ai
GenAI for Quant Analytics: survey-analytics.aiGenAI for Quant Analytics: survey-analytics.ai
GenAI for Quant Analytics: survey-analytics.ai
Inspirient
 
MASAkkjjkttuyrdquesjhjhjfc44dddtions.docx
MASAkkjjkttuyrdquesjhjhjfc44dddtions.docxMASAkkjjkttuyrdquesjhjhjfc44dddtions.docx
MASAkkjjkttuyrdquesjhjhjfc44dddtions.docx
santosh162
 
chapter 4 Variability statistical research .pptx
chapter 4 Variability statistical research .pptxchapter 4 Variability statistical research .pptx
chapter 4 Variability statistical research .pptx
justinebandajbn
 
Process Mining at Dimension Data - Jan vermeulen
Process Mining at Dimension Data - Jan vermeulenProcess Mining at Dimension Data - Jan vermeulen
Process Mining at Dimension Data - Jan vermeulen
Process mining Evangelist
 
E-Book-TOEFL-Masuk-PTN.pdf hahahahaahahahah
E-Book-TOEFL-Masuk-PTN.pdf hahahahaahahahahE-Book-TOEFL-Masuk-PTN.pdf hahahahaahahahah
E-Book-TOEFL-Masuk-PTN.pdf hahahahaahahahah
RyanRahardjo2
 
Ad

Week 11: Programming for Data Analysis

  • 1. Programming for Data Analysis Week 11 Dr. Ferdin Joe John Joseph Faculty of Information Technology Thai – Nichi Institute of Technology, Bangkok
  • 2. Today’s lesson Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 2 • Binary Classification • Naïve Bayes Classifier • Support Vector Machine
  • 3. Naïve Bayes Classifier • Conditional Probability Model of Classification Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 3
  • 4. Conditional Probability Model of Classification • The conditional probability can be calculated using the joint probability, although it would be intractable. • Bayes Theorem provides a principled way for calculating the conditional probability. Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 4
  • 5. Bayes Theorem • P(A|B) = P(B|A) * P(A) / P(B) • We can frame classification as a conditional classification problem with Bayes Theorem as follows: P(yi | x1, x2, …, xn) = P(x1, x2, …, xn | yi) * P(yi) / P(x1, x2, …, xn) Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 5
  • 6. Naïve Bayes • For simplifying the calculation • The Bayes Theorem assumes that each input variable is dependent upon all other variables. • This is a cause of complexity in the calculation. Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 6
  • 7. Calculation of Prior and Conditional Probabilities • P(yi) = examples with yi / total examples • In the case of categorical variables, such as counts or labels, a multinomial distribution can be used. • If the variables are binary, such as yes/no or true/false, a binomial distribution can be used. • If a variable is numerical, such as a measurement, often a Gaussian distribution is used. Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 7
  • 8. Naïve Bayes Distribution • Binomial Naïve Bayes: Naïve Bayes that uses a binomial distribution. • Multinomial Naïve Bayes: Naïve Bayes that uses a multinomial distribution. • Gaussian Naïve Bayes: Naïve Bayes that uses a Gaussian distribution. Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 8
  • 9. Preparation of dataset Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 9
  • 10. Fitting Probability Distribution Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 10
  • 11. Sorting Data Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 11
  • 12. Calculate Priors Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 12
  • 13. Fit Distribution Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 13
  • 14. Summary Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 14
  • 15. Independent Conditional Probability Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 15
  • 16. Taking a sample Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 16
  • 17. Probability Scores Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 17
  • 18. Wrap Up Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 18
  • 19. Gaussian Naïve Bayes Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 19
  • 20. Lab Exercise • Use this source code and make a classification report which gives accuracy, precision, recall and F1-score Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 20
  • 21. Support Vector Machine Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 21
  • 22. SVM Objective • A training set, S, for an SVM is comprised of m samples. • The features, x, consist of real numbers and the classifications, y, must be -1 or 1. Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 22
  • 23. SVM Hyperplane • The SVM hyperlane is defined by the weight vector, w, and the bias, b, and is defined as: Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 23
  • 24. Example for 2 Feature • Hyperplane for two features can be written as: Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 24
  • 25. Libraries Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 25
  • 26. Data Clusters Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 26
  • 27. Data Clusters Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 27
  • 28. Prepare Datasets Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 28
  • 29. Learning Rate Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 29
  • 30. Learning Rate Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 30
  • 31. Draw Decision Boundary Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 31
  • 32. Plot Data Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 32
  • 33. Plot Data Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 33
  • 34. Test Classifier Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 34
  • 35. Test Classifier Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 35
  • 36. Output Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 36
  • 37. Lab Exercise • Create Confusion Matrix and classification report for SVM Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 37
  • 38. DSA 207 – Binary Classifier Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 38