Machine Learning And AI
1.65K subscribers
198 photos
1 video
19 files
351 links
Hi All and Welcome Join our channel for Jobs,latest Programming Blogs, machine learning blogs.
In case any doubt regarding ML/Data Science please reach out to me @ved1104 subscribe my channel
https://youtube.com/@geekycodesin?si=JzJo3WS5E_VFmD1k
Download Telegram
๐——๐—ฎ๐˜๐—ฎ ๐—ฆ๐—ฐ๐—ถ๐—ฒ๐—ป๐—ฐ๐—ฒ ๐—œ๐—ป๐˜๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„ ๐—ค๐˜‚๐—ฒ๐˜€๐˜๐—ถ๐—ผ๐—ป:
How would you extend SVM for multi-class classification?

Two common ways are -

๐—ข๐—ป๐—ฒ-๐˜ƒ๐˜€-๐—ฅ๐—ฒ๐˜€๐˜ (๐—ข๐˜ƒ๐—ฅ) (๐—ผ๐—ฟ ๐—ข๐—ป๐—ฒ-๐˜ƒ๐˜€-๐—”๐—น๐—น)
Each classifier is trained to separate one class from all others. For K classes, OvR builds K SVM models, where each model is trained with the class of interest labeled as positive and all other classes labeled as negative. For a new instance, each classifier outputs a score, and the class with the highest score is chosen as the predicted class.

Pros of OvR -
๐Ÿงค Computationally efficient, especially when there are many classes, as it requires fewer classifiers.
๐Ÿงค Works well when the dataset is large, and class overlap isnโ€™t significant.

Cons of OvR -
๐Ÿ”ป The negative class for each classifier can be a mix of very different classes, which can make the boundary between classes less distinct.
๐Ÿ”ป May struggle with overlapping classes, as it requires each classifier to make broad distinctions between one class and all others.

๐—ข๐—ป๐—ฒ-๐˜ƒ๐˜€-๐—ข๐—ป๐—ฒ (๐—ข๐˜ƒ๐—ข)
This method involves building a separate binary classifier for each pair of classes, resulting in (K(Kโˆ’1))/2 classifiers for K classes. Each classifier learns to distinguish between just two classes. For classification, each binary classifier votes for a class, and the class with the most votes is selected.

Pros of OvO -
๐Ÿงค Creates simpler decision boundaries, as each classifier only has to separate two classes.
๐Ÿงค Often yields higher accuracy for complex, overlapping classes since it doesn't force each classifier to distinguish between all classes.

Cons of OvO -
๐Ÿ”ป Computationally intensive for large numbers of classes, due to the higher number of classifiers.
๐Ÿ”ป Prediction time can be slower as it requires voting among all classifiers, which can be significant if there are many classes.

๐—–๐—ต๐—ผ๐—ผ๐˜€๐—ถ๐—ป๐—ด ๐—•๐—ฒ๐˜๐˜„๐—ฒ๐—ฒ๐—ป ๐—ข๐˜ƒ๐—ฅ ๐—ฎ๐—ป๐—ฑ ๐—ข๐˜ƒ๐—ข
The choice between OvR and OvO depends largely on the specific dataset characteristics and computational constraints:
๐Ÿ‘‰ If computational resources are limited and the number of classes is high, OvR may be preferred, as it requires fewer classifiers and is faster to train and predict with.
๐Ÿ‘‰ If accuracy is critical and the classes overlap significantly, OvO often performs better since it learns more specialized decision boundaries for each pair of classes.
So what should an entry-level interview experience look like?

Having been on both sides of the process - this format, IMO, is the most effective one

Round 1:
โญ๏ธ 30 minutes LeetCode, 30 minutes SQL
The goal? Understand how candidate approaches the problem - clarifies ambiguity, addresses edge cases, and writes code.
Passing a few test cases is required, but not all.
Better than brute force is required, optimal solution is not.

Round 2:
โญ๏ธ Machine Learning/Statistics and Resume-based
The goal? Make sure they understand basic concepts - bias vs variance, hypothesis testing, cleaning data etc. and how they have approached ML formulation, metric selection and modelling in the past.

Round 3:
โญ๏ธ Hiring Manager (+ senior team member) to review work on resume + culture fit
The goal? For the HM and senior team members to assess if the candidate is a culture fit with the team; To review prior work and see if how they think about solving a data/ML problem would work in the team (or if the person is coachable)
Join our channel for more information like this
Amazon Data Science Interview Question:
In a linear regression model, what are the key assumptions that need to be satisfied for the model to be valid? How would you evaluate whether these assumptions hold in your dataset?

This is also, the most common question I see across companies!

So the assumptions are -

๐—Ÿ๐—ถ๐—ป๐—ฒ๐—ฎ๐—ฟ๐—ถ๐˜๐˜†
The relationship between the independent variables (predictors) and the dependent variable is linear. This means that the effect of each predictor on the outcome is constant and additive.
How to evaluate? - Scatter plots of predictors vs. the dependent variable and residual vs. fitted value plots. You can also use polynomial regression or transformations (log, square root) if non-linearity is detected.
How to fix? - Apply feature transformations (e.g., log, square root, polynomial) or use non-linear models.

๐—ก๐—ผ๐—ฟ๐—บ๐—ฎ๐—น๐—ถ๐˜๐˜† ๐—ผ๐—ณ ๐—˜๐—ฟ๐—ฟ๐—ผ๐—ฟ๐˜€
The residuals are normally distributed, especially for the purpose of conducting statistical tests and constructing confidence intervals.
How to evaluate - Residual autocorrelation plots or the Durbin-Watson test for time-series data. For non-time-series data, this assumption can often be assumed to be satisfied if the data is randomly sampled.
How to fix - Transform the dependent variable (log, box-cox) and/or check for outliers.

๐—›๐—ผ๐—บ๐—ผ๐˜€๐—ฐ๐—ฒ๐—ฑ๐—ฎ๐˜€๐˜๐—ถ๐—ฐ๐—ถ๐˜๐˜† (๐—–๐—ผ๐—ป๐˜€๐˜๐—ฎ๐—ป๐˜ ๐—ฉ๐—ฎ๐—ฟ๐—ถ๐—ฎ๐—ป๐—ฐ๐—ฒ ๐—ผ๐—ณ ๐—˜๐—ฟ๐—ฟ๐—ผ๐—ฟ๐˜€)
The variance of the residuals (errors) is constant across all levels of the independent variables. In other words, the spread of residuals should not increase or decrease as the predicted values increase.
How to evaluate - Plot the residuals against fitted values. If the plot shows a "fan" shape (i.e., increasing or decreasing spread of residuals), you may need to address heteroscedasticity using robust standard errors or a transformation (e.g., log-transformation).
How to fix - Transformation of dependent variable (log, box-cox) or weighted least squares regression can help

๐—ก๐—ผ ๐— ๐˜‚๐—น๐˜๐—ถ๐—ฐ๐—ผ๐—น๐—น๐—ถ๐—ป๐—ฒ๐—ฎ๐—ฟ๐—ถ๐˜๐˜†
The independent variables (predictors) are not highly correlated with each other. High correlation between predictors can lead to multicollinearity, which makes it difficult to determine the individual effect of each predictor on the dependent variable.
How to evaluate - Calculate the Variance Inflation Factor (VIF) for each predictor. If VIF is high, consider removing highly correlated predictors or combining them into a single predictor (e.g., using Principal Component Analysis).
How to fix - Remove or combine correlated predictors, or use regularized regression models like Ridge or Lasso regression.