Table of Contents
Machine learning and modeling interview questions cover some of the most basic fundamentals in data science. Given that it’s a rapidly evolving field, machine learning is almost always in need of updates. Therefore, as a data scientist, it’s important to keep up with the latest trends and technologies that are constantly being released.
Modeling interview questions and the machine learning interview are many times an abstraction for testing a candidate’s experience in the field, as well as determining to what degree a data scientist or machine learning engineer can critically apply theory towards a business goal.
As we go through each framework, interview question, and machine learning concept, it’s worth remembering that machine learning and modeling interview questions are ultimately indicative of two things:
- A candidate’s past experience working with machine learning.
- The capacity to memorize concepts and apply them towards solutions the interviewer is looking for.
How much machine learning do I need to know?
This is the most repetitive question that I have gotten ever since starting Interview Query. Why do you think that is? Because there is an infinite amount of knowledge you can consume in machine learning.
Literally infinite. The very definition of machine learning and AI conceptualizes this fact.
Machine learning is a technology that is breaking ground every day. Technically, it should be improving faster and faster, given that machine learning and artificial intelligence is essentially supposed to be learning itself.
However, machine learning tested in an interview is completely different from how it is generally framed in real practice. It is also different depending on the type of role that you’re interviewing for.
A data scientist is not expected to know the same level of knowledge necessary for machine learning compared to a machine learning engineer or research scientist. This varying expectation, however, can be confounded by what the employer thinks a data scientist does versus a machine learning engineer, such as a case where the role is titled data scientist, but the position is instead designed for building machine learning infrastructure the whole time.
Let’s look at how much each role and position needs to know about machine learning interview questions.
The data scientist role is primarily responsible for solving business problems using data to pull, munge, and generate insights from data. Data scientists will explore all aspects of the business and work cross-functionally with different teams to do everything from developing dashboards for reporting and exploring analytics for insights, to building models.
The last part of building models is tricky in determining how much machine learning a data scientist should know. Many data science roles that are focused on analytics don’t require any machine learning at all, while some roles are essentially machine learning engineers with a data scientist title. Generally, the main way to understand the difference is to ask everyone at the company about the day-to-day responsibilities of the role that you’re interviewing for.
For example, if we look at the Facebook Data Scientist role, we won't see much machine learning tested in their interview.
But if we compare it with the data science role for C3.ai and we see a huge emphasis on machine learning.
Machine Learning Engineers and Data Engineers
Engineers build models and deploy them, develop infrastructure to scale, and work with data scientists to understand the best-use cases. They leverage data tools, programming frameworks, and data pipelines to ensure that models scale appropriately for any technical specifications.
Machine learning engineers should also have a strong knowledge of machine learning and theory, given their responsibility for building tooling and automation over the model creation, training, and evaluation life cycle.
Regular software engineers aren't expected to know too much about machine learning. But data engineers will likely need to know how to scale up data infrastructure alongside the machine learning engineers so that the models can retrieve and output the correct data points.
Research Scientists and AI Researchers
Research scientists are typically roles meant for teams to break new ground with machine learning in the research domain. The level of machine learning and statistics knowledge needed is usually very high.
Given these three roles, the best way to estimate how much machine learning knowledge is needed for the interview would be to first understand how embedded in machine learning your job will be. This is done with individual research on the company, position, team, and background information of your interview panel.
Machine Learning Interview Questions and Concepts
Machine learning interview questions follow a couple of patterns. While they can seem abstract and overwhelming, we can break them down into six types of situational problems and case studies.
Modeling and Machine Learning Case Study Interview
The modeling case study requires a candidate to evaluate and explain a particular part of the model building process. A common case study problem would be for a candidate to explain how they would build a model for a product that exists at the company.
Example Question: Describe how you would build a model to predict Uber ETAs after a rider requests a ride.
Many times, this can be scoped down into a specific portion of the model building process. For instance, taking the example above, we could instead reword the problem to:
- How would you evaluate the predictions of an Uber ETA model?
- What features would you use to predict the Uber ETA for ride requests?
The main point of these case questions is to determine your knowledge of the full modeling lifecycle and how you would apply it to a business scenario.
We want to approach the case study with an understanding of what the machine learning & modeling lifecycle should look like from beginning to end, as well as creating a structured format to make sure we’re delivering a solution that explains our thought process thoroughly.
For the machine learning lifecycle, we have around six different steps that we should touch on from beginning to end:
- Data Exploration & Pre-Processing
- Feature Selection & Engineering
- Model Selection
- Cross Validation
- Evaluation Metrics
- Testing and Roll Out
Try a machine learning case question on Interview Query: Bank Fraud Model
Let's say that you work at a bank that wants to build a model to detect fraud on the platform.
The bank wants to implement a text messaging service in addition that will text customers when the model detects a fraudulent transaction in order for the customer to approve or deny the transaction with a text response.
How would we build this model?
Read more about how to frame a machine learning case study in our interview course.
Check out a mock machine learning case study interview asked by Uber.
Recommendation and Search Engines Interview Questions
Recommendation and search engines are questions that are technically case study questions but are asked so frequently that it’s important to conceptualize them into their own category.
- How would you build a recommendation engine to recommend news to users on Google?
- How would you evaluate a new search engine that your co-worker built?
Most strategies for tackling recommendation and search engines are to:
- Understand how they are built and what underlying machine learning algorithms they use.
- Learn how to effectively deploy the recommendation and search algorithm.
- Communicate how to measure their performance and improve their training abilities.
Try out solving a recommendation feed interview question asked by LinkedIn: Job Recommendations
Let's say that you're working on a job recommendation engine. You have access to all user Linkedin profiles, a list of jobs each user applied to, and answers to questions that the user filled in about their job search.
Using this information, how would you build a job recommendation feed?
Machine Learning Algorithms Interview Questions
These types of questions exist to get an in-depth understanding of your conceptual knowledge of machine learning. Companies ask these questions mostly to machine learning and deep learning specialists that would be focusing on the specific building and training of a machine learning model.
These types of questions would be something akin to “How does random forest generate trees?” or “What’s the difference between SVM and Gradient Boosting Trees?”.
For example, a common question asked within the machine learning algorithms interview questions is on the bias/variance tradeoff.
What is bias in a model? Bias is the amount our predictions are systematically off from the target. Bias is the measure of how “inflexible” the model is.
What is variance in a model? Variance is the measure of how much the prediction would vary if the model was trained on a different dataset, drawn from the same population. Can be also thought of as the “flexibility” of the model.
Generally, what happens to bias & variance as we increase the complexity of the model? Bias decreases and variance increases
Try out solving a machine learning algorithms interview question asked by Airbnb: Booking Regression
It’s clear that these questions are meant to test if candidates understand the situations in which they would apply different types of models. They’re also mostly definition based questions, so if you memorize a bunch of different machine learning definitions and applications, you will usually do okay in this part.
Applied Modeling Interview Questions
Applied modeling questions take machine learning concepts and ask how they could be applied to fix a certain problem. These questions are a little more nuanced, require more experience, but are great litmus tests of modeling and machine learning knowledge.
An example question would be: You’re given a model with 90% accuracy, should you deploy it?.
These types of questions are similar to case studies in that they are mostly ambiguous, require more contextual knowledge and information gathering from the interviewer, and are used to really test your understanding in a certain area of machine learning.
Try an example modeling interview question from Zillow: Missing Housing Data
We want to build a model to predict housing prices in the city of Seattle. We've scraped 100K sold listings over the past three years but found that around 20% of the listings are missing square footage data.
How do we deal with the missing data to construct our model?
Machine Learning System Design
Machine learning system design interview questions comprise of higher level design and architecture of recommendation systems, deploying machine learning models, and concepts on scaling these systems. At its core, machine learning system design problems are understanding how to solve the problem of deploying machine learning models that will work for all aspects of business requirements.
- How would you build Twitter-style social media feed to display relevant posts to users?
- Build an advertising bidding system that presents personalized ads to users
- Design an machine learning system that can identify fraudulent transactions.
Preparing for the machine learning system design interview requires understanding a multi-step process of:
- Setting the problem statement.
- Architecting the high-level infrastructure.
- Explaining how data moves from one part to the next.
- Understand how to measure performance of the machine learning models.
- Deal with common problems around scale, reliability, and deployment.
Try the machine learning system design problem asked by Netflix on Interview Query: Type-Ahead Search
How would you build the recommendation algorithm for type-ahead search for Netflix?
Python Machine Learning Interview Questions
Coding machine learning algorithms are increasingly becoming more common on interviews. These questions are framed around deriving machine learning algorithms encapsulated on sci-kit learn or other packages from scratch.
The interviewer is mainly testing a raw understanding of coding optimizations, performance, and memory on existing machine learning algorithms. Additionally this would be testing if the candidate REALLY understood the underlying algorithm if they could build it without using anything but the Numpy Python package.
Generally these type of machine learning interview questions are pretty controversial. They're hard to do within a specific timeframe and generally pretty vague in how they're graded.
Write a function to build K-NN from scratch on a sample input of a list of lists of integers.
Machine Learning Interview Questions and Answers
Here are some quick machine learning concepts to review before your next interview.
If you'd like a full list of real machine learning and modeling interview questions from top tech companies, check out the full questions database on Interview Query with machine learning, product, SQL, and coding questions.
Practice Real Machine Learning Questions
Machine Learning Concepts Review
What is regularization?
Regularization is the act of modifying our objective function by adding a penalty term, to reduce overfitting.
Which regularization method would you prefer to treat correlated variables? Why?
Typically, we should prefer the regularization method that would drive feature coefficients to remove correlated features. LASSO could work here, however, if the data has a lot of features relative to the data size, then elastic net may be better.
Describe different regularization methods
L2 Regularization minimizes the sum of the squared residuals plus lambda times the slope squared. This is called the Ridge Regression Penalty. This increases the bias of the model, making the fit worse on the training data, but also decreases the variance.
What is gradient descent?
Gradient descent is a method of minimizing the cost function. The form of the cost function will depend on the type of supervised model. When optimizing our cost function, we compute the gradient to find the direction of steepest ascent. To find the minimum, we need to continuously update our Beta, proportional to the steps of the steepest gradient.
What is the difference between a parametric learning algorithm vs non-parametric learning algorithm?
A parametric learning algorithm has a finite set of parameters the learning algorithm estimates.
A non-parametric learning algorithm has a non-finite set of parameters. This means, that as the dataset grows, the learning algorithm can estimate more and more parameters from the dataset.
How do you interpret Linear Regression coefficients?
Interpreting Linear Regression coefficients is much simpler than Logistic Regression. The regression coefficient signifies how much the mean of the dependent variable changes, given a one-unit shift in that variable, holding all variables constant.
What is Maximum Likelihood Estimation?
Maximum Likelihood Estimation is where we find the distribution that is most likely to have generated the data. To do this, we have to estimate the parameter theta, that maximizes the the likelihood function evaluated at x. P(data | X)
What is Linear Discriminant Analysis?
LDA is a predictive modeling algorithm for multi-class classification. LDA will compute the directions that will represent the axes that maximize the separation between classes.
What's the difference between precision and recall?
Recall: What proportion of actual positives was identified correctly?
Precision: What proportion of positive identifications was actually correct?
What is the intuition behind F1 score?
The intuition is that we’re taking the harmonic mean between precision/recall. In a scenario where classes are imbalance, we’re likely to have either precision extremely high or recall extremely low, or vice-versa. As a result, this will be reflected in our F1 score, since the lower of the two metrics should drag the F1 score down.
Explain what Glove embeddings are.
Rather than use contextual words, we calculate a co-occurrence matrix of all words. Glove will also take local contexts into account, per a fixed window size, then calculate the covariance matrix. Then, we predict the co-occurence ratio between the words in the neural network.
GloVe will learn this matrix and train word vectors that predict co-occurrence ratios. Loss is weighted by word frequency.
If you have a machine learning interview coming up, check out our machine learning course on Interview Query!