尊敬的 微信汇率:1円 ≈ 0.046078 元 支付宝汇率:1円 ≈ 0.046168元 [退出登录]
SlideShare a Scribd company logo
Machine Learning Interviews – 
Day 2 
Arpit Agarwal
Decision Trees 
• JP’s very practical problem:- “Whether to go 
to prakruthi for tea or not?” 
Ask Rishabh if he 
wants to come? 
Yes No 
Does Rishabh has 
money for both of us? 
Don’t go for tea 
Yes No 
Go for tea Don’t go for tea
Decision Trees 
• A tree in which each internal node represents 
a test of an attribute and a leaf represents a 
label and a branch represents an attribute 
value. 
• A node in a decision tree partitions the space. 
• Can be used for classification and regression.
Decision Trees
Decision Tree Learning 
– Choose the best attribute to split the remaining instances 
and make that attribute a decision node 
– Each node will correspond to a subset of the training set 
– Repeat this process recursively for each child 
– Stop when: 
• All the instances in a node have the same label 
• There are no more attributes 
• There are no more instances
How to select the best attribute? 
• Various heuristics such as 
– Entropy Impurity (which is minimized when all the 
instances in a given node have same label) 
• Entropy(S) = - p1 * log2(p1) - p0 * log2(p0) 
– Gini Impurity 
• Entropy(S) = p0 * p1
Decision Tree Pruning 
• In pruning we remove a bad decision node 
and merge its children. 
• Two techniques: 
– Subtree Replacement 
– Subtree Raising
Decision Trees 
• Advantage- Easy to understand and interpret; 
can be applied to wide variety of problems 
• Disadvantage- Difficult to learn, Overfittting 
problem, Error-propagation
Support Vector Machine (SVM) 
• Belong to the ‘Marwari’ family of algorithms 
- “Always thinks about maximizing its margins”
SVM 
• Which classifier is better?
SVM 
• Which classifier is better?
SVM 
denotes +1 
denotes -1 
f(x,w,b) = sign(w x + b) 
The maximum 
margin linear 
classifier is the 
linear classifier 
with the, um, 
maximum margin. 
This is the 
simplest kind of 
SVM (Called an 
LSVM) 
Linear SVM 
Support Vectors 
are those 
datapoints that 
the margin 
pushes up 
against 
1. Maximizing the margin is good 
according to intuition and PAC theory 
2. Implies that only support vectors are 
important; other training examples 
are ignorable. 
3. Empirically it works very very well.
Hard Margin SVM 
What we know: 
• w . x+ + b = +1 
• w . x- + b = -1 
• w . (x+-x-) = 2 
X-x+ 
M=Margin Width 
x x w 
w w 
M 
( ) 2 
 
  
 
 
 Goal: 1) Correctly classify all training data 
if yi = +1 
if yi = -1 
for all i 
wx  b 1 i 
wx  b 1 i 
y (wx  b) 1 i i 
2) Maximize the Margin 
same as minimize 
2 
w 
|| || 
M  
1 
w w t 
2 
 We can formulate a Quadratic Optimization Problem and solve for w and b
Hard Margin SVM 
• The lagrangian dual of the problem:- 
• After solving this we get the optimal αi and the solution is 
w = Σαiyixi b= yk- wTxk for any xk such that αk 0 
• The points for which αi > 0 are called the support vectors.
Soft Margin SVM 
 Hard Margin: So far we require 
all data points be classified correctly 
- No training error 
 What if the training set is 
noisy? 
- Solution 1: use very powerful 
kernels 
denotes +1 
denotes -1 
OVERFITTING!
Soft Margin SVM 
Slack variables ξi can be added to allow misclassification 
of difficult or noisy examples. 
e11 
e7 
e2 
What should our quadratic 
optimization criterion be? 
Minimize 
 
 
R 
C εk 
k 
1 
1 
|| w 
|| 
2
Soft Margin SVM 
• Optimization problem 
• Lagrange Dual 
• After solving this, the solution as 
w = Σαiyixi b= yk- wTxk for any xk such that αk 0
Kernel SVM 
 General idea: the original input space can always be mapped 
to some higher-dimensional feature space where the training 
set is separable: 
Φ: x → φ(x)
Kernel SVM 
 If every data point is mapped into high-dimensional 
