SlideShare a Scribd company logo
11. Machine Learning System
Design:
PRIORITIZING WHAT TO WORK ON: BUILDING A SPAM CLASSIFIER:
If a word is to be found in the email, we would assign its respective
entry a 1, else 0.
So how could you spend your time to improve the accuracy of this
classifier?
ERROR ANALYSIS:
We can try out different quick and dirty implementations of ML
algorithms and learning curves.
Lets take a high error example:
For example, assume that we have 500 emails and our algorithm
misclassifies a 100 of them. We could manually analyse the 100
emails and categorize them based on what type of emails they are.
We could then try to come up with new cues and features that
would help us classify these 100 emails correctly.
Hence, if most of our misclassified emails are those which try to
steal passwords, then we could find some features that are
particular to those emails and add them to our model.
It is very important to get error results as a single, numerical value.
Otherwise it is difficult to assess your algorithm's performance.
For example, if we use stemming, which is the process of treating
the same word with different forms (fail/failing/failed) as one word
(fail), and get a 3% error rate instead of 5%, then we should
definitely add it to our model.
However, if we try to distinguish between upper case and lower-
case letters and end up getting a 3.2% error rate instead of 3%,
then we should avoid using this new feature.
Hence, we should try new things, get a numerical value for our
error rate, and based on our result decide whether we want to
keep the new feature or not.
ERROR METRICS FOR SKEWED CLASSES:
Suppose we train a model and it gives an error of 1%.
But in the training examples, only 0.5 % people actually have
cancer… so predicting y=0 always is better choice as it gives only
0.5% error
This is an ambiguous form of judgement.
So, we come up with a new form of error metric: Precision and
Recall
Precision and Recall are defined by setting the rare class = 1not =0…
Now, if the algo predicts y=0 all the time, then this will give Recall =
0
➢Classifier with high precision and high recall is a good classifier
➢Even with very skewed classes, the algo can’t cheat
But:
So, to get high precision:
This will give high precision → as no of predicted positives is
decreased
And low recall
If:
Then:
How to compare precision recall values bw two algos:
Previously we had a single no metric for error analysis, but now we
have two nos.
How to determine which is better?
Taking average is not a good choice
A NEW EVALUATION METRICS:
F1 score:also called F score:
➢To pick a threshold, try different values of threshold and one
with the best F-score is to be picked.
IMPORTANCE OF DATA IN MACHINE LEARNING:
Problems like confusable words problem are hard to entertain.
So what can we do to solve that ?
These algos were tried on different sizes of training data:
All of them give approx. same accuracy on a large dataset
It shows that:
So, for confusable words problem:
We have enough features that capture the surrounding words
o So, that’s enough info to predict the right answer
As a counter example:
We don’t have features like: how old the house is?
Does it have furniture?
Location?
Etc…
We have just the size!
An approach to determine if its possible to predict the o/p with
given set of features:
➢֍ In case of confusable words, a human expert can easily tell
the missing word accurately
➢֍ In case of housing price example: even a real estate expert
cant tell the exact priec of house based on just the size.
So, can having the lot of data help?
➢Assuming we have many features and a rich class of functions
→ low bias
➢Assuming we have huge huge dataset → low variance
→ This makes up for a very high performance algorithm.

More Related Content

Similar to 11 ml system design

Math 009 Final Examination Spring, 2015 1 Answer Sheet M.docx
Math 009 Final Examination Spring, 2015 1 Answer Sheet M.docxMath 009 Final Examination Spring, 2015 1 Answer Sheet M.docx
Math 009 Final Examination Spring, 2015 1 Answer Sheet M.docx
andreecapon
 
Important Classification and Regression Metrics.pptx
Important Classification and Regression Metrics.pptxImportant Classification and Regression Metrics.pptx
Important Classification and Regression Metrics.pptx
Chode Amarnath
 
M08 BiasVarianceTradeoff
M08 BiasVarianceTradeoffM08 BiasVarianceTradeoff
M08 BiasVarianceTradeoff
Raman Kannan
 
Dimd_m_004 DL.pdf
Dimd_m_004 DL.pdfDimd_m_004 DL.pdf
Dimd_m_004 DL.pdf
juan631
 
