10 Machine Learning Questions - ANSWERED!

CodeEmporium · Beginner ·📐 ML Fundamentals ·7y ago

Key Takeaways

The video covers 10 machine learning interview questions, discussing concepts such as probability, likelihood, Bayes theorem, generative and discriminative models, and techniques for handling data imbalances, including random undersampling, random oversampling, and SMOTE, using tools like Naive Bayes classifier and SVM. The video also touches on machine learning model evaluation, cross-validation, and data imputation, referencing resources like Springboard's machine learning interview questions

Full Transcript

hey guys I came across this blog post on 41 machine learning interview questions by Roger Huang it has some pretty interesting questions that coverage concepts applications and research in machine learning they have decent answers to but I'll provide my own interpretation for ten of these questions depending on how you guys like this I'll make answering interview questions a series on the channel no these are interview questions so some responses will be terse you don't have time for stories over the phone that said I'll highlight some questions that I found interesting so that you get a better understanding note that at any point in the video if you think that I've answered something incorrectly or have a better explanation then feel free to call me out in the comments down below and provide your own intuition we can all learn from that and with that let's get started what is the difference between probability and likelihood two entities involved here data which is a set of observations D now D is a set of n samples with their corresponding labels for example in an email classifier to classify a given email as spam or not spam X is an email and Y can be a binary label spam or non-spam the second entity is a model now this model performs some tasks like the email classifier I just talked about its parameterised by some theta let's say these two entities are connected by some function f f is basically the model and this model has two phases a training phase and a testing phase during the training phase you don't know theta but you're given some training data D so this is like we have a bunch of emails and we also have their labels spam and non-spam we use this training data to learn the parameters of our classifier that is learn theta during this training phase given some D we want to find theta that maximizes performance this is the essence of a method of optimization called maximum likelihood estimation after training we have the model so we have the email classifier as we now have the data what we can do now is testing the model on unseen data so we give the classifier some unseen emails and then it spits out whether the email is spam or not spam it's during this testing phase that given some theta we determine the chance of observing this outcome that is probability so the difference probability during the testing phase given a theta we determine the probability of observing the outcome and likelihood during the training phase given some outcome we determined theta that maximizes the probability that's an outcome occurred although they are similar in math notation they have very different meanings note that this is just my take on the difference I have to reference certain sources to make sure I saw a great threat on Stack Exchange with different interpretations so check that out in the description like I said in the beginning of the video if you have a better explanation to this answer or any of the answers that I provide feel free to call me on in the comments down below what is Bayes theorem and how is it useful in the machine learning context Bayes theorem allows us to determine posterior probabilities from our priors when presented with evidence or more simply a method of revising existing predictions given new evidence so how much more likely a is than B now is equal to how much more likely a was than B before we saw our new evidence times how much more likely this evidence would be to occur if a were true then if B were true in machine learning base theorem forms a fundamental assumption of the naive Bayes classifier a generative model for classification what is the difference between a generative and discriminative model discriminative models learn decision boundaries between classes generative models learned the distribution of the classes themselves SVM is discriminative because we are creating a decision boundary it is a maximum margin classifier after all logistic regression is also discriminative as we learn a linear decision boundary decision trees are also discriminative as each of the non leaf nodes will partition space creating boundaries naive Bayes classifiers are generative as they learn the distributions of the classes themselves another difference is susceptibility to outliers today we build a system where the distribution of the cross-validation or test data is different from the training data it is much easier to adjust the distribution then change the nature of a decision boundary so generative models work better with outliers here again if you are certain that the test data classes will have the same tribution as your train data classes then it might not be of concern however this can very well happen in the real world a mathematical take during the training phase many parametric models have the same start point maximum likelihood estimation this is what I talked about while discussing the first question distinguishing probability and likelihood during the training phase given some data we determine the parameters of the model theta such that the model performance is maximized in discriminative models we maximize the conditional likelihood that is we maximize conditional probability given the model parameters while in generative models like the naive Bayes classifiers we maximize the joint likelihood that is the joint probability given the model parameters what cross-validation technique would you use on a time series data set in normal cross-validation sake a fold we split the data into k equal sized chunks use K minus 1 chunks as training and the remaining chunk for testing the model we can then average the performance of all the K tests to give some performance measure a special case when K is equal to n is leave one out cross validation however time series data isn't just a bag of points we cannot include samples in the train set that occur later in time than the test point so while performing leave one out cross validation we select a point as a test set and only include the points that occur before it too poorly as the train set there are situations when we may want a multi-step forecast so we only include the points in the train set that are taken at least some time T before the test point how was a decision tree pruned pruning involves the removal of nodes and branches in a decision tree to make it simpler so as to mitigate overfitting and improve performance so we constructed a decision tree and we have a validation set for each leaf node we can determine the node purity ideally we want the notes to be as pure as possible for high accuracy but it's very easy to overfit so much so that the leaf nodes may only have a single data point we can mitigate this by pruning the decision tree consider a method called cost-effective pruning with the validation data determine the performance of the original tree T now consider the sub tree t1 and remove it from the original tree replace the sub tree with a leaf if the validation set doesn't have the significant difference in performance we consider the simpler tree Occam's razor comes to play here if pruned considered the prune tree as the original and continue to the next sub tree how would you handle an imbalance dataset if you have a lot of data to work with in the underrepresented class then we can try random undersampling this involves getting rid of the over-represented class samples from the training data you don't have to target a perfect one is to one ratio but something close should work just fine if you don't have too much data to work with we can perform random over sampling take the underrepresented class and sample with replacement until we get the required ratio synthetic monetary / sampling or smote is a technique where we can synthesize new data with minor distortions of existing samples rather than just copies and simple learning algorithms tend to work well for data imbalances typically boosting bagging and random forced techniques why aggregation tends to mitigate overfitting of a specific class what evaluation approaches would you work to gauge the effectiveness of a machine learning model you can talk about cross-validation here I'm not going to explain it too much because it's a subset of the other answers how do you handle missing or corrupt data in a data set to deal with missing values we could perform data imputation the big idea is that if there is data that is missing you add a value but that data can be of different types for categorical values you can add a new category like no clue or other for numeric types you can impute with zero and add an indicator variable showing that the value is missing the model will compute it for you how would you deal with outliers analyze the data with and without outliers we don't know if removing them is going to have some adverse effect after all that said there are two methods of dealing with outliers one is trimming where we delete the outlier altogether and the other is winterizing where we seal or floor the value to the closest that is either the maximum or minimum acceptable non outlier value this is usually the preferred technique why us this question can be asked while applying to any role in any company come up with an answer that's more than just a recruiter contacted me so I think I'm a good fit ideally your response should tie your background with the current role proving that beyond any doubt you are a perfect fit as a grad student I'm currently doing this on my job hunting escapade and that's it that's ten data science interview questions answered hope this helps you crack those interviews or if you're not looking for a job you at least learn something out of this video if you like my teaching style show some love with like and comment down below your interview experiences I'd love to read them and that's bound to help someone out there just like you now that the video is over a little about myself my name is a J hall Thor I run a YouTube channel covering aspects on deep learning machine learning data sciences and other frontiers of artificial intelligence if you want to get hooked on trending deep learning research or understand the mechanics behind some fundamental machine learning concepts then subscribe to code Emporium links are in the description down below thanks for sticking until the end if you still haven't had your daily dose of knowledge click or tap one of the videos on screen for an awesome video and I'll see you in the next one you