space via some transformation Φ: 
x → φ(x), the dot product becomes: 
K(xi,xj)= φ(xi) Tφ(xj) 
 A kernel function is some function that 
corresponds to an inner product in some 
expanded feature space.
Learning with Kernel SVM 
• Optimization problem: 
• The solution is
Types of Kernels 
 Linear: K(xi,xj)= xi 
Txj 
 Polynomial of power p: K(xi,xj)= (1+ xi 
Txj)p 
 Gaussian (radial-basis function network): 
i j 
( , ) exp( 2 
 Sigmoid: K(xi,xj)= tanh(β0xi 
Txj + β1) 
) 
2 
2 
 
i j 
x x 
x x 
 
K  
SVM 
• Takeaway- SVM maximizes margin 
– Hard Margin – “Use when data is seperable” 
– Soft Margin – “Use when data is non-seperable”
- What is Overfitting? How to avoid it? 
- “Cross-validation, regularization” 
- What is regularization? Why do we need it? 
- What is Bias-Variance tradeoff?
Overfitting – Curve Fitting
Overfitting

More Related Content

What's hot

Lecture 3b: Decision Trees (1 part)
Lecture 3b: Decision Trees (1 part)Lecture 3b: Decision Trees (1 part)
Lecture 3b: Decision Trees (1 part)
Marina Santini
 
Understanding Bagging and Boosting
Understanding Bagging and BoostingUnderstanding Bagging and Boosting
Understanding Bagging and Boosting
Mohit Rajput
 
Lecture 3: Basic Concepts of Machine Learning - Induction & Evaluation
Lecture 3: Basic Concepts of Machine Learning - Induction & EvaluationLecture 3: Basic Concepts of Machine Learning - Induction & Evaluation
Lecture 3: Basic Concepts of Machine Learning - Induction & Evaluation
Marina Santini
 
Pc 8.1 notes
Pc 8.1 notesPc 8.1 notes
Pc 8.1 notes
Jonathan Fjelstrom
 
Lec4b pong from_pixels
Lec4b pong from_pixelsLec4b pong from_pixels
Lec4b pong from_pixels
Ronald Teo
 
Random Forest Classifier in Machine Learning | Palin Analytics
Random Forest Classifier in Machine Learning | Palin AnalyticsRandom Forest Classifier in Machine Learning | Palin Analytics
Random Forest Classifier in Machine Learning | Palin Analytics
Palin analytics
 
Lecture 8: Machine Learning in Practice (1)
Lecture 8: Machine Learning in Practice (1) Lecture 8: Machine Learning in Practice (1)
Lecture 8: Machine Learning in Practice (1)
Marina Santini
 
22 Machine Learning Feature Selection
22 Machine Learning Feature Selection22 Machine Learning Feature Selection
22 Machine Learning Feature Selection
Andres Mendez-Vazquez
 
Multi-Class Sentiment Classification using Machine Learning and Deep Learning...
Multi-Class Sentiment Classification using Machine Learning and Deep Learning...Multi-Class Sentiment Classification using Machine Learning and Deep Learning...
Multi-Class Sentiment Classification using Machine Learning and Deep Learning...
saurav singla
 

What's hot (9)

Lecture 3b: Decision Trees (1 part)
Lecture 3b: Decision Trees (1 part)Lecture 3b: Decision Trees (1 part)
Lecture 3b: Decision Trees (1 part)
 
Understanding Bagging and Boosting
Understanding Bagging and BoostingUnderstanding Bagging and Boosting
Understanding Bagging and Boosting
 
Lecture 3: Basic Concepts of Machine Learning - Induction & Evaluation
Lecture 3: Basic Concepts of Machine Learning - Induction & EvaluationLecture 3: Basic Concepts of Machine Learning - Induction & Evaluation
Lecture 3: Basic Concepts of Machine Learning - Induction & Evaluation
 
Pc 8.1 notes
Pc 8.1 notesPc 8.1 notes
Pc 8.1 notes
 
Lec4b pong from_pixels
Lec4b pong from_pixelsLec4b pong from_pixels
Lec4b pong from_pixels
 
Random Forest Classifier in Machine Learning | Palin Analytics
Random Forest Classifier in Machine Learning | Palin AnalyticsRandom Forest Classifier in Machine Learning | Palin Analytics
Random Forest Classifier in Machine Learning | Palin Analytics
 
