top of page

Most Commonly Asked FAANG Interview Concepts - Part 3


Hi All!! Hope you had a great weekend. This post is related to the part 3 of the FAANG interview concepts series. Previously we looked into several topics related to overfitting, decision tress, SVMs, etc in the Part 1 and Part 2 of the series. Without further ado, lets see today interviews concepts:


1. What is the use of regularization? what are the differences between L1 and L2 regularization?


Regularization is one of the most important concepts of machine learning. It is a technique to prevent the model from overfitting by adding extra information to it.

Both L1 and L2 regularization are methods used to reduce the overfitting of the training data.

L2 Regularization, also called as Ridge Regression, minimizes the sum of squared residuals plus lambda times the slope squared. the additional term is called the Ridge regression. This increases the bias of the model, making the fit worse on the training data, but also decrease the variance.

L1 regularization, also called as Lasso Regression, is only different from L2 if we replace the regression penality to the absolute value of the slope.

Differences:

1. L2 is less robust but has stable and one solution wshereas L1 is more robust but has an unstable and mulitple solutions.

2. L1 regularization tries to estimate the median of the data while the L2 regularization tries to estimate the mean of the data to avoid overfitting.


2. We have two options for serving ads within the newsfeed. Option1: 1 out of every 25 stories, one will be ad. Option 2: every story has a 4% chance of being an ad. For each option, what is the expected number of ads shown in 100 news stories.


The expected number of odds for both options is 44 out 100.

For Option 1, 1/25 i equivalent to 4/100

For option 2, 4% of 100 is 4/100


3. How do you prove that males are on average taller than females by knowing just gender height?


The method used to answer this question is 'Hypothesis Testing'. The null hypothesis would be that males and females are the same height in average, while the alternative hypothesis would be that the average height of males is greater than females. the next step would be to collect a random sample of heights of males and females and use a t-test to determine if you reject the null hypothesis or not.



4. How would you design an experiment for a new feature we are thinking about. What metrics would matter?


To experiment if the nw feature is good enough, we should conduct an A/B test. A/B test is used to determine if the introduction of the new feature results in a statistically significant improvement in a given metric that is of importance. The metrics chosen depends on the goal if th feature. For example, a feature may be intrduced to increase conversion rates or web traffic.

Step 1: Formulate the null hypothesis and alternate hypothesis.

Step 2: Create a control group and test group through random sampling.

Step 3: After data collection, depending upon the data, we should conduct a t-test, chi-squared test or bayesian A/B test to detemine the diffrence between the control and test group and whether they are statistically significant.



5. How can you tell if a give coin is biased?


The answer is to perform a hypothesis testing:

Step 1: The null hypothesis is that the coin is not biased and the probability of flipping heads should be equal 50% (p=0.5). The alternate hypothesis is that the coin is biased and p = 0.5

Step 2: Flip the coin 500 times.

Step 3: Calculate the Z-score (Note: if the sample is less than 30, you would calculate the t-statistics)

Step 4: Compare against alpha two tailed t-test 0.05/2 = 0.025

Step 5: If the p-value is greater than alpha, the null is not rejected and the coin is not biased , if the p-value is less than alpha, the null is rejected and the coin is biased.



Resources:

FAANG Interview Concepts series:


Part 1 and Part 2 of the series.

Comments


bottom of page