Sample Size Determination
Sample Size DeterminationSample Size Determination
Module 4: Model Selection and Evaluation
Module 4: Model Selection and EvaluationModule 4: Model Selection and Evaluation
Module 4: Model Selection and Evaluation
Sara Hooker
 
Aptitude questions all topics (1)
Aptitude questions all topics (1)Aptitude questions all topics (1)
Aptitude questions all topics (1)
SnehaNallabheem
 
Performance Metrics, Baseline Model, and Hyper Parameter
Performance Metrics, Baseline Model, and Hyper ParameterPerformance Metrics, Baseline Model, and Hyper Parameter
Performance Metrics, Baseline Model, and Hyper Parameter
IndraFransiskusAlam1
 
Regularization_BY_MOHAMED_ESSAM.pptx
Regularization_BY_MOHAMED_ESSAM.pptxRegularization_BY_MOHAMED_ESSAM.pptx
Regularization_BY_MOHAMED_ESSAM.pptx
Mohamed Essam
 
Performance Metrics for Machine Learning Algorithms
Performance Metrics for Machine Learning AlgorithmsPerformance Metrics for Machine Learning Algorithms
Performance Metrics for Machine Learning Algorithms
Kush Kulshrestha
 
30019781969295_report
30019781969295_report30019781969295_report
30019781969295_reportPIYALI ROY
 
AMCAT REPORT
AMCAT REPORTAMCAT REPORT
AMCAT REPORTabdulsafa
 
Top 100+ Google Data Science Interview Questions.pdf
Top 100+ Google Data Science Interview Questions.pdfTop 100+ Google Data Science Interview Questions.pdf
Top 100+ Google Data Science Interview Questions.pdf
Datacademy.ai
 
Lecture11.pptx
Lecture11.pptxLecture11.pptx
Lecture11.pptx
SanjarBey
 
Proportion
ProportionProportion
Proportiontvierra
 
Proportion
ProportionProportion
Proportiontvierra
 
Sampling methods theory and practice
Sampling methods theory and practice Sampling methods theory and practice
Sampling methods theory and practice Ravindra Sharma
 
Machine Learning Interview Questions
Machine Learning Interview QuestionsMachine Learning Interview Questions
Machine Learning Interview Questions
Rock Interview
 
Lect 8 learning types (M.L.).pdf
Lect 8 learning types (M.L.).pdfLect 8 learning types (M.L.).pdf
Lect 8 learning types (M.L.).pdf
HassanElalfy4
 

Similar to 11 ml system design (20)

Math 009 Final Examination Spring, 2015 1 Answer Sheet M.docx
Math 009 Final Examination Spring, 2015 1 Answer Sheet M.docxMath 009 Final Examination Spring, 2015 1 Answer Sheet M.docx
Math 009 Final Examination Spring, 2015 1 Answer Sheet M.docx
 
Important Classification and Regression Metrics.pptx
Important Classification and Regression Metrics.pptxImportant Classification and Regression Metrics.pptx
Important Classification and Regression Metrics.pptx
 
M08 BiasVarianceTradeoff
M08 BiasVarianceTradeoffM08 BiasVarianceTradeoff
M08 BiasVarianceTradeoff
 
Dimd_m_004 DL.pdf
Dimd_m_004 DL.pdfDimd_m_004 DL.pdf
Dimd_m_004 DL.pdf
 
Sample Size Determination
Sample Size DeterminationSample Size Determination
Sample Size Determination
 
Module 4: Model Selection and Evaluation
Module 4: Model Selection and EvaluationModule 4: Model Selection and Evaluation
Module 4: Model Selection and Evaluation
 
Aptitude questions all topics (1)
Aptitude questions all topics (1)Aptitude questions all topics (1)
Aptitude questions all topics (1)
 
Performance Metrics, Baseline Model, and Hyper Parameter
Performance Metrics, Baseline Model, and Hyper ParameterPerformance Metrics, Baseline Model, and Hyper Parameter
Performance Metrics, Baseline Model, and Hyper Parameter
 
Regularization_BY_MOHAMED_ESSAM.pptx
Regularization_BY_MOHAMED_ESSAM.pptxRegularization_BY_MOHAMED_ESSAM.pptx
Regularization_BY_MOHAMED_ESSAM.pptx
 