Lecture 8: Machine Learning in Practice (1)
Lecture 8: Machine Learning in Practice (1) Lecture 8: Machine Learning in Practice (1)
Lecture 8: Machine Learning in Practice (1)
 
22 Machine Learning Feature Selection
22 Machine Learning Feature Selection22 Machine Learning Feature Selection
22 Machine Learning Feature Selection
 
Multi-Class Sentiment Classification using Machine Learning and Deep Learning...
Multi-Class Sentiment Classification using Machine Learning and Deep Learning...Multi-Class Sentiment Classification using Machine Learning and Deep Learning...
Multi-Class Sentiment Classification using Machine Learning and Deep Learning...
 

Similar to Machine learning interviews day2

Support Vector Machines is the the the the the the the the the
Support Vector Machines is the the the the the the the the theSupport Vector Machines is the the the the the the the the the
Support Vector Machines is the the the the the the the the the
sanjaibalajeessn
 
Support Vector Machines Simply
Support Vector Machines SimplySupport Vector Machines Simply
Support Vector Machines Simply
Emad Nabil
 
super vector machines algorithms using deep
super vector machines algorithms using deepsuper vector machines algorithms using deep
super vector machines algorithms using deep
KNaveenKumarECE
 
4.Support Vector Machines.ppt machine learning and development
4.Support Vector Machines.ppt machine learning and development4.Support Vector Machines.ppt machine learning and development
4.Support Vector Machines.ppt machine learning and development
PriyankaRamavath3
 
13Kernel_Machines.pptx
13Kernel_Machines.pptx13Kernel_Machines.pptx
13Kernel_Machines.pptx
KarasuLee
 
Support vector machine
Support vector machineSupport vector machine
Support vector machine
Prasenjit Dey
 
Notes relating to Machine Learning and SVM
Notes relating to Machine Learning and SVMNotes relating to Machine Learning and SVM
Notes relating to Machine Learning and SVM
SyedSaimGardezi
 
Support vector machine
Support vector machineSupport vector machine
Support vector machine
Rishabh Gupta
 
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
Universitat Politècnica de Catalunya
 
Machine Learning workshop by GDSC Amity University Chhattisgarh
Machine Learning workshop by GDSC Amity University ChhattisgarhMachine Learning workshop by GDSC Amity University Chhattisgarh
Machine Learning workshop by GDSC Amity University Chhattisgarh
Poorabpatel
 
Extra Lecture - Support Vector Machines (SVM), a lecture in subject module St...
Extra Lecture - Support Vector Machines (SVM), a lecture in subject module St...Extra Lecture - Support Vector Machines (SVM), a lecture in subject module St...
Extra Lecture - Support Vector Machines (SVM), a lecture in subject module St...
Maninda Edirisooriya
 
Support Vector Machine.ppt
Support Vector Machine.pptSupport Vector Machine.ppt
Support Vector Machine.ppt
NBACriteria2SICET
 
support vector machine algorithm in machine learning
support vector machine algorithm in machine learningsupport vector machine algorithm in machine learning
support vector machine algorithm in machine learning
SamGuy7
 
svm.ppt
svm.pptsvm.ppt
svm.ppt
RanjithaM32
 
Support vector machine in data mining.pdf
Support vector machine in data mining.pdfSupport vector machine in data mining.pdf
Support vector machine in data mining.pdf
RubhithaA
 
1629 stochastic subgradient approach for solving linear support vector
1629 stochastic subgradient approach for solving linear support vector1629 stochastic subgradient approach for solving linear support vector
1629 stochastic subgradient approach for solving linear support vector
Dr Fereidoun Dejahang
 
机器学习Adaboost
机器学习Adaboost机器学习Adaboost
机器学习Adaboost
Shocky1
 
Support Vector Machines USING MACHINE LEARNING HOW IT WORKS
Support Vector Machines USING MACHINE LEARNING HOW IT WORKSSupport Vector Machines USING MACHINE LEARNING HOW IT WORKS
Support Vector Machines USING MACHINE LEARNING HOW IT WORKS
rajalakshmi5921
 
Optimization for Neural Network Training - Veronica Vilaplana - UPC Barcelona...
Optimization for Neural Network Training - Veronica Vilaplana - UPC Barcelona...Optimization for Neural Network Training - Veronica Vilaplana - UPC Barcelona...
Optimization for Neural Network Training - Veronica Vilaplana - UPC Barcelona...
Universitat Politècnica de Catalunya
 