Original Description

We cover 10 machine learning interview questions. Have you had interesting interview experiences you'd like to share? Leave them in the comments! REFERENCES [1] Interview Questions: https://www.springboard.com/blog/machine-learning-interview-questions/ [2] More Questions: https://www.springboard.com/blog/data-science-interview-questions/ [3] Generative Vs Discriminative : https://stats.stackexchange.com/questions/12421/generative-vs-discriminative [4]: What is Bayes Rule: http://www.askamathematician.com/2011/10/q-what-is-bayes-rule-and-how-do-i-use-it-in-daily-life/ [5] (Followup) The likelihood function is not PDF: https://stats.stackexchange.com/questions/31238/what-is-the-reason-that-a-likelihood-function-is-not-a-pdf [6] Cross Validation for time series: https://robjhyndman.com/hyndsight/tscv/ [7] SMOTE: https://jair.org/index.php/jair/article/view/10302 [8] Combating Imbalanced Data: https://www.analyticsvidhya.com/blog/2017/03/imbalanced-classification-problem/ [9] Understanding ROC: https://towardsdatascience.com/understanding-auc-roc-curve-68b2303cc9c5 [10] Publiclly available datasets: https://www.springboard.com/blog/free-public-data-sets-data-science-project/ [11] Probability Vs Likelihood: https://stats.stackexchange.com/questions/2641/what-is-the-difference-between-likelihood-and-probability
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from CodeEmporium · CodeEmporium · 28 of 60