Performance Metrics for Machine Learning Algorithms
Performance Metrics for Machine Learning AlgorithmsPerformance Metrics for Machine Learning Algorithms
Performance Metrics for Machine Learning Algorithms
 
30019781969295_report
30019781969295_report30019781969295_report
30019781969295_report
 
AMCAT REPORT
AMCAT REPORTAMCAT REPORT
AMCAT REPORT
 
Top 100+ Google Data Science Interview Questions.pdf
Top 100+ Google Data Science Interview Questions.pdfTop 100+ Google Data Science Interview Questions.pdf
Top 100+ Google Data Science Interview Questions.pdf
 
Lecture11.pptx
Lecture11.pptxLecture11.pptx
Lecture11.pptx
 
Proportion
ProportionProportion
Proportion
 
4 1 ratio
4 1 ratio4 1 ratio
4 1 ratio
 
Proportion
ProportionProportion
Proportion
 
Sampling methods theory and practice
Sampling methods theory and practice Sampling methods theory and practice
Sampling methods theory and practice
 
Machine Learning Interview Questions
Machine Learning Interview QuestionsMachine Learning Interview Questions
Machine Learning Interview Questions
 
Lect 8 learning types (M.L.).pdf
Lect 8 learning types (M.L.).pdfLect 8 learning types (M.L.).pdf
Lect 8 learning types (M.L.).pdf
 

More from TanmayVijay1

18 application example photo ocr
18 application example  photo ocr18 application example  photo ocr
18 application example photo ocr
TanmayVijay1
 
1 Introduction to Machine Learning
1 Introduction to Machine Learning1 Introduction to Machine Learning
1 Introduction to Machine Learning
TanmayVijay1
 
17 large scale machine learning
17 large scale machine learning17 large scale machine learning
17 large scale machine learning
TanmayVijay1
 
16 recommender systems
16 recommender systems16 recommender systems
16 recommender systems
TanmayVijay1
 
15 anomaly detection
15 anomaly detection15 anomaly detection
15 anomaly detection
TanmayVijay1
 
14 dimentionality reduction
14 dimentionality reduction14 dimentionality reduction
14 dimentionality reduction
TanmayVijay1
 
13 unsupervised learning clustering
13 unsupervised learning   clustering13 unsupervised learning   clustering
13 unsupervised learning clustering
TanmayVijay1
 
12 support vector machines
12 support vector machines12 support vector machines
12 support vector machines
TanmayVijay1
 
10 advice for applying ml
10 advice for applying ml10 advice for applying ml
10 advice for applying ml
TanmayVijay1
 
9 neural network learning
9 neural network learning9 neural network learning
9 neural network learning
TanmayVijay1
 
8 neural network representation
8 neural network representation8 neural network representation
8 neural network representation
TanmayVijay1
 
7 regularization
7 regularization7 regularization
7 regularization
TanmayVijay1
 
6 logistic regression classification algo
6 logistic regression   classification algo6 logistic regression   classification algo
6 logistic regression classification algo
TanmayVijay1
 
5 octave tutorial
5 octave tutorial5 octave tutorial
5 octave tutorial
TanmayVijay1
 
4 linear regeression with multiple variables
4 linear regeression with multiple variables4 linear regeression with multiple variables
4 linear regeression with multiple variables
TanmayVijay1
 
3 linear algebra review
3 linear algebra review3 linear algebra review
3 linear algebra review
TanmayVijay1
 
2 linear regression with one variable
2 linear regression with one variable2 linear regression with one variable
2 linear regression with one variable
TanmayVijay1
 

More from TanmayVijay1 (17)

18 application example photo ocr
18 application example  photo ocr18 application example  photo ocr
18 application example photo ocr
 
1 Introduction to Machine Learning
1 Introduction to Machine Learning1 Introduction to Machine Learning
1 Introduction to Machine Learning
 
17 large scale machine learning
17 large scale machine learning17 large scale machine learning
17 large scale machine learning
 
16 recommender systems
16 recommender systems16 recommender systems
16 recommender systems
 
15 anomaly detection
15 anomaly detection15 anomaly detection
15 anomaly detection
 
14 dimentionality reduction
14 dimentionality reduction14 dimentionality reduction
14 dimentionality reduction
 
13 unsupervised learning clustering
13 unsupervised learning   clustering13 unsupervised learning   clustering
13 unsupervised learning clustering
 