Dual SVM Problem.pdf
Dual SVM Problem.pdfDual SVM Problem.pdf
Dual SVM Problem.pdf
ssuser8547f2
 

Similar to Machine learning interviews day2 (20)

Support Vector Machines is the the the the the the the the the
Support Vector Machines is the the the the the the the the theSupport Vector Machines is the the the the the the the the the
Support Vector Machines is the the the the the the the the the
 
Support Vector Machines Simply
Support Vector Machines SimplySupport Vector Machines Simply
Support Vector Machines Simply
 
super vector machines algorithms using deep
super vector machines algorithms using deepsuper vector machines algorithms using deep
super vector machines algorithms using deep
 
4.Support Vector Machines.ppt machine learning and development
4.Support Vector Machines.ppt machine learning and development4.Support Vector Machines.ppt machine learning and development
4.Support Vector Machines.ppt machine learning and development
 
13Kernel_Machines.pptx
13Kernel_Machines.pptx13Kernel_Machines.pptx
13Kernel_Machines.pptx
 
Support vector machine
Support vector machineSupport vector machine
Support vector machine
 
Notes relating to Machine Learning and SVM
Notes relating to Machine Learning and SVMNotes relating to Machine Learning and SVM
Notes relating to Machine Learning and SVM
 
Support vector machine
Support vector machineSupport vector machine
Support vector machine
 
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
 
Machine Learning workshop by GDSC Amity University Chhattisgarh
Machine Learning workshop by GDSC Amity University ChhattisgarhMachine Learning workshop by GDSC Amity University Chhattisgarh
Machine Learning workshop by GDSC Amity University Chhattisgarh
 
Extra Lecture - Support Vector Machines (SVM), a lecture in subject module St...
Extra Lecture - Support Vector Machines (SVM), a lecture in subject module St...Extra Lecture - Support Vector Machines (SVM), a lecture in subject module St...
Extra Lecture - Support Vector Machines (SVM), a lecture in subject module St...
 
Support Vector Machine.ppt
Support Vector Machine.pptSupport Vector Machine.ppt
Support Vector Machine.ppt
 
support vector machine algorithm in machine learning
support vector machine algorithm in machine learningsupport vector machine algorithm in machine learning
support vector machine algorithm in machine learning
 
svm.ppt
svm.pptsvm.ppt
svm.ppt
 
Support vector machine in data mining.pdf
Support vector machine in data mining.pdfSupport vector machine in data mining.pdf
Support vector machine in data mining.pdf
 
1629 stochastic subgradient approach for solving linear support vector
1629 stochastic subgradient approach for solving linear support vector1629 stochastic subgradient approach for solving linear support vector
1629 stochastic subgradient approach for solving linear support vector
 
机器学习Adaboost
机器学习Adaboost机器学习Adaboost
机器学习Adaboost
 
Support Vector Machines USING MACHINE LEARNING HOW IT WORKS
Support Vector Machines USING MACHINE LEARNING HOW IT WORKSSupport Vector Machines USING MACHINE LEARNING HOW IT WORKS
Support Vector Machines USING MACHINE LEARNING HOW IT WORKS
 
Optimization for Neural Network Training - Veronica Vilaplana - UPC Barcelona...
Optimization for Neural Network Training - Veronica Vilaplana - UPC Barcelona...Optimization for Neural Network Training - Veronica Vilaplana - UPC Barcelona...
Optimization for Neural Network Training - Veronica Vilaplana - UPC Barcelona...
 
Dual SVM Problem.pdf
Dual SVM Problem.pdfDual SVM Problem.pdf
Dual SVM Problem.pdf
 

Recently uploaded

Keynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse CityKeynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse City
PJ Caposey
 
220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science
Kalna College
 
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
yarusun
 
How to stay relevant as a cyber professional: Skills, trends and career paths...
How to stay relevant as a cyber professional: Skills, trends and career paths...How to stay relevant as a cyber professional: Skills, trends and career paths...
How to stay relevant as a cyber professional: Skills, trends and career paths...
Infosec
 
India Quiz (Prelims and Finals) by Quiz Club, IIT Kanpur
India Quiz (Prelims and Finals) by Quiz Club, IIT KanpurIndia Quiz (Prelims and Finals) by Quiz Club, IIT Kanpur
India Quiz (Prelims and Finals) by Quiz Club, IIT Kanpur
Quiz Club IIT Kanpur
 
