Data Science Interview Questions 2019
Data Science Interview Questions 2019
2nd floor, S. M. Tower, Above Jijamata bank, near karvenagar Bus Stop, Karvenagar,
Pune-411052.
SSP TECHNOLOGY
Shailesh Sir- Contact No: 9579670950, 9503522733
2. What are the important skills to have in Python with regard to data analysis?
The following are some of the important skills to possess which will come handy when
performing data analysis using Python.
Good understanding of the built-in data types especially lists, dictionaries, tuples, and
sets.
Mastery of N-dimensional NumPy Arrays.
Mastery of Pandas data frames.
Ability to perform element-wise vector and matrix operations on NumPy arrays.
Knowing that you should use the Anaconda distribution and the conda package manager.
Familiarity with Scikit-learn. **Scikit-Learn Cheat Sheet**
Ability to write efficient list comprehensions instead of traditional for loops.
Ability to write small, clean functions (important for any developer), preferably pure
functions that don‟t alter objects.
Knowing how to profile the performance of a Python script and how to optimize
bottlenecks.
The following will help to tackle any problem in data analytics and machine learning.
2nd floor, S. M. Tower, Above Jijamata bank, near karvenagar Bus Stop, Karvenagar,
Pune-411052.
SSP TECHNOLOGY
Shailesh Sir- Contact No: 9579670950, 9503522733
However, there are chances that data is distributed around a central value without any bias to the
left or right and reaches normal distribution in the form of a bell-shaped curve. The random
variables are distributed in the form of a symmetrical bell-shaped curve.
The goal of A/B Testing is to identify any changes to the web page to maximize or increase the
outcome of an interest. A/B testing is a fantastic method for figuring out the best online
promotional and marketing strategies for your business. It can be used to test everything from
website copy to sales emails to search ads
An example of this could be identifying the click-through rate for a banner ad.
7. What do you understand by statistical power of sensitivity and how do you calculate it?
Sensitivity is commonly used to validate the accuracy of a classifier (Logistic, SVM, Random
Forest etc.).
2nd floor, S. M. Tower, Above Jijamata bank, near karvenagar Bus Stop, Karvenagar,
Pune-411052.
SSP TECHNOLOGY
Shailesh Sir- Contact No: 9579670950, 9503522733
Sensitivity is nothing but “Predicted True events/ Total events”. True events here are the events
which were true and model also predicted them as true.
8. What are the differences between over fitting and under fitting?
In statistics and machine learning, one of the most common tasks is to fit a model to a set of
training data, so as to be able to make reliable predictions on general untrained data.
In overfitting, a statistical model describes random error or noise instead of the underlying
relationship. Overfitting occurs when a model is excessively complex, such as having too many
parameters relative to the number of observations. A model that has been overfit has poor
predictive performance, as it overreacts to minor fluctuations in the training data.
Underfitting occurs when a statistical model or machine learning algorithm cannot capture the
underlying trend of the data. Underfitting would occur, for example, when fitting a linear model
to non-linear data. Such a model too would have poor predictive performance.
Python would be the best option because it has Pandas library that provides easy to use
data structures and high-performance data analysis tools.
R is more suitable for machine learning than just text analysis.
Python performs faster for all types of text analytics.
Python vs. R
Cleaning data from multiple sources helps to transform it into a format that data analysts
or data scientists can work with.
Data Cleaning helps to increase the accuracy of the model in machine learning.
It is a cumbersome process because as the number of data sources increases, the time
taken to clean the data increases exponentially due to the number of sources and the
volume of data generated by these sources.
It might take up to 80% of the time for just cleaning data making it a critical part of
analysis task.
2nd floor, S. M. Tower, Above Jijamata bank, near karvenagar Bus Stop, Karvenagar,
Pune-411052.
SSP TECHNOLOGY
Shailesh Sir- Contact No: 9579670950, 9503522733
The bivariate analysis attempts to understand the difference between two variables at a time as in
a scatterplot. For example, analyzing the volume of sale and spending can be considered as an
example of bivariate analysis.
Multivariate analysis deals with the study of more than two variables to understand the effect of
variables on the responses.
For eg., A researcher wants to survey the academic performance of high school students in
Japan. He can divide the entire population of Japan into different clusters (cities). Then the
researcher selects a number of clusters depending on his research through simple or systematic
random sampling.
Let‟s continue our Data Science Interview Questions blog with some more statistics questions.
Eigenvalue can be referred to as the strength of the transformation in the direction of eigenvector
or the factor by which the compression occurs.
2nd floor, S. M. Tower, Above Jijamata bank, near karvenagar Bus Stop, Karvenagar,
Pune-411052.
SSP TECHNOLOGY
Shailesh Sir- Contact No: 9579670950, 9503522733
15. Can you cite some examples where a false positive is important than a false negative?
Let us first understand what false positives and false negatives are.
False Positives are the cases where you wrongly classified a non-event as an event a.k.a
Type I error.
False Negatives are the cases where you wrongly classify events as non-events, a.k.a
Type II error.
Example 1: In the medical field, assume you have to give chemotherapy to patients. Assume a
patient comes to that hospital and he is tested positive for cancer, based on the lab prediction but
he actually doesn‟t have cancer. This is a case of false positive. Here it is of utmost danger to
start chemotherapy on this patient when he actually does not have cancer. In the absence of
cancerous cell, chemotherapy will do certain damage to his normal healthy cells and might lead
to severe diseases, even cancer.
Example 2: Let‟s say an e-commerce company decided to give $1000 Gift voucher to the
customers whom they assume to purchase at least $10,000 worth of items. They send free
voucher mail directly to 100 customers without any minimum purchase condition because they
assume to make at least 20% profit on sold items above $10,000. Now the issue is if we send the
$1000 gift vouchers to customers who have not actually purchased anything but are marked as
having made $10,000 worth of purchase.
16. Can you cite some examples where a false negative important than a false positive?
Example 1: Assume there is an airport „A‟ which has received high-security threats and based on
certain characteristics they identify whether a particular passenger can be a threat or not. Due to
a shortage of staff, they decide to scan passengers being predicted as risk positives by their
predictive model. What will happen if a true threat customer is being flagged as non-threat by
airport model?
Example 3: What if you rejected to marry a very good person based on your predictive model
and you happen to meet him/her after a few years and realize that you had a false negative?
17. Can you cite some examples where both false positive and false negatives are equally
important?
In the Banking industry giving loans is the primary source of making money but at the same
time if your repayment rate is not good you will not make any profit, rather you will risk huge
losses.
2nd floor, S. M. Tower, Above Jijamata bank, near karvenagar Bus Stop, Karvenagar,
Pune-411052.
SSP TECHNOLOGY
Shailesh Sir- Contact No: 9579670950, 9503522733
Banks don‟t want to lose good customers and at the same point in time, they don‟t want to
acquire bad customers. In this scenario, both the false positives and false negatives become very
important to measure.
18. Can you explain the difference between a Validation Set and a Test Set?
A Validation set can be considered as a part of the training set as it is used for parameter
selection and to avoid over fitting of the model being built.
On the other hand, a Test Set is used for testing or evaluating the performance of a trained
machine learning model.
In simple terms, the differences can be summarized as; training set is to fit the parameters i.e.
weights and test set is to assess the performance of the model i.e. evaluating the predictive power
and generalization.
The goal of cross-validation is to term a data set to test the model in the training phase (i.e.
validation data set) in order to limit problems like over fitting and get an insight on how the
model will generalize to an independent data set.
Algorithms: Support Vector Machines, Regression, Naive Bayes, Decision Trees, K-nearest
Neighbor Algorithm and Neural Networks
E.g. If you built a fruit classifier, the labels will be “this is an orange, this is an apple and this is a
banana”, based on showing the classifier examples of apples, oranges and bananas.
2nd floor, S. M. Tower, Above Jijamata bank, near karvenagar Bus Stop, Karvenagar,
Pune-411052.
SSP TECHNOLOGY
Shailesh Sir- Contact No: 9579670950, 9503522733
Algorithms: Clustering, Anomaly Detection, Neural Networks and Latent Variable Models
24. What is logistic regression? State an example when you have used logistic regression
recently.
Logistic Regression often referred as logit model is a technique to predict the binary outcome
from a linear combination of predictor variables.
For example, if you want to predict whether a particular political leader will win the election or
not. In this case, the outcome of prediction is binary i.e. 0 or 1 (Win/Lose). The predictor
variables here would be the amount of money spent for election campaigning of a particular
candidate, the amount of time spent in campaigning, etc.
2nd floor, S. M. Tower, Above Jijamata bank, near karvenagar Bus Stop, Karvenagar,
Pune-411052.
SSP TECHNOLOGY
Shailesh Sir- Contact No: 9579670950, 9503522733
An example of collaborative filtering can be to predict the rating of a particular user based on
his/her ratings for other movies and others‟ ratings for all movies. This concept is widely used in
recommending movies in IMDB, Netflix & BookMyShow, product recommenders in e-
commerce sites like Amazon, eBay & Flipkart, YouTube video recommendations and game
recommendations in Xbox.
2nd floor, S. M. Tower, Above Jijamata bank, near karvenagar Bus Stop, Karvenagar,
Pune-411052.
SSP TECHNOLOGY
Shailesh Sir- Contact No: 9579670950, 9503522733
All extreme values are not outlier values. The most common ways to treat outlier values
If there are no patterns identified, then the missing values can be substituted with mean or
median values (imputation) or they can simply be ignored. Assigning a default value which can
be mean, minimum or maximum value. Getting into the data is important.
If it is a categorical variable, the default value is assigned. The missing value is assigned a
default value. If you have a distribution of data coming, for normal distribution give the mean
value. If 80% of the values for a variable are missing then you can answer that you would be
dropping the variable instead of treating the missing values.
31. How will you define the number of clusters in a clustering algorithm?
Though the Clustering Algorithm is not specified, this question is mostly in reference to K-
Means clustering where “K” defines the number of clusters. The objective of clustering is to
2nd floor, S. M. Tower, Above Jijamata bank, near karvenagar Bus Stop, Karvenagar,
Pune-411052.
SSP TECHNOLOGY
Shailesh Sir- Contact No: 9579670950, 9503522733
group similar entities in a way that the entities within a group are similar to each other but the
groups are different from each other.
Within Sum of squares is generally used to explain the homogeneity within a cluster. If you plot
WSS for a range of number of clusters, you will get the plot shown below.
This is the widely used approach but few data scientists also use Hierarchical clustering first to
create dendrograms and identify the distinct groups from there.
2nd floor, S. M. Tower, Above Jijamata bank, near karvenagar Bus Stop, Karvenagar,
Pune-411052.
SSP TECHNOLOGY
Shailesh Sir- Contact No: 9579670950, 9503522733
Now that we have seen the Machine Learning Questions, Let‟s continue our Data Science
Interview Questions blog with some Probability questions.
32. In any 15-minute interval, there is a 20% probability that you will see at least one
shooting star. What is the probability that you see at least one shooting star in the period of
an hour?
Probability of not seeing any shooting star in 15 minutes is
Probability of not seeing any shooting star in the period of one hour
= (0.8) ^ 4 = 0.4096
33. How can you generate a random number between 1 – 7 with only a die?
Any die has six sides from 1-6. There is no way to get seven equal outcomes from a
single rolling of a die. If we roll the die twice and consider the event of two rolls, we now
have 36 different outcomes.
To get our 7 equal outcomes we have to reduce this 36 to a number divisible by 7. We
can thus consider only 35 outcomes and exclude the other one.
A simple scenario can be to exclude the combination (6,6), i.e., to roll the die again if 6
appears twice.
All the remaining combinations from (1,1) till (6,5) can be divided into 7 parts of 5 each.
This way all the seven sets of outcomes are equally likely.
34. A certain couple tells you that they have two children, at least one of which is a girl.
What is the probability that they have two girls?
In the case of two children, there are 4 equally likely possibilities
Where B = Boy and G = Girl and the first letter denotes the first child.
2nd floor, S. M. Tower, Above Jijamata bank, near karvenagar Bus Stop, Karvenagar,
Pune-411052.
SSP TECHNOLOGY
Shailesh Sir- Contact No: 9579670950, 9503522733
From the question, we can exclude the first case of BB. Thus from the remaining 3 possibilities
of BG, GB & BB, we have to find the probability of the case with two girls.
35. A jar has 1000 coins, of which 999 are fair and 1 is double headed. Pick a coin at
random, and toss it 10 times. Given that you see 10 heads, what is the probability that the
next toss of that coin is also a head?
There are two ways of choosing the coin. One is to pick a fair coin and the other is to pick the
one with two heads.
Selecting 10 heads in a row = Selecting fair coin * Getting 10 heads + Selecting an unfair coin
36. What do you mean by Deep Learning and why has it become popular now?
Deep Learning is nothing but a paradigm of machine learning which has shown incredible
promise in recent years. This is because of the fact that Deep Learning shows a great analogy
with the functioning of the human brain.
Now although Deep Learning has been around for many years, the major breakthroughs from
these techniques came just in recent years. This is because of two main reasons:
GPUs are multiple times faster and they help us build bigger and deeper deep learning models in
comparatively less time than we required previously
2nd floor, S. M. Tower, Above Jijamata bank, near karvenagar Bus Stop, Karvenagar,
Pune-411052.
SSP TECHNOLOGY
Shailesh Sir- Contact No: 9579670950, 9503522733
A gradient measures how much the output of a function changes if you change the inputs a little
bit. It simply measures the change in all weights with regard to the change in error. You can also
think of a gradient as the slope of a function.
Gradient Descent can be thought of climbing down to the bottom of a valley, instead of
climbing up a hill. This is because it is a minimization algorithm that minimizes a given function
(Activation Function).
2nd floor, S. M. Tower, Above Jijamata bank, near karvenagar Bus Stop, Karvenagar,
Pune-411052.
SSP TECHNOLOGY
Shailesh Sir- Contact No: 9579670950, 9503522733
Stochastic Gradient Descent: We use only single training example for calculation of
gradient and update parameters.
Batch Gradient Descent: We calculate the gradient for the whole dataset and perform
the update at each iteration.
Mini-batch Gradient Descent: It‟s one of the most popular optimization algorithms. It‟s
a variant of Stochastic Gradient Descent and here instead of single training example,
mini-batch of samples is used.
Pytorch
TensorFlow
Microsoft Cognitive Toolkit
Keras
Caffe
Chainer
2nd floor, S. M. Tower, Above Jijamata bank, near karvenagar Bus Stop, Karvenagar,
Pune-411052.
SSP TECHNOLOGY
Shailesh Sir- Contact No: 9579670950, 9503522733
2nd floor, S. M. Tower, Above Jijamata bank, near karvenagar Bus Stop, Karvenagar,
Pune-411052.