1. What is the difference between inductive machine learning and deductive machine learning ? (machine learning interview questions and answers)
In inductive machine learning, the model learns by examples from a set of observed instances to draw a generalized conclusion whereas in deductive learning the model first draws the conclusion and then the conclusion is drawn. Let’s understand this with an example, for instance, if you have to explain to a kid that playing with fire can cause burns. There are two ways you can explain this to kids, you can show them training examples of various fire accidents or images with burnt people and label them as “Hazardous”. In this case the kid will learn with the help of examples and not play with fire. This is referred to as Inductive machine learning. The other way is to let your kid play with fire and wait to see what happens. If the kid gets a burn they will learn not to play with fire and whenever they come across fire, they will avoid going near it. This is referred to as deductive learning.
( machine learning interview questions and answers )
2. Why is Harmonic mean used to calculate F1 score and not arithmetic mean ?
Because the Harmonic mean gives more weightage to lower values. Thus, we will only get high F1 score if both Precision and Recall are higher.
3. Does 100% precision mean that our model predicts all the values correctly ?
No. We can get perfect precision in many ways, but it doesn’t mean that our model predicts every value accurately. For ex. if we make one single positive prediction and make sure it is correct, our precision reaches 100%. Generally, precision is used with other metrics (recall) to measure the performance.
4. What are the similarities & difference between machine learning and human learning ?
Machine learning and human learning actually quite similar. Machine learning is about an algorithm or computer. Actually engaging with its environment with data and adopting a coding too on the things that it learns. Let us suppose a program fails to make the right predictions & it will balance itself in some sense. In order to make better predictions next time. Now, That is very similar the way human learns. Human is actually engaging with its environment & learning from it. So, Machine learning has an aspect of kind of an evolutionary aspect to it. Which I think quite new to the area of this artificial intelligence.
5. How to decide one problem is a machine learning problem or not ?
When you are analyzing a problem. If that problem consisting patterns and that pattern we can’t extract from mathematical equations. If you found such kind of problem then we need to use machine learning to extract those pattern by using lots of data. These above key features are helpful to predict whether the problem is a machine learning problem or not.
Example:– We need to find whether the number is even or odd. This example seems very simple. Yes, this problem is very simple because we know the logic to find whether a number is odd or even and we also know about the mathematics behind this problem. Let us suppose the number is divided by 2. Then the remainder is 1 then we call that number is odd. Whether the remainder is 0 then we call that number as an even. So, this problem has some pattern but we can solve through mathematical equations. do not need a lot of data also. So, definitely, this is not a machine learning problem. Till now this is not a machine learning problem but if you want to make it as a machine learning problem. We can do one thing. We can feed lots of data as an individual number by telling the number is odd the number is even. The machine will classify whether the number is even or odd. But as we know logic and mathematics behind this problem this problem can’t come under as a machine learning problem.
Example1:- Let’s say you have a lot of photos or images. We need to find whether particular photo contains human face or not. Here there is a pattern that we need to find human across all the photos. Can we solve this problem through mathematical equations? So, it’s very difficult. SImply we can take this lot of data and we can feed this data to the algorithm as a training data. Which means training the machine using this data. After this training, we will get some mathematical equations based on the patterns that we got from training. But humans can’t write this logic as their own. So Definitely, this is a machine learning problem. Here machine will automatically form a rule based on training data. That rule is nothing but to detect whether the photo contains human face or not.
6. What is AdaGrad algorithm in machine learning ?
A sophisticated gradient descent algorithm that rescales the gradients of each parameter, effectively giving each parameter an independent learning rate.
7. What is a binary classification in machine learning ?
A type of classification task that outputs one of two mutually exclusive classes. For example, a machine learning model that evaluates email messages and outputs either “spam” or “not spam” is a binary classifier.
8. What is Rectified Linear Unit (ReLU) in Machine learning ?
An activation function with the following rules:
If input is negative or zero, output is 0.
If input is positive, output is equal to input.
machine learning interview questions and answers
9. Explain what is the function of ‘Unsupervised Learning ?
Find clusters of the data
Find low-dimensional representations of the data
Find interesting directions in data
Interesting coordinates and correlations
Find novel observations/ database cleaning
10. Why over fitting happens ?
The possibility of overfitting happens as the criteria used for training the model is not the same as the criteria used to judge the efficiency of a model.
11. What is a recommendation system?
Anyone who has used Spotify or shopped at Amazon will recognize a recommendation system: It’s an information filtering system that predicts what a user might want to hear or see based on choice patterns provided by the user.
12. Explain what is precision and Recall?
It is known as a true positive rate. The number of positives that your model has claimed compared to the actual defined number of positives available throughout the data.
It is also known as a positive predicted value. This is more based on the prediction. It is a measure of a number of accurate positives that the model claims when compared to the number of positives it actually claims.
13. Pick an algorithm and write a Pseudo code for the same ?
This question depicts your understanding of the algorithm. This is something that one has to be very creative and also should have in-depth knowledge about the algorithms and first and foremost the individual should have a good understanding of the algorithms. Best way to answer this question would be start off with Web Sequence Diagrams.
14. List out some important methods of reducing dimensionality?
Combine features with feature engineering.
Use some form of algorithmic dimensionality reduction like ICA or PCA.
Remove collinear features to reduce dimensionality.
15. Explain the Bias-Variance Tradeoff ?
Predictive models have a tradeoff between bias (how well the model fits the data) and variance (how much the model changes based on changes in the inputs).
Simpler models are stable (low variance) but they don’t get close to the truth (high bias).
More complex models are more prone to being overfit (high variance) but they are expressive enough to get close to the truth (low bias).
The best model for a given problem usually lies somewhere in the middle.
16. When is Ridge regression favorable over Lasso regression ?
You can quote ISLR’s authors Hastie, Tibshirani who asserted that, in presence of few variables with medium / large sized effect, use lasso regression. In presence of many variables with small / medium sized effect, use ridge regression.
Conceptually, we can say, lasso regression (L1) does both variable selection and parameter shrinkage, whereas Ridge regression only does parameter shrinkage and end up including all the coefficients in the model. In presence of correlated variables, ridge regression might be the preferred choice. Also, ridge regression works best in situations where the least square estimates have higher variance. Therefore, it depends on our model objective.
machine learning interview questions and answers
17. What is convex hull ?
In case of linearly separable data, convex hull represents the outer boundaries of the two group of data points. Once convex hull is created, we get maximum margin hyperplane (MMH) as a perpendicular bisector between two convex hulls. MMH is the line which attempts to create greatest separation between two groups.
18. What’s the difference between a generative and discriminative model ?
A generative model will learn categories of data while a discriminative model will simply learn the distinction between different categories of data. Discriminative models will generally outperform generative models on classification tasks.
19. What is your training in machine learning and what types of hands-on experience do you have ?
Your answer to this question will depend on your training in machine learning. Be sure to emphasize any direct projects you’ve completed as part of your education. Don’t fail to mention any additional experience that you have including certifications and how they have prepared you for your role in the machine learning field.
20. How do bias and variance play out in machine learning ?
Both bias and variance are errors. Bias is an error due to flawed assumptions in the learning algorithm. Variance is an error resulting from too much complexity in the learning algorithm.
21. What is supervised versus unsupervised learning ?
Supervised learning is a process of machine learning in which outputs are fed back into a computer for the software to learn from for more accurate results the next time. With supervised learning, the “machine” receives initial training to start. In contrast, unsupervised learning means a computer will learn without initial training.
22. How will you know which machine learning algorithm to choose for your classification problem ?
If accuracy is a major concern for you when deciding on a machine learning algorithm then the best way to go about it is test a couple of different ones (by trying different parameters within each algorithm ) and choose the best one by cross-validation. A general rule of thumb to choose a good enough machine learning algorithm for your classification problem is based on how large your training set is. If the training set is small then using low variance/high bias classifiers like Naïve Bayes is advantageous over high variance/low bias classifiers like k-nearest neighbour algorithms as it might overfit the model. High variance/low bias classifiers tend to win when the training set grows in size.
23. Logistic regression gives probabilities as result then how do we use it to predict a binary outcome ?
A logistic model outputs a value between 0 and 1. To convert these probabilities into classes we use decision boundaries. We can set equal or unequal boundaries depending upon the requirement.
24. What are some common unsupervised tasks other than clustering ?
Visualization, Dimensionality reduction, association rule learning.
machine learning interview questions and answers
25. What is the difference between A.I. and machine learning, and has A.I. been oversold for decades because of sci-fi ?
More People thought of that A.I. that mean artificial intelligence may be than machine learning. Artificial intelligence actually it’s like which we go to see that alan turing aim was to somehow make a machine have the sort of intelligence that human might have. In particularly a program actually to convince you that it is human if you chat it with it. But i think artificial intelligence has evolved since then to make a unique sort of intelligence that machine might have. Machine learning has slightly a different quality. It is like a more specific part of artificial intelligence. Which is the idea of the program is going to change a world through a coding that makes interactions as same like humans. By the end, the program might not know actually how the program is written. Because it’s been changing as it’s been interacting. So, might be when we look at the program & see the actual program we do not know why necessarily it decided to write these decisions in a particular way. Because there are a lot of connections between artificial intelligence have with machine learning.
26. Differentiate between inductive and deductive machine learning ?
In inductive machine learning, the model learns through examples obtained from a set of observed instances to draw generalized conclusions, whereas in deductive machine learning certain statements are combined in a logical order as per some predefined rules to obtain new statements. Basically, inductive learning is instruction based and deductive learning is experience based. (company)
27. What is the “Curse of Dimensionality ?
The term, “Curse of Dimensionality” refers to the difficulty of searching through a space with multiple dimensions; more the dimensions, more the difficulty. If talk of this term, particularly in context of machine learning, it has to do with the difficulty associated with non-intuitive properties of data observed when working in a high-dimensional space.
28. Can you name some popular machine learning algorithms ?
Yes, they are:
Support vector machines
29. What do you understand by decision tree classification ?
Decision tree classification in machine learning refers to a tree-like classification model where the data is continuously split as per certain parameters. There are two primary entities in this model, namely decision nodes and leaves. The leaves denote the final outcome of decisions, while the nodes signify the point where the data is split. A decision tree classification greatly facilitates a visual and explicit representation of the decisions and decision making process.
30. What is the difference between supervised and unsupervised learning ?
In the supervised learning process, outputs are fed back into a computer system so that the software can learn from it and produce more accurate results in the successive occurrences; it is a kind of initial training for a system. On the other hand, unsupervised learning is a machine learning algorithm that draws inferences on its own from the unlabeled data set, without any external aid or input.
31. What is activation function in Machine Learning ?
A function (for example, ReLU or sigmoid) that takes in the weighted sum of all of the inputs from the previous layer and then generates and passes an output value (typically nonlinear) to the next layer.
32. What is baseline in machine learning ?
A simple model or heuristic used as reference point for comparing how well a model is performing. A baseline helps model developers quantify the minimal, expected performance on a particular problem.
machine learning interview questions and answers
33. What is batch in machine learning ?
The set of examples used in one iteration (that is, one gradient update) of model training.
34. What is bias in machine learning ?
An intercept or offset from an origin. Bias (also known as the bias term) is referred to as b or w0 in machine learning models.
35. What is calibration layer in machine learning ?
A post-prediction adjustment, typically to account for prediction bias. The adjusted predictions and probabilities should match the distribution of an observed set of labels.
36. What is class-imbalanced data set in machine learning ?
A binary classification problem in which the labels for the two classes have significantly different frequencies. For example, a disease data set in which 0.0001 of examples have positive labels and 0.9999 have negative labels is a class-imbalanced problem, but a football game predictor in which 0.51 of examples label one team winning and 0.49 label the other team winning is not a class-imbalanced problem. (Machine Learning Training)
37. What is confusion matrix in machine learning ?
An NxN table that summarizes how successful a classification model’s predictions were; that is, the correlation between the label and the model’s classification. One axis of a confusion matrix is the label that the model predicted, and the other axis is the actual label. N represents the number of classes.
38. How do you choose an algorithm for a classification problem ?
The answer depends on the degree of accuracy needed and the size of the training set. If you have a small training set, you can use a low variance/high bias classifier. If your training set is large, you will want to choose a high variance/low bias classifier.
39. What is ‘Overfitting’ in Machine learning ?
In machine learning, when a statistical model describes random error or noise instead of underlying relationship ‘overfitting’ occurs. When a model is excessively complex, overfitting is normally observed, because of having too many parameters with respect to the number of training data types. The model exhibits poor performance which has been overfit.
40. What is the difference between Type 1 and Type 2 errors ?
Type 1 error is classified as a false positive. I.e. This error claims that something has happened but the fact is nothing has happened. It is like a false fire alarm. The alarm rings but there is no fire.
Type 2 error is classified as a false negative. I.e. This error claims that nothing has happened but the fact is that actually, something happened at the instance.
The best way to differentiate a type 1 vs type 2 error is:
Calling a man to be pregnant- This is Type 1 example
Calling pregnant women and telling that she isn’t carrying any baby- This is type 2 example
machine learning interview questions and answers.
41. What are parametric models? Give an example ?
Parametric models are those with a finite number of parameters. To predict new data, you only need to know the parameters of the model. Examples include linear regression, logistic regression, and linear SVMs.
Non-parametric models are those with an unbounded number of parameters, allowing for more flexibility. To predict new data, you need to know the parameters of the model and the state of the data that has been observed. Examples include decision trees, k-nearest neighbors, and topic models using latent dirichlet analysis.
42. What is the difference between covariance and correlation ?
Correlation is the standardized form of covariance.
Covariances are difficult to compare. For example: if we calculate the covariances of salary ($) and age (years), we’ll get different covariances which can’t be compared because of having unequal scales. To combat such situation, we calculate correlation to get a value between -1 and 1, irrespective of their respective scale.
43. How would you evaluate a logistic regression model ?
A subsection of the question above. You have to demonstrate an understanding of what the typical goals of a logistic regression are (classification, prediction etc.) and bring up a few examples and use cases.
44. How will you explain machine learning in to a layperson ?
Machine learning is all about making decisions based on previous experience with a task with the intent of improving its performance. There are multiple examples that can be given to explain machine learning to a layperson –
Imagine a curious kid who sticks his palm
You have observed from your connections that obese people often tend to get heart diseases thus you make the decision that you will try to remain thin otherwise you might suffer from a heart disease. You have observed a ton of data and come up with a general rule of classification.
You are playing blackjack and based on the sequence of cards you see, you decide whether to hit or to stay. In this case based on the previous information you have and by looking at what happens, you make a decision quickly.
45. What is decision tree classification ?
A decision tree builds classification (or regression) models as a tree structure, with datasets broken up into ever smaller subsets while developing the decision tree, literally in a tree-like way with branches and nodes. Decision trees can handle both categorical and numerical data.
46. What are some methods of reducing dimensionality ?
Deductive machine learning starts with a conclusion, then learns by deducing what is right or wrong about that conclusion. Inductive machine learning starts with examples from which to draw conclusions.
47. How do classification and regression differ?
Classification predicts group or class membership. Regression involves predicting a response. Classification is the better technique when you need a more definite answer.
48. What is kernel SVM ?
Kernel SVM is the abbreviated version of kernel support vector machine. Kernel methods are a class of algorithms for pattern analysis and the most common one is the kernel SVM.
49. How do we separate one dimensional, two dimensional and three-dimensional data ?
One dimensional can be separated using a point, two dimensional using a line and three dimensional can be separated by a hyperplane.
50. What kind problems are solved by regularization ?
In machine learning, regularization is basically a process of introducing additional information with the purpose of solving an ill-posed problem or to avoid over fitting. It is basically a form of regression, which regularizes or constrains the coefficient estimates to zero. The technique of regularization prevents learning a more complex or flexible model in order to avoid the over fitting risk.