Cross-Cultural Leadership and Communication
Cross-Cultural Leadership and CommunicationCross-Cultural Leadership and Communication
Cross-Cultural Leadership and Communication
MattVassar1
 
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptxScience-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Catherine Dela Cruz
 
220711130088 Sumi Basak Virtual University EPC 3.pptx
220711130088 Sumi Basak Virtual University EPC 3.pptx220711130088 Sumi Basak Virtual University EPC 3.pptx
220711130088 Sumi Basak Virtual University EPC 3.pptx
Kalna College
 
Hospital pharmacy and it's organization (1).pdf
Hospital pharmacy and it's organization (1).pdfHospital pharmacy and it's organization (1).pdf
Hospital pharmacy and it's organization (1).pdf
ShwetaGawande8
 
Erasmus + DISSEMINATION ACTIVITIES Croatia
Erasmus + DISSEMINATION ACTIVITIES CroatiaErasmus + DISSEMINATION ACTIVITIES Croatia
Erasmus + DISSEMINATION ACTIVITIES Croatia
whatchangedhowreflec
 
220711130086 Sukanta Singh E learning and mobile learning EPC 3 Internal Asse...
220711130086 Sukanta Singh E learning and mobile learning EPC 3 Internal Asse...220711130086 Sukanta Singh E learning and mobile learning EPC 3 Internal Asse...
220711130086 Sukanta Singh E learning and mobile learning EPC 3 Internal Asse...
Kalna College
 
IoT (Internet of Things) introduction Notes.pdf
IoT (Internet of Things) introduction Notes.pdfIoT (Internet of Things) introduction Notes.pdf
IoT (Internet of Things) introduction Notes.pdf
roshanranjit222
 
pol sci Election and Representation Class 11 Notes.pdf
pol sci Election and Representation Class 11 Notes.pdfpol sci Election and Representation Class 11 Notes.pdf
pol sci Election and Representation Class 11 Notes.pdf
BiplabHalder13
 
(T.L.E.) Agriculture: "Ornamental Plants"
(T.L.E.) Agriculture: "Ornamental Plants"(T.L.E.) Agriculture: "Ornamental Plants"
(T.L.E.) Agriculture: "Ornamental Plants"
MJDuyan
 
Images as attribute values in the Odoo 17
Images as attribute values in the Odoo 17Images as attribute values in the Odoo 17
Images as attribute values in the Odoo 17
Celine George
 
Music Business Model Presentation Full Sail University
Music Business Model Presentation Full Sail UniversityMusic Business Model Presentation Full Sail University
Music Business Model Presentation Full Sail University
camakaiclarkmusic
 
Creativity for Innovation and Speechmaking
Creativity for Innovation and SpeechmakingCreativity for Innovation and Speechmaking
Creativity for Innovation and Speechmaking
MattVassar1
 
nutrition in plants chapter 1 class 7...
nutrition in plants chapter 1 class 7...nutrition in plants chapter 1 class 7...
nutrition in plants chapter 1 class 7...
chaudharyreet2244
 