12 support vector machines
12 support vector machines12 support vector machines
12 support vector machines
 
10 advice for applying ml
10 advice for applying ml10 advice for applying ml
10 advice for applying ml
 
9 neural network learning
9 neural network learning9 neural network learning
9 neural network learning
 
8 neural network representation
8 neural network representation8 neural network representation
8 neural network representation
 
7 regularization
7 regularization7 regularization
7 regularization
 
6 logistic regression classification algo
6 logistic regression   classification algo6 logistic regression   classification algo
6 logistic regression classification algo
 
5 octave tutorial
5 octave tutorial5 octave tutorial
5 octave tutorial
 
4 linear regeression with multiple variables
4 linear regeression with multiple variables4 linear regeression with multiple variables
4 linear regeression with multiple variables
 
3 linear algebra review
3 linear algebra review3 linear algebra review
3 linear algebra review
 
2 linear regression with one variable
2 linear regression with one variable2 linear regression with one variable
2 linear regression with one variable
 

Recently uploaded

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 

Recently uploaded (20)

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 

11 ml system design

  • 1. 11. Machine Learning System Design: PRIORITIZING WHAT TO WORK ON: BUILDING A SPAM CLASSIFIER: If a word is to be found in the email, we would assign its respective entry a 1, else 0.
  • 2. So how could you spend your time to improve the accuracy of this classifier? ERROR ANALYSIS: We can try out different quick and dirty implementations of ML algorithms and learning curves. Lets take a high error example: For example, assume that we have 500 emails and our algorithm misclassifies a 100 of them. We could manually analyse the 100 emails and categorize them based on what type of emails they are. We could then try to come up with new cues and features that would help us classify these 100 emails correctly.
  • 3. Hence, if most of our misclassified emails are those which try to steal passwords, then we could find some features that are particular to those emails and add them to our model. It is very important to get error results as a single, numerical value. Otherwise it is difficult to assess your algorithm's performance.
  • 4. For example, if we use stemming, which is the process of treating the same word with different forms (fail/failing/failed) as one word (fail), and get a 3% error rate instead of 5%, then we should definitely add it to our model. However, if we try to distinguish between upper case and lower- case letters and end up getting a 3.2% error rate instead of 3%, then we should avoid using this new feature. Hence, we should try new things, get a numerical value for our error rate, and based on our result decide whether we want to keep the new feature or not. ERROR METRICS FOR SKEWED CLASSES: Suppose we train a model and it gives an error of 1%. But in the training examples, only 0.5 % people actually have cancer… so predicting y=0 always is better choice as it gives only 0.5% error This is an ambiguous form of judgement.
  • 5. So, we come up with a new form of error metric: Precision and Recall Precision and Recall are defined by setting the rare class = 1not =0…
  • 6. Now, if the algo predicts y=0 all the time, then this will give Recall = 0 ➢Classifier with high precision and high recall is a good classifier ➢Even with very skewed classes, the algo can’t cheat But: So, to get high precision: This will give high precision → as no of predicted positives is decreased And low recall If:
  • 7. Then: How to compare precision recall values bw two algos: Previously we had a single no metric for error analysis, but now we have two nos.
  • 8. How to determine which is better? Taking average is not a good choice A NEW EVALUATION METRICS: F1 score:also called F score:
  • 9. ➢To pick a threshold, try different values of threshold and one with the best F-score is to be picked. IMPORTANCE OF DATA IN MACHINE LEARNING: Problems like confusable words problem are hard to entertain. So what can we do to solve that ?
  • 10. These algos were tried on different sizes of training data: All of them give approx. same accuracy on a large dataset It shows that: So, for confusable words problem: We have enough features that capture the surrounding words o So, that’s enough info to predict the right answer
  • 11. As a counter example: We don’t have features like: how old the house is? Does it have furniture? Location? Etc… We have just the size! An approach to determine if its possible to predict the o/p with given set of features: ➢֍ In case of confusable words, a human expert can easily tell the missing word accurately ➢֍ In case of housing price example: even a real estate expert cant tell the exact priec of house based on just the size.
  • 12. So, can having the lot of data help? ➢Assuming we have many features and a rich class of functions → low bias ➢Assuming we have huge huge dataset → low variance → This makes up for a very high performance algorithm.