Thursday, August 12, 2021

Data Science Interview Questions - Part-1

 Q1. What is Data Science? List the differences between supervised and unsupervised learning?

Ans. Data Science is a blend of various tools, algorithms, and machine learning principles with the goal to discover hidden patterns from the raw data. How is this different from what statisticians have been doing for years? The answer lies in the difference between explaining and predicting.

The differences between supervised and unsupervised learning are as follows;


Q2. What is Selection Bias?

Ans. Selection bias is a kind of error that occurs when the researcher decides who is going to be studied. It is usually associated with research where the selection of participants isn’t random. It is sometimes referred to as the selection effect. It is the distortion of statistical analysis, resulting from the method of collecting samples. If the selection bias is not taken into account, then some conclusions of the study may not be accurate. 

 The types of selection bias include: 

 1. Sampling bias: It is a systematic error due to a non-random sample of a population causing some members of the population to be less likely to be included than others resulting in a biased sample. 

 2. Time interval: A trial may be terminated early at an extreme value (often for ethical reasons), but the extreme value is likely to be reached by the variable with the largest variance, even if all variables have a similar mean. Follow Steve Nouri for more AI and Data science posts: https://lnkd.in/gZu463X

 3. Data: When specific subsets of data are chosen to support a conclusion or rejection of bad data on arbitrary grounds, instead of according to previously stated or generally agreed criteria.

 4. Attrition: Attrition bias is a kind of selection bias caused by attrition (loss of participants) discounting trial subjects/tests that did not run to completion.


Q3. What is bias-variance trade-off?

Ans. Bias: Bias is an error introduced in your model due to oversimplification of the machine learning algorithm. It can lead to underfitting. When you train your model at that time model makes simplified assumptions to make the target function easier to understand. 

 Low bias machine learning algorithms — Decision Trees, k-NN and SVM High bias machine learning algorithms — Linear Regression, Logistic Regression. 

 Variance: Variance is error introduced in your model due to complex machine learning algorithm, your model learns noise also from the training data set and performs badly on test data set. It can lead to high sensitivity and overfitting. 

 Normally, as you increase the complexity of your model, you will see a reduction in error due to lower bias in the model. However, this only happens until a particular point. As you continue to make your model more complex, you end up over-fitting your model and hence your model will start suffering from high variance.

Bias-Variance trade-off: The goal of any supervised machine learning algorithm is to have low bias and low variance to achieve good prediction performance. 

1. The k-nearest neighbour algorithm has low bias and high variance, but the trade-off can be changed by increasing the value of k which increases the number of neighbours that contribute to the prediction and in turn increases the bias of the model. 

2. The support vector machine algorithm has low bias and high variance, but the trade-off can be changed by increasing the C parameter that influences the number of violations of the margin allowed in the training data which increases the bias but decreases the variance.



Q4. What is a confusion matrix? 

Ans. The confusion matrix is a 2X2 table that contains 4 outputs provided by the binary classifier. Various measures, such as error-rate, accuracy, specificity, sensitivity, precision and recall are derived from it. Confusion Matrix


A data set used for performance evaluation is called a test data set. It should contain the correct labels and predicted labels. 


The predicted labels will exactly the same if the performance of a binary classifier is perfect.


The predicted labels usually match with part of the observed labels in real-world scenarios.
  


A binary classifier predicts all data instances of a test data set as either positive or negative. This produces four outcomes-
1. True-positive(TP) — Correct positive prediction 
 2. False-positive(FP) — Incorrect positive prediction 
 3. True-negative(TN) — Correct negative prediction 
 4. False-negative(FN) — Incorrect negative prediction 


Basic measures derived from the confusion matrix 
1. Error Rate = (FP+FN)/(P+N) 
 2. Accuracy = (TP+TN)/(P+N) 
 3. Sensitivity(Recall or True positive rate) = TP/P
 4. Specificity(True negative rate) = TN/N 
 5. Precision(Positive predicted value) = TP/(TP+FP) 
 6. F-Score(Harmonic mean of precision and recall) = (1+b)(PREC.REC)/(b²PREC+REC) where b is commonly 0.5, 1, 2.

Q5. What is the difference between “long” and “wide” format data?
Ans. In the wide-format, a subject’s repeated responses will be in a single row, and each response is in a separate column. In the long-format, each row is a one-time point per subject. You can recognize data in wide format by the fact that columns generally represent groups.


Q6. What do you understand by the term Normal Distribution? 

Ans. Data is usually distributed in different ways with a bias to the left or to the right or it can all be jumbled up.

 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.

 Properties of Normal Distribution are as follows; 
1. Unimodal -one mode  
2. Symmetrical -left and right halves are mirror images 
 3. Bell-shaped -maximum height (mode) at the mean 
 4. Mean, Mode, and Median are all located in the center 
 5. Asymptotic

Q7. What is correlation and covariance in statistics?

Ans. Covariance and Correlation are two mathematical concepts; these two approaches are widely used in statistics. Both Correlation and Covariance establish the relationship and also measure the dependency between two random variables. Though the work is similar between these two in mathematical terms, they are different from each other.



Correlation: Correlation is considered or described as the best technique for measuring and also for estimating the quantitative relationship between two variables. Correlation measures how strongly two variables are related. 

 Covariance: In covariance two items vary together and it’s a measure that indicates the extent to which two random variables change in cycle. It is a statistical term; it explains the systematic relation between a pair of random variables, wherein changes in one variable reciprocal by a corresponding change in another variable. 

Q8. What is the difference between Point Estimates and Confidence Interval? 

Ans.  Point Estimation gives us a particular value as an estimate of a population parameter. Method of Moments and Maximum Likelihood estimator methods are used to derive Point Estimators for population parameters. 

 A confidence interval gives us a range of values which is likely to contain the population parameter. The confidence interval is generally preferred, as it tells us how likely this interval is to contain the population parameter. This likeliness or probability is called Confidence Level or Confidence coefficient and represented by 1 — alpha, where alpha is the level of significance.

Q9. What is the goal of A/B Testing?

Ans. It is a hypothesis testing for a randomized experiment with two variables A and B. 

 The goal of A/B Testing is to identify any changes to the web page to maximize or increase the outcome of 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.

Q10. What is p-value?

Ans. When you perform a hypothesis test in statistics, a p-value can help you determine the strength of your results. p-value is a number between 0 and 1. Based on the value it will denote the strength of the results. The claim which is on trial is called the Null Hypothesis. 

 Low p-value (≤ 0.05) indicates strength against the null hypothesis which means we can reject the null Hypothesis. High p-value (≥ 0.05) indicates strength for the null hypothesis which means we can accept the null Hypothesis p-value of 0.05 indicates the Hypothesis could go either way. To put it in another way.

 High P values: your data are likely with a true null. Low P values: your data are unlikely with a true null.


No comments:

Post a Comment