1 Linear Regression and Multiple Regression
Linear Regression and Multiple Regression
CodeEmporium
2 Logistic Regression - THE MATH YOU SHOULD KNOW!
Logistic Regression - THE MATH YOU SHOULD KNOW!
CodeEmporium
3 Generative Adversarial Networks - FUTURISTIC & FUN AI !
Generative Adversarial Networks - FUTURISTIC & FUN AI !
CodeEmporium
4 Deep Learning on the Cloud - GPU TO LEARN FASTER
Deep Learning on the Cloud - GPU TO LEARN FASTER
CodeEmporium
5 Deep Mind's AlphaGo Zero - EXPLAINED
Deep Mind's AlphaGo Zero - EXPLAINED
CodeEmporium
6 Mask Region based Convolution Neural Networks - EXPLAINED!
Mask Region based Convolution Neural Networks - EXPLAINED!
CodeEmporium
7 Attention in Neural Networks
Attention in Neural Networks
CodeEmporium
8 Depthwise Separable Convolution - A FASTER CONVOLUTION!
Depthwise Separable Convolution - A FASTER CONVOLUTION!
CodeEmporium
9 One Neural network learns EVERYTHING ?!
One Neural network learns EVERYTHING ?!
CodeEmporium
10 Neural Voice Cloning
Neural Voice Cloning
CodeEmporium
11 AI creates Image Classifiers…by DRAWING?
AI creates Image Classifiers…by DRAWING?
CodeEmporium
12 Unpaired Image-Image Translation using CycleGANs
Unpaired Image-Image Translation using CycleGANs
CodeEmporium
13 K-Means Clustering - EXPLAINED!
K-Means Clustering - EXPLAINED!
CodeEmporium
14 Random Forest Classification
Random Forest Classification
CodeEmporium
15 Data Science in Finance
Data Science in Finance
CodeEmporium
16 Hypothesis testing with Applications in Data Science
Hypothesis testing with Applications in Data Science
CodeEmporium
17 A/B Testing - Simply Explained
A/B Testing - Simply Explained
CodeEmporium
18 The Kernel Trick - THE MATH YOU SHOULD KNOW!
The Kernel Trick - THE MATH YOU SHOULD KNOW!
CodeEmporium
19 Support Vector Machines - THE MATH YOU  SHOULD KNOW
Support Vector Machines - THE MATH YOU SHOULD KNOW
CodeEmporium
20 Principal Component Analysis (PCA) - THE MATH YOU SHOULD KNOW!
Principal Component Analysis (PCA) - THE MATH YOU SHOULD KNOW!
CodeEmporium
21 History of Calculus - Animated
History of Calculus - Animated
CodeEmporium
22 Curiosity in AI
Curiosity in AI
CodeEmporium
23 DropBlock - A BETTER DROPOUT for Neural Networks
DropBlock - A BETTER DROPOUT for Neural Networks
CodeEmporium
24 Autoencoders - EXPLAINED
Autoencoders - EXPLAINED
CodeEmporium
25 Recurrent Neural Networks - EXPLAINED!
Recurrent Neural Networks - EXPLAINED!
CodeEmporium
26 LSTM Networks - EXPLAINED!
LSTM Networks - EXPLAINED!
CodeEmporium
27 Building an Image Captioner with Neural Networks
Building an Image Captioner with Neural Networks
CodeEmporium
10 Machine Learning Questions - ANSWERED!
10 Machine Learning Questions - ANSWERED!
CodeEmporium
29 How do neural networks work?
How do neural networks work?
CodeEmporium
30 Evolution of Face Generation |  Evolution of GANs
Evolution of Face Generation | Evolution of GANs
CodeEmporium
31 How does Google Translate's AI work?
How does Google Translate's AI work?
CodeEmporium
32 How to keep up with AI research?
How to keep up with AI research?
CodeEmporium
33 How does YouTube recommend videos? - AI EXPLAINED!
How does YouTube recommend videos? - AI EXPLAINED!
CodeEmporium
34 Variational Autoencoders - EXPLAINED!
Variational Autoencoders - EXPLAINED!
CodeEmporium
35 Logistic Regression - VISUALIZED!
Logistic Regression - VISUALIZED!
CodeEmporium
36 Gradient Descent - THE MATH YOU SHOULD KNOW
Gradient Descent - THE MATH YOU SHOULD KNOW
CodeEmporium
37 Boosting - EXPLAINED!
Boosting - EXPLAINED!
CodeEmporium
38 Transformer Neural Networks - EXPLAINED! (Attention is all you need)
Transformer Neural Networks - EXPLAINED! (Attention is all you need)
CodeEmporium
39 Loss Functions - EXPLAINED!
Loss Functions - EXPLAINED!
CodeEmporium
40 Optimizers - EXPLAINED!
Optimizers - EXPLAINED!
CodeEmporium
41 NLP with Neural Networks & Transformers
NLP with Neural Networks & Transformers
CodeEmporium
42 Batch Normalization - EXPLAINED!
Batch Normalization - EXPLAINED!
CodeEmporium
43 Activation Functions - EXPLAINED!
Activation Functions - EXPLAINED!
CodeEmporium
44 Data Scientist Answers Interview Questions
Data Scientist Answers Interview Questions
CodeEmporium
45 Why use GPU with Neural Networks?
Why use GPU with Neural Networks?
CodeEmporium
46 How do GPUs speed up Neural Network training?
How do GPUs speed up Neural Network training?
CodeEmporium
47 BERT Neural Network - EXPLAINED!
BERT Neural Network - EXPLAINED!
CodeEmporium
48 ConvNets Scaled Efficiently
ConvNets Scaled Efficiently
CodeEmporium
49 Transformer Neural Net makes music! (JukeboxAI)
Transformer Neural Net makes music! (JukeboxAI)
CodeEmporium
50 What do filters of Convolution Neural Network learn?
What do filters of Convolution Neural Network learn?
CodeEmporium
51 We're hosting a Machine Learning Conference!
We're hosting a Machine Learning Conference!
CodeEmporium
52 MLconfEU 2020: Machine Learning Conference for Software Engineers
MLconfEU 2020: Machine Learning Conference for Software Engineers
CodeEmporium
53 Are Neural Networks Intelligent?
Are Neural Networks Intelligent?
CodeEmporium
54 Time Series Forecasting with Machine Learning
Time Series Forecasting with Machine Learning
CodeEmporium
55 Few Shot Learning - EXPLAINED!
Few Shot Learning - EXPLAINED!
CodeEmporium
56 How does a Data Scientist Fight FRAUD?
How does a Data Scientist Fight FRAUD?
CodeEmporium
57 How would a Data Scientist analyze Customer Churn?
How would a Data Scientist analyze Customer Churn?
CodeEmporium
58 Expectations with Machine Learning
Expectations with Machine Learning
CodeEmporium
59 Why Logistic Regression DOESN'T return probabilities?!
Why Logistic Regression DOESN'T return probabilities?!
CodeEmporium
60 How you SHOULD code Machine Learning
How you SHOULD code Machine Learning
CodeEmporium

This video teaches machine learning fundamentals, including probability, likelihood, Bayes theorem, and generative and discriminative models, as well as techniques for handling data imbalances and evaluating machine learning models. It provides a comprehensive overview of key concepts and techniques in machine learning, making it a valuable resource for beginners. By watching this video, viewers can gain a deeper understanding of machine learning and improve their skills in applying these concep

Key Takeaways
  1. Build a system to handle data imbalances using random undersampling and oversampling
  2. Implement an SVM model for classification
  3. Apply Bayes theorem for prediction
  4. Use cross-validation for model evaluation
  5. Synthesize new data using SMOTE
  6. Perform leave one out cross-validation for time series data
  7. Evaluate a machine learning model using metrics like accuracy and precision
  8. Handle missing data using imputation techniques like adding a new category for categorical values or zero for numeric types
💡 Generative models learn the distribution of classes themselves, while discriminative models learn decision boundaries between classes, and understanding the difference between these two types of models is crucial for selecting the appropriate approach for a given problem.

Related AI Lessons

Up next
Learn Deep Learning by Hand (Beginner's Guide - Part 1)
Thu Vu
Watch →