Machine Learning Interview Preparation
1. Lesson 1Mindset to Machine Learning Interview
2. Lesson 2Machine Learning Interview Demo
3. Lesson 3Technical Interviewing Techniques
4. Lesson 4Practice Questions!
4.1 Computer Science Fundamentals and Programming
4.2 Probability and Statistics
4.3 Data Modeling and Evaluation
4.4 Applying Machine Learning Algorithms and Libraries
4.5 Software Engineering and System Design
4.6 Next Steps
4.7 Additional Resources on Interviews
Get into the Right Mindset
You ...
are preparing for interviews for jobs in machine learning, data science, or research
are interested in tackling interviews less as a "test" and more like a conversation
want to show how your journey — whether you're entry-level, a career changer, or upskilling —
prepares you for the job
In this course, we will cover interviewing techniques and walkthroughs of common questions
with all of the above in mind. You will first walk through the following:
Go inside the mind of the employer - why is the company hiring for this role?
Identify a business problem - showcase you're interested in solving the root issues in order to
prevent further problems.
Explore potential data sources - see how your solution depends on your unique dataset.
Discuss machine learning solutions - get familiar with answering interview questions for this
unique field.
Practice answering technical questions - bolster your confidence for interview day by
practicing interview techniques.
Identify a Business Problem
Go inside the mind of the employer
If a company wants to hire a machine learning engineer (or data analyst or scientist), it’s clear
that they are trying to solve a complex problem where traditional algorithmic solutions are hard
to apply or simply do not work well enough. They are also extremely motivated to solve that
problem (otherwise they wouldn’t be in this business!).
Reflection Exercise
Before the interview, or even before you apply to a job, investigate possible answers to these
questions:
Why is the company hiring?
Does it look like they're backfilling (ie: someone left the company or was promoted, so they need
to fill in the job)? Or, are they expanding their team (therefore investing more in data science) or
even starting their data team for the first time? These answers will help you see how you're
needed. If the company is looking for a member of a large team, they likely need you to fill in a
specific role and may want you to show expert skill in a specialization. If they're building out
their data team, they may be looking for someone who's a fast learner and can help them make
decisions - since they may not know what they need from a data team.
How will this company's data team grow?
This will give you insight on longterm opportunities for you. If they're growing rapidly, that may
signal you have potential to become a team lead in the future.
Which business problem are they trying to solve?
Identify a Business Problem
Imagine yourself in the role – find out as much as possible about the company and position. Then
ask yourself: What is one core problem I need to solve? The answer should excite you, and drive
you to find out more about the problem, existing approaches, and recent developments in that
domain. Choose a problem that is essential for the company.
For example, as a Machine Learning Engineer at Udacity, your primary responsibility could be
to improve student engagement and retention. It is widely known that MOOC completion rates
are abysmally low. Why do students drop out of our programs? Do they find our content too
hard, or too easy? How can we improve student engagement in the classroom?
Although you may not be able to figure this out, you can think of realistic possibilities. For
example, an e-vendor may want to make better recommendations based on search history. A
healthcare company may want to better predict health risks. When you are in the interview,
connect your past experiences to how you can fix these hypothetical issues.
What else?
Don't forget to ask your interviewers the questions in this exercise, also! Not only do you want to
know the answers, asking will showcase your interest and thoughtfulness.
Prepare to Discuss ML Solutions
Explore Potential Data Sources
Next, think about what data you would need to answer these questions. Some of this may be
readily available, while you may have to build in additional hooks to gather certain pieces of
information. Dig into the company’s infrastructure and operations - what stack do they operate
on, what APIs do they have, what data are they already collecting, etc. Most companies today
have a blog where they often discuss their challenges, approaches, successes, and failures. This
should give you further insight into how they operate, and what products and services they might
have in the pipeline.
Prepare to Discuss Machine Learning Solutions
Now that you have a business problem to solve, you need to frame it in terms of machine
learning. Given what you’re trying to achieve, and the data you think might be available, can you
frame it as an ML problem?
Here are a couple questions to ask yourself:
What is an appropriate model to use?
How would you go about training and evaluating it? For example, the primary challenge that
a lot of recommendation systems like Netflix and Amazon face is clustering, not prediction - i.e.
once you are able to figure out groups of users who seem to have similar preference and
behavior, it becomes a whole lot easier to recommend products that they may find useful.
This thought process will help you be prepared to talk about issues that matter to the company
the most. Nobody expects you to walk into an interview and lay out a complete solution for
something they’ve been working hard on for months or years! But everybody likes a candidate
who shows genuine interest, motivation, and curiosity for a problem that is close to their hearts.
Depending on your interviewer and the stage of your interview, you may be asked more
technical questions, but you should try to use any opportunity you get to demonstrate that you
have thought about the company and role.
Pro Tip: When asked more open-ended questions such as “Describe a technical challenge you
faced when working on a project and how you solved it,” try to pick something that aligns well
with the company’s interests.
Focus on Essential Skills
Prepare to Demonstrate these Technical Skills
Here are the essential skills that a Machine Learning Engineer needs, as mentioned in the first
video of this lesson. Within each group are topics that you should be familiar with.
Study Tip: Copy and paste this list into a document and save to your computer for easy referral.
Computer Science Fundamentals and Programming
Topics
Data structures: Lists, stacks, queues, strings, hash maps, vectors, matrices, classes & objects,
trees, graphs, etc.
Algorithms: Recursion, searching, sorting, optimization, dynamic programming, etc.
Computability and complexity: P vs. NP, NP-complete problems, big-O notation, approximate
algorithms, etc.
Computer architecture: Memory, cache, bandwidth, threads & processes, deadlocks, etc.
Probability and Statistics
Topics
Basic probability: Conditional probability, Bayes rule, likelihood, independence, etc.
Probabilistic models: Bayes Nets, Markov Decision Processes, Hidden Markov Models, etc.
Statistical measures: Mean, median, mode, variance, population parameters vs. sample statistics
etc.
Proximity and error metrics: Cosine similarity, mean-squared error, Manhattan and Euclidean
distance, log-loss, etc.
Distributions and random sampling: Uniform, normal, binomial, Poisson, etc.
Analysis methods: ANOVA, hypothesis testing, factor analysis, etc.
Data Modeling and Evaluation
Topics
Data preprocessing: Munging/wrangling, transforming, aggregating, etc.
Pattern recognition: Correlations, clusters, trends, outliers & anomalies, etc.
Dimensionality reduction: Eigenvectors, Principal Component Analysis, etc.
Prediction: Classification, regression, sequence prediction, etc.; suitable error/accuracy metrics.
Evaluation: Training-testing split, sequential vs. randomized cross-validation, etc.
Applying Machine Learning Algorithms and Libraries
Topics
Models: Parametric vs. nonparametric, decision tree, nearest neighbor, neural net, support vector
machine, ensemble of multiple models, etc.
Learning procedure: Linear regression, gradient descent, genetic algorithms, bagging, boosting,
and other model-specific methods; regularization, hyperparameter tuning, etc.
Tradeoffs and gotchas: Relative advantages and disadvantages, bias and variance, overfitting and
underfitting, vanishing/exploding gradients, missing data, data leakage, etc.
Software Engineering and System Design
Topics
Software interface: Library calls, REST APIs, data collection endpoints, database queries, etc.
User interface: Capturing user inputs & application events, displaying results & visualization,
etc.
Scalability: Map-reduce, distributed processing, etc.
Deployment: Cloud hosting, containers & instances, microservices, etc.
Move on to the final lesson of this course to find lots of sample practice questions for each
topic!
Analyzing Technical Answers
It's time to play the role of the interviewer. You will observe a mixture of behavorial and
technical questions.
Try to "think like the employer." Make sure to compare your analysis with our analysis at the
end.
Predict Rain
Identify Fish
Detect Plagiarism
Reduce Data Dimensionality
Describe Your ML Project
Explain How SVMs Work
Do you Need Some Proven Strategies?
Strategies for Answering Technical Questions
If you're done watching videos and want to hurry up and practice answering some questions,
please skip the strategies for now and continue on to the next lesson. It's filled with practice
questions!
If you feel like you need a few more strategies for approaching technical interview questions
before continuing with your practice, this lesson on "Technical Interviewing Techniques" will
provide just that. This lesson focuses on how to approach Data Structures and Algorithms
questions, in particular, but we think you'll find that these strategies are applicable across many
types of Machine Learning engineering questions.
Interview Introduction
Clarifying the Question
Confirming Inputs
Test Cases
Brainstorming
Runtime Analysis
Coding
Debugging
Interview Wrap-Up
Time for Live Practice with Pramp
What next?
As you have probably figured out by now, one of the best ways to learn something is to practice
it. With interviewing, it’s great that you’ve worked through solutions on your own, but that’s not
quite what you need to prepare for an interview. Today you‘ll be able to schedule a live mock
interview and be one step closer to a job you love.
Practice Interviewing with Pramp(opens in a new tab)
Pramp is a peer-to-peer mock interview platform for coding interviews, focused on questions
regarding algorithms and data structures. It pairs software developers together for a practice
interview, based on their background, availability and practicing needs. Pramp automates the
whole process and takes care of scheduling, peer matching and interview prep content (i.e.
interview questions and answers). A live practice session includes integrated HD video chat,
collaborative code and support for 17 different programming languages.
The best part?
Pramp has partnered with us to offer FREE, UNLIMITED practice interviews along with a
streamlined on-boarding experience for Udacity students. We chose to work with Pramp because
it felt most aligned with the Udacity community in that it's a safe environment for anyone to
practice.
We recommend that you complete at least 3 interviews with Pramp as you prepare for your
interview.
If you have any questions or feedback about using Pramp for interview practice, email us!
Computer Science Fundamentals and Programming
Essential Skills Needed by Machine Learning Engineers
Now that you've had a chance to observe a mock interview, let's dig into the specifics of skills
you should be ready to demonstrate in an interview.
These skills can be divided into the following groups:
Computer Science Fundamentals
Probability and Statistics
Data Modeling and Evaluation
Applying Machine Learning Algorithms and Libraries
Software Engineering and System Design
Within each group are topics that you should be familiar with. In the next few sections, we've
provided you some sample questions that you may be asked in an interview.
Computer Science Fundamentals and Programming
Topics:
Data structures: Lists, stacks, queues, strings, hash maps, vectors, matrices, classes & objects,
trees, graphs, etc.
Algorithms: Recursion, searching, sorting, optimization, dynamic programming, etc.
Computability and complexity: P vs. NP, NP-complete problems, big-O notation, approximate
algorithms, etc.
Computer architecture: Memory, cache, bandwidth, threads & processes, deadlocks, etc.
Questions:
How would you check if a linked list has cycles?
Given two elements in a binary search tree, find their lowest common ancestor.
Write a function to sort a given stack.
What is the time complexity of any comparison-based sorting algorithm? Can you prove it?
How will you find the shortest path from one node to another in a weighted graph? What if some
weights are negative?
Find all palindromic substrings in a given string.
For all such questions, you should be able to:
1. Reason about the time and space complexity of your approach (usually in big-O notation).
2. Try to aim for the lowest complexity possible.
Extensive practice is the only way to familiarize yourself with the different classes of
problems so that you can quickly converge on an efficient solution.
Coding/interview prep platforms like InterviewBit(opens in a new tab), LeetCode(opens in a
new tab) and Pramp(opens in a new tab) are highly beneficial for this purpose.
Probability and Statistics
Topics:
Basic probability: Conditional probability, Bayes rule, likelihood, independence, etc.
Probabilistic models: Bayes Nets, Markov Decision Processes, Hidden Markov Models, etc.
Statistical measures: Mean, median, mode, variance, population parameters vs. sample statistics
etc.
Proximity and error metrics: Cosine similarity, mean-squared error, Manhattan and Euclidean
distance, log-loss, etc.
Distributions and random sampling: Uniform, normal, binomial, Poisson, etc.
Analysis methods: ANOVA, hypothesis testing, factor analysis, etc.
Questions:
The mean heights of men and women in a population were calculated to be Mand W. What is the
mean height of the total population?
A recent poll revealed that a third of the cars in Italy are Ferraris, and that half of those are red. If
you spot a red car approaching from a distance, what is the likelihood that it is a Ferrari?
You’re trying to find the best place to put in an advertisement banner on your website. You can
make the size (thickness) small, medium or large, and choose vertical position top, middle or
bottom. At least how many total page visits (n) and ad clicks (m) do you need to say with 95%
confidence that one of the designs performs better than all the other possibilities?
The time period between consecutive eruptions of the Old Faithful geyser in Yellowstone
National Park is found to have the following distribution. How would you describe/characterize
it? What can you infer from it?
Remember: many machine learning algorithms have a basis in probability and
statistics. Conceptual clarity of these fundamentals is extremely important, but at the same
time, you must be able to relate abstract formulae with real-world quantities.
Data Modeling and Evaluation
Topics:
Data preprocessing: Munging/wrangling, transforming, aggregating, etc.
Pattern recognition: Correlations, clusters, trends, outliers & anomalies, etc.
Dimensionality reduction: Eigenvectors, Principal Component Analysis, etc.
Prediction: Classification, regression, sequence prediction, etc.; suitable error/accuracy metrics.
Evaluation: Training-testing split, sequential vs. randomized cross-validation, etc.
Questions:
A dairy farmer is trying to understand the factors that affect milk production of her cattle. She
has been keeping logs of the daily temperature (usually 30-40°C), humidity (60-90%), feed
consumption (2000-2500 kgs), and milk produced (500-1000 liters).
How would you begin processing the data in order to model it, with the goal of predicting liters
of milk produced in a day?
What kind of machine learning problem is this?
Your company is building a facial expression coding system, which needs to take input images
from a standard HD 1920x1080 pixel webcam, and continuously tell whether the user is in one
of the following states: neutral, happy, sad, angry or afraid. When the user’s face is not visible in
the camera frame, it should indicate a special state: none.
What class of machine learning problems does this belong to?
If each pixel is made up of 3 values (for red, green, blue channels), what is the raw input data
complexity (no. of dimensions) for processing each image? Is there a way to reduce the no. of
dimensions?
How would you encode the output of the system? Explain why.
Climate data collected over the past century reveals a cyclic pattern of rising and falling
temperatures. How would you model this data (a sequence of average annual temperature values)
to predict the average temperature over the next 5 years?
Your job at an online news service is to collect text reports from around the world, and present
each story as a single article with content aggregated from different sources. How would you go
about designing such a system? What ML techniques would you apply?
Applying Machine Learning Algorithms and Libraries
Topics:
Models: Parametric vs. nonparametric, decision tree, nearest neighbor, neural net, support vector
machine, ensemble of multiple models, etc.
Learning procedure: Linear regression, gradient descent, genetic algorithms, bagging, boosting,
and other model-specific methods; regularization, hyperparameter tuning, etc.
Tradeoffs and gotchas: Relative advantages and disadvantages, bias and variance, overfitting and
underfitting, vanishing/exploding gradients, missing data, data leakage, etc.
Questions:
You’re trying to classify images of cats and dogs. Plotting the images in some transformed 2-
dimensional feature space reveals the following pattern (on the left). In some other space, images
of dogs and wolves show a different pattern (on the right).
What model would you use to classify cats vs. dogs, and what would you use for dogs vs.
wolves? Why?
I’m trying to fit a single hidden layer neural network to a given dataset, and I find that the
weights are oscillating a lot over training iterations (varying wildly, often swinging between
positive and negative values). What parameter do I need to tune to address this issue?
When training a support vector machine, what value are you optimizing for?
Lasso regression uses the L1-norm of coefficients as a penalty term, while ridge regression uses
the L2-norm. Which of these regularization methods is more likely to result in sparse solutions,
where one or more coefficients are exactly zero?
When training a 10-layer neural net using backpropagation, I find that the weights for the top 3
layers are not changing at all! The next few layers (4-6) are changing, but very slowly. What’s
going on and how do I fix this?
I’ve found some data about wheat-growing regions in Europe that includes annual rainfall (R, in
inches), mean altitude (A, in meters) and wheat output (O, in kgs/km2). A rough analysis and
some plots make me believe that output is related to the square of rainfall, and log of altitude: O
= β0 + β1 × R2 + β2 × loge(A)
Can I fit the coefficients (β) in my model to the data using linear regression?
Machine Learning challenges such as those on Kaggle(opens in a new tab) are a great way
to get exposed to different kinds of problems and their nuances. Try to participate in as many
as you can, and apply different machine learning models.
Software Engineering and System Design
Topics:
Software interface: Library calls, REST APIs, data collection endpoints, database queries, etc.
User interface: Capturing user inputs & application events, displaying results & visualization,
etc.
Scalability: Map-reduce, distributed processing, etc.
Deployment: Cloud hosting, containers & instances, microservices, etc.
Questions:
You run an ecommerce website. When a user clicks on an item to open its details page, you
would like to suggest 5 more items that the user may be interested in, based on item features as
well as the user’s purchase history, and display them at the bottom of the page. What services
and database tables would you need to support this behavior? Assuming they’re available, write
a query or procedure to fetch the 5 items to suggest.
What data would you like to collect from an online video player (like YouTube) to measure user
engagement and video popularity?
A very simple spam detection system works as follows: It processes one email at a time and
counts the number of occurrences of each unique word in it (term frequency), and then it
compares those counts with those of previously seen emails which have been marked as spam or
not. In order to scale up this system to handle a large volume of email traffic, can you design a
map-reduce scheme that can run on a cluster of computers?
You want to generate a live visualization of what portion of a webpage users are currently
viewing and clicking, sort of like a heat map. What components/services/APIs do you need in
place, on the client and server end, to enable this?
Next Steps
Arpan Chakraborty, Curriculum Lead, Machine Learning.
You've learned how to succeed in the Machine Learning Engineer Interview. Now it's time
to put that knowledge into practice.
In order to achieve mastery in interviewing, do the following:
For technical questions, practice coding on a whiteboard or online text editor instead of using an
IDE and compiler.
Practice interview questions with another person, using our interview checklist(opens in a new
tab) to confirm you've met these standards for success.
By adopting the interviewing practices from this course and practicing as much as possible, you
will make the best impression in an actual interview.
Good Luck!
Additional Resources on Interviews
Still here? Check out these additional resources!
General Interview Advice
Inside the Mind of a Recruiter(opens in a new tab) Check out Udacity's interview with Jason
Wong, a head recruiter, to get the inside scoop on what he looks for in job candidates.
Acing Your Interview(opens in a new tab) This blog post outlines guidelines for success
including preparation, strategic responses, and appropriate follow-up. It also includes a bonus
webinar recording from Udacity Careers VP, Kathleen Mullaney, Udacity Engineer, Art
Gillespie, and Data Scientist, Katie Malone.
Phone Screening
Phone interviews are often the first stage of the hiring process – doing well will increase your
odds of being called back for an on-site interview! Check out these tips for success when you get
the call.
How to Ace a Developer Phone Interview(opens in a new tab) Learn from Palantir how to
rock a phone interview and make it to the next phase of interviewing.
Onsite Interview
The final step before receiving a job offer is an interview with the team you would be working
with in your new job. This final interview is usually on-site and comprises a behavioral and
technical portion.
These interviews can be intimidating – it’s okay to feel nervous, everyone does! To make sure
you're well prepared on the interview day, begin practicing for interviews well before you begin
your job search to refine your interviewing skills and address anything you need more practice
on.
Perfecting Body Language(opens in a new tab) Feeling nervous about your interview? This
article details how to have body language that communicates confidence and calmness while you
are interviewing.
Technical Questions
Coding Interview Tips(opens in a new tab) Interview Cake describes easy-to-adopt behaviors
that will help you succeed in the coding interview.
The Coding Interview(opens in a new tab) Palantir's guide on preparing for the coding portion
of your technical interview.
21 Machine Learning Interview Questions and Answers(opens in a new tab) Here are some
sample questions from EliteData Science to help keep your mind in shape.
More Practice!
LeetCode(opens in a new tab) LeetCode has over 950 practice questions organized by
difficulty, topic, and company.
Interviewing.io(opens in a new tab) Practice interviewing with engineers from top companies,
anonymously.
InterviewBit(opens in a new tab) Practice with coding interview questions asked historically
and get job referrals.
Books
Cracking the Coding Interview(opens in a new tab) This best-selling book from Gayle
Laakmann McDowell offers 189 programming questions and solutions to help you practice
coding and answer technical interview questions with confidence.
Programming Interviews Exposed: Coding Your Way Through the Interview(opens in a
new tab) This popular guide to programming interviews includes code examples, information on
the latest languages, chapters on sorting and design patterns, tips on using LinkedIn, and a
downloadable app to help prepare applicants for the interview.
Elements of Programming Interviews: The Insiders’ Guide(opens in a new tab) This book
from Adnan Aziz, Tsung-Hsien Lee, and Amit Prakash features a great compilation of
programming-related problems for interview prep and general refreshers.
Additional Resources on Interviews
Still here? Check out these additional resources!
General Interview Advice
Inside the Mind of a Recruiter(opens in a new tab) Check out Udacity's interview with Jason
Wong, a head recruiter, to get the inside scoop on what he looks for in job candidates.
Acing Your Interview(opens in a new tab) This blog post outlines guidelines for success
including preparation, strategic responses, and appropriate follow-up. It also includes a bonus
webinar recording from Udacity Careers VP, Kathleen Mullaney, Udacity Engineer, Art
Gillespie, and Data Scientist, Katie Malone.
Phone Screening
Phone interviews are often the first stage of the hiring process – doing well will increase your
odds of being called back for an on-site interview! Check out these tips for success when you get
the call.
How to Ace a Developer Phone Interview(opens in a new tab) Learn from Palantir how to
rock a phone interview and make it to the next phase of interviewing.
Onsite Interview
The final step before receiving a job offer is an interview with the team you would be working
with in your new job. This final interview is usually on-site and comprises a behavioral and
technical portion.
These interviews can be intimidating – it’s okay to feel nervous, everyone does! To make sure
you're well prepared on the interview day, begin practicing for interviews well before you begin
your job search to refine your interviewing skills and address anything you need more practice
on.
Perfecting Body Language(opens in a new tab) Feeling nervous about your interview? This
article details how to have body language that communicates confidence and calmness while you
are interviewing.
Technical Questions
Coding Interview Tips(opens in a new tab) Interview Cake describes easy-to-adopt behaviors
that will help you succeed in the coding interview.
The Coding Interview(opens in a new tab) Palantir's guide on preparing for the coding portion
of your technical interview.
21 Machine Learning Interview Questions and Answers(opens in a new tab) Here are some
sample questions from EliteData Science to help keep your mind in shape.
More Practice!
LeetCode(opens in a new tab) LeetCode has over 950 practice questions organized by
difficulty, topic, and company.
Interviewing.io(opens in a new tab) Practice interviewing with engineers from top companies,
anonymously.
InterviewBit(opens in a new tab) Practice with coding interview questions asked historically
and get job referrals.
Books
Cracking the Coding Interview(opens in a new tab) This best-selling book from Gayle
Laakmann McDowell offers 189 programming questions and solutions to help you practice
coding and answer technical interview questions with confidence.
Programming Interviews Exposed: Coding Your Way Through the Interview(opens in a
new tab) This popular guide to programming interviews includes code examples, information on
the latest languages, chapters on sorting and design patterns, tips on using LinkedIn, and a
downloadable app to help prepare applicants for the interview.
Elements of Programming Interviews: The Insiders’ Guide(opens in a new tab) This book
from Adnan Aziz, Tsung-Hsien Lee, and Amit Prakash features a great compilation of
programming-related problems for interview prep and general refreshers.