BỘ BÀI TẬP TEST THEO UNIT - FORM 2025 - TIẾNG ANH 12 GLOBAL SUCCESS - KÌ 1 (B...
BỘ BÀI TẬP TEST THEO UNIT - FORM 2025 - TIẾNG ANH 12 GLOBAL SUCCESS - KÌ 1 (B...BỘ BÀI TẬP TEST THEO UNIT - FORM 2025 - TIẾNG ANH 12 GLOBAL SUCCESS - KÌ 1 (B...
BỘ BÀI TẬP TEST THEO UNIT - FORM 2025 - TIẾNG ANH 12 GLOBAL SUCCESS - KÌ 1 (B...
Nguyen Thanh Tu Collection
 
Environmental science 1.What is environmental science and components of envir...
Environmental science 1.What is environmental science and components of envir...Environmental science 1.What is environmental science and components of envir...
Environmental science 1.What is environmental science and components of envir...
Deepika
 

Recently uploaded (20)

Keynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse CityKeynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse City
 
220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science
 
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
 
How to stay relevant as a cyber professional: Skills, trends and career paths...
How to stay relevant as a cyber professional: Skills, trends and career paths...How to stay relevant as a cyber professional: Skills, trends and career paths...
How to stay relevant as a cyber professional: Skills, trends and career paths...
 
India Quiz (Prelims and Finals) by Quiz Club, IIT Kanpur
India Quiz (Prelims and Finals) by Quiz Club, IIT KanpurIndia Quiz (Prelims and Finals) by Quiz Club, IIT Kanpur
India Quiz (Prelims and Finals) by Quiz Club, IIT Kanpur
 
Cross-Cultural Leadership and Communication
Cross-Cultural Leadership and CommunicationCross-Cultural Leadership and Communication
Cross-Cultural Leadership and Communication
 
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptxScience-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
 
220711130088 Sumi Basak Virtual University EPC 3.pptx
220711130088 Sumi Basak Virtual University EPC 3.pptx220711130088 Sumi Basak Virtual University EPC 3.pptx
220711130088 Sumi Basak Virtual University EPC 3.pptx
 
Hospital pharmacy and it's organization (1).pdf
Hospital pharmacy and it's organization (1).pdfHospital pharmacy and it's organization (1).pdf
Hospital pharmacy and it's organization (1).pdf
 
Erasmus + DISSEMINATION ACTIVITIES Croatia
Erasmus + DISSEMINATION ACTIVITIES CroatiaErasmus + DISSEMINATION ACTIVITIES Croatia
Erasmus + DISSEMINATION ACTIVITIES Croatia
 
220711130086 Sukanta Singh E learning and mobile learning EPC 3 Internal Asse...
220711130086 Sukanta Singh E learning and mobile learning EPC 3 Internal Asse...220711130086 Sukanta Singh E learning and mobile learning EPC 3 Internal Asse...
220711130086 Sukanta Singh E learning and mobile learning EPC 3 Internal Asse...
 
IoT (Internet of Things) introduction Notes.pdf
IoT (Internet of Things) introduction Notes.pdfIoT (Internet of Things) introduction Notes.pdf
IoT (Internet of Things) introduction Notes.pdf
 
pol sci Election and Representation Class 11 Notes.pdf
pol sci Election and Representation Class 11 Notes.pdfpol sci Election and Representation Class 11 Notes.pdf
pol sci Election and Representation Class 11 Notes.pdf
 
(T.L.E.) Agriculture: "Ornamental Plants"
(T.L.E.) Agriculture: "Ornamental Plants"(T.L.E.) Agriculture: "Ornamental Plants"
(T.L.E.) Agriculture: "Ornamental Plants"
 
Images as attribute values in the Odoo 17
Images as attribute values in the Odoo 17Images as attribute values in the Odoo 17
Images as attribute values in the Odoo 17
 
Music Business Model Presentation Full Sail University
Music Business Model Presentation Full Sail UniversityMusic Business Model Presentation Full Sail University
Music Business Model Presentation Full Sail University
 
Creativity for Innovation and Speechmaking
Creativity for Innovation and SpeechmakingCreativity for Innovation and Speechmaking
Creativity for Innovation and Speechmaking
 
nutrition in plants chapter 1 class 7...
nutrition in plants chapter 1 class 7...nutrition in plants chapter 1 class 7...
nutrition in plants chapter 1 class 7...
 
BỘ BÀI TẬP TEST THEO UNIT - FORM 2025 - TIẾNG ANH 12 GLOBAL SUCCESS - KÌ 1 (B...
BỘ BÀI TẬP TEST THEO UNIT - FORM 2025 - TIẾNG ANH 12 GLOBAL SUCCESS - KÌ 1 (B...BỘ BÀI TẬP TEST THEO UNIT - FORM 2025 - TIẾNG ANH 12 GLOBAL SUCCESS - KÌ 1 (B...
BỘ BÀI TẬP TEST THEO UNIT - FORM 2025 - TIẾNG ANH 12 GLOBAL SUCCESS - KÌ 1 (B...
 
Environmental science 1.What is environmental science and components of envir...
Environmental science 1.What is environmental science and components of envir...Environmental science 1.What is environmental science and components of envir...
Environmental science 1.What is environmental science and components of envir...
 

Machine learning interviews day2

  • 1. Machine Learning Interviews – Day 2 Arpit Agarwal
  • 2. Decision Trees • JP’s very practical problem:- “Whether to go to prakruthi for tea or not?” Ask Rishabh if he wants to come? Yes No Does Rishabh has money for both of us? Don’t go for tea Yes No Go for tea Don’t go for tea
  • 3. Decision Trees • A tree in which each internal node represents a test of an attribute and a leaf represents a label and a branch represents an attribute value. • A node in a decision tree partitions the space. • Can be used for classification and regression.
  • 5. Decision Tree Learning – Choose the best attribute to split the remaining instances and make that attribute a decision node – Each node will correspond to a subset of the training set – Repeat this process recursively for each child – Stop when: • All the instances in a node have the same label • There are no more attributes • There are no more instances
  • 6. How to select the best attribute? • Various heuristics such as – Entropy Impurity (which is minimized when all the instances in a given node have same label) • Entropy(S) = - p1 * log2(p1) - p0 * log2(p0) – Gini Impurity • Entropy(S) = p0 * p1
  • 7. Decision Tree Pruning • In pruning we remove a bad decision node and merge its children. • Two techniques: – Subtree Replacement – Subtree Raising
  • 8. Decision Trees • Advantage- Easy to understand and interpret; can be applied to wide variety of problems • Disadvantage- Difficult to learn, Overfittting problem, Error-propagation
  • 9. Support Vector Machine (SVM) • Belong to the ‘Marwari’ family of algorithms - “Always thinks about maximizing its margins”
  • 10. SVM • Which classifier is better?
  • 11. SVM • Which classifier is better?
  • 12. SVM denotes +1 denotes -1 f(x,w,b) = sign(w x + b) The maximum margin linear classifier is the linear classifier with the, um, maximum margin. This is the simplest kind of SVM (Called an LSVM) Linear SVM Support Vectors are those datapoints that the margin pushes up against 1. Maximizing the margin is good according to intuition and PAC theory 2. Implies that only support vectors are important; other training examples are ignorable. 3. Empirically it works very very well.
  • 13. Hard Margin SVM What we know: • w . x+ + b = +1 • w . x- + b = -1 • w . (x+-x-) = 2 X-x+ M=Margin Width x x w w w M ( ) 2      
  • 14.  Goal: 1) Correctly classify all training data if yi = +1 if yi = -1 for all i wx  b 1 i wx  b 1 i y (wx  b) 1 i i 2) Maximize the Margin same as minimize 2 w || || M  1 w w t 2  We can formulate a Quadratic Optimization Problem and solve for w and b
  • 15. Hard Margin SVM • The lagrangian dual of the problem:- • After solving this we get the optimal αi and the solution is w = Σαiyixi b= yk- wTxk for any xk such that αk 0 • The points for which αi > 0 are called the support vectors.
  • 16. Soft Margin SVM  Hard Margin: So far we require all data points be classified correctly - No training error  What if the training set is noisy? - Solution 1: use very powerful kernels denotes +1 denotes -1 OVERFITTING!
  • 17. Soft Margin SVM Slack variables ξi can be added to allow misclassification of difficult or noisy examples. e11 e7 e2 What should our quadratic optimization criterion be? Minimize   R C εk k 1 1 || w || 2
  • 18. Soft Margin SVM • Optimization problem • Lagrange Dual • After solving this, the solution as w = Σαiyixi b= yk- wTxk for any xk such that αk 0
  • 19. Kernel SVM  General idea: the original input space can always be mapped to some higher-dimensional feature space where the training set is separable: Φ: x → φ(x)
  • 20. Kernel SVM  If every data point is mapped into high-dimensional space via some transformation Φ: x → φ(x), the dot product becomes: K(xi,xj)= φ(xi) Tφ(xj)  A kernel function is some function that corresponds to an inner product in some expanded feature space.
  • 21. Learning with Kernel SVM • Optimization problem: • The solution is
  • 22. Types of Kernels  Linear: K(xi,xj)= xi Txj  Polynomial of power p: K(xi,xj)= (1+ xi Txj)p  Gaussian (radial-basis function network): i j ( , ) exp( 2  Sigmoid: K(xi,xj)= tanh(β0xi Txj + β1) ) 2 2  i j x x x x  K  
  • 23. SVM • Takeaway- SVM maximizes margin – Hard Margin – “Use when data is seperable” – Soft Margin – “Use when data is non-seperable”
  • 24. - What is Overfitting? How to avoid it? - “Cross-validation, regularization” - What is regularization? Why do we need it? - What is Bias-Variance tradeoff?
  翻译: