Tuesday, April 23, 2024

Basic Machine Learning Interview Questions

Don't Miss

What Are True Positive True Negative False Positive And False Negative

Machine Learning Interview Questions and Answers | Machine Learning Interview Preparation | Edureka

Let take an example to understand above terms. We have a model in which alarm goes on or not in case of fire or otherwise.

True positive:

If the alarm goes on in case of fire it is known as true positive. In this case, the fire is positive and prediction made by system to alarm is true.

False Positive:

If alarm goes on when there is no fire, in this situation fire is positive and the prediction made by the system is false. This is the worst condition.

True Negative:

If alarm does not go on when there is no fire. System considered the fire as negative and prediction made by the system is true.

False Negative:

If the alarm does not go on when there is fire. System considered fire as negative and prediction made by the system is false.

See also: 42 Data Science Interview Questions & Answers

Google Machine Learning Interview Questions

What are the assumptions of linear regression?

Linear regression is used to understand the relation between features and target . Before we train the model, we need to meet a few assumptions:

  • The residuals are independent
  • There is a linear relation between X independent variable and y dependent variable.
  • Constant residual variance at every level of X
  • The residuals are normally distributed.
  • Note: the residuals in linear regression are the difference between actual and predicted values.

    Write a function find_bigrams to take a string and return a list of all bigrams.

    During coding interviews, you will be asked about machine learning problems, but in some cases, they will assess your Python skills by asking you general coding questions. Become an expert Python programmer by taking the Python Programmer career track.

    Creating a bigram function is quite easy. You need to use two loops with the zip function.

  • In bigram function, we are taking a list of the sentence as an input
  • Creating a loop to access a single sentence
  • Lowering and splitting the sentence into a list of words
  • Using `zip` to create a combination of the previous word and the next word
  • Appending the output to the result
  • Printing the results.
  • It is quite easy if you break down the problem and use zip functions.

    def bigram:    result =     for ls in text_list:        words = ls.lower.split        for bi in zip:            result.append    return resulttext = print)

    Results:

    
    

    Most common types of Activation Functions:

    If We Have A High Bias Error What Does It Mean How To Treat It

    Ans. High bias error means that that model we are using is ignoring all the important trends in the model and the model is underfitting.

    To reduce underfitting:

    • We need to increase the complexity of the model
    • Number of features need to be increased

    Sometimes it also gives the impression that the data is noisy. Hence noise from data should be removed so that most important signals are found by the model to make effective predictions.

    Increasing the number of epochs results in increasing the duration of training of the model. Its helpful in reducing the error.

    Also Check: How To Dress Casually For An Interview

    What Is Linear Regression

    Linear Function can be defined as a Mathematical function on a 2D plane as, Y =Mx +C, where Y is a dependent variable and X is Independent Variable, C is Intercept and M is slope and same can be expressed as Y is a Function of X or Y = F.

    At any given value of X, one can compute the value of Y, using the equation of Line. This relation between Y and X, with a degree of the polynomial as 1 is called Linear Regression.

    In Predictive Modeling, LR is represented as Y = Bo + B1x1 + B2x2The value of B1 and B2 determines the strength of the correlation between features and the dependent variable.

    Example: Stock Value in $ = Intercept + * + *

    What Is Unsupervised Learning

    Pin on DataScience

    Unsupervised learning is also a type of machine learning algorithm used to find patterns on the set of data given. In this, we dont have any dependent variable or label to predict. Unsupervised Learning Algorithms:

    • Neural Networks and Latent Variable Models.

    Example:

    In the same example, a T-shirt clustering will categorize as collar style and V neck style, crew neck style and sleeve types.

    Don’t Miss: How To Write A Thank You For An Interview Email

    Explain The Phrase Curse Of Dimensionality

    The Curse of Dimensionality refers to the situation when your data has too many features.

    The phrase is used to express the difficulty of using brute force or grid search to optimize a function with too many inputs.

    It can also refer to several other issues like:

    • If we have more features than observations, we have a risk of overfitting the model.
    • When we have too many features, observations become harder to cluster. Too many dimensions cause every observation in the dataset to appear equidistant from all others and no meaningful clusters can be formed.

    Dimensionality reduction techniques like PCA come to the rescue in such cases.

    Imagine You Are Given A Dataset Consisting Of Variables Having More Than 30% Missing Values Lets Say Out Of 50 Variables 16 Variables Have Missing Values Which Is Higher Than 30% How Will You Deal With Them

    To deal with the missing values, we will do the following:

    • We will specify a different class for the missing values.
    • Now, we will check the distribution of values, and we will hold those missing values that are defining a pattern.
    • Then, we will charge these values into yet another class while eliminating others.

    Recommended Reading: Job Offer Letter After Interview

    How To Implement The Knn Classification Algorithm

    Iris dataset is used for implementing the KNN classification algorithm.

    # KNN classification algorithmfrom sklearn.datasets import load_irisfrom sklearn.neighbors import KNeighborsClassifierimport numpy as npfrom sklearn.model_selection import train_test_splitiris_dataset=load_irisA_train, A_test, B_train, B_test = ztrain_test_splitkn = KNeighborsClassifier kn.fitA_new = np.arrayprediction = kn.predictprint)print)print))Output:Predicted Target Name: Predicted Feature Name: Test Score: 0.92

    Come to Intellipaats Machine Learning Community if you have more queries on Machine Learning Interview Questions!

    What Is Pca In Machine Learning

    Interview Prep Day 1-How To Learn Machine Learning Algorithms For Interviews- Naive Bayes Classifier

    Multidimensional data is at play in the real world. Data visualization and computation become more challenging with the increase in dimensions. In such a scenario, the dimensions of data might have to be reduced to analyze and visualize it easily. This is done by:

    • Removing irrelevant dimensions

    This is where Principal Component Analysis is used.

    The goal of PCA is to find a fresh collection of uncorrelated dimensions and rank them on the basis of variance.

    Mechanism of PCA:

    • Compute the covariance matrix for data objects
    • Compute eigenvectors and eigenvalues in descending order
    • Select the initial N eigenvectors to get new dimensions
    • Finally, change the initial n-dimensional data objects into N-dimensions

    Example: Below are two graphs showing data points or objects and two directions, one is green and the other is yellow. Graph 2 is arrived at by rotating Graph 1 so that the x-axis and y-axis represent the green and yellow direction respectively.

    After the rotation of data points, it can be inferred that the green direction, the x-axis, gives the line that best fits the data points.

    Here, two-dimensional data is being represented but in real life, the data would be multidimensional and complex. So, after recognizing the importance of each direction, the area of dimensional analysis can be reduced by cutting off the less-significant directions.

    Now, we will go through another important Machine Learning interview question on PCA.

    Career Transition

    Recommended Reading: How To Answer It Interview Questions

    Basic Machine Learning Interview Questions

    Q1. How will you classify machine learning algorithms?

    Ans. We classify ML algorithms on the presence or absence of target variables.

    a. Supervised learning:

    Target variables are present in this subtype. Supervised Learning models learn by analyzing data that has been labeled. Before running predictions on new data, the model trains on a labeled dataset.Algorithms that fall under this category include Naive Bayes, Logistic Regression, K Nearest Neighbors etc

    b. Unsupervised learning:

    There are no target variables in this subtype. Unsupervised learning models train on unlabeled data with no targets or instructions. They automatically identify patterns and trends in the data and create clusters. Singular Value Decomposition, Principal Component Analysis and similar algorithms fall into this bracket

    c. Reinforcement Learning:

    The model gains knowledge via trial and error. Here, models interact with their environment to make decisions and get feedback on these decisions, thus helping to improve accuracy and efficiency in the long run.

    Q2. What are the steps involved in implementing a machine learning project?

    Ans. We can outline the steps of machine learning project from ideation to completion in 8 steps. These include:

    • Parameter tuning
    • Result Validation

    Q3. What does the term instance-based learning mean?

    Q4. Are AI, ML and DL different terms for the same entity?

    Q5. What is the best way to apply machine learning to hardware?

    Q8. Explain Logistic Regression in a few words.

    Whats Your Research Background In Ml

    Unlike some positions in tech, machine learning jobs still sometimes require some formal research experience in the field. If youve contributed to research papers, be ready to produce them and discuss your findings.

    If you dont have any formal research experience, it might not be a deal-breaker but you should still prepare to explain why youve focused your energy in other areas.

    • Give me an example of how youve used your data analysis to change behavior. What was the impact, and what would you do differently in retrospect?
    • Give an example of a problem you solved with machine learning.
    • Tell me about a time when you had to think outside the box to complete a task. Were you successful?
    • Can you describe a time when you had to develop a complex algorithm?
    • Can you tell me about a major success you had with a machine learning project?
    • Whats the most difficult decision youve had to make recently and how did you come to that decision?
    • Tell me about a time you were under a lot of pressure. What was going on, and how did you get through it?
    • Tell me about a time you had a conflict at work.
    • Give an example of when you made a mistake at work.
    • Describe a time when you disagreed with a client. How did you handle it?
    • Tell me about a time you set a goal for yourself. How did you go about ensuring that you would meet your objective?
    • Describe a time when you saw a problem and took the initiative to correct it rather than waiting for someone else to do it.

    You May Like: How To Prepare For A Graphic Design Interview

    What Is The Significance Of Gamma And Regularization In Svm

    The gamma defines influence. Low values meaning far and high values meaning close. If gamma is too large, the radius of the area of influence of the support vectors only includes the support vector itself and no amount of regularization with C will be able to prevent overfitting. If gamma is very small, the model is too constrained and cannot capture the complexity of the data.

    The regularization parameter serves as a degree of importance that is given to miss-classifications. This can be used to draw the tradeoff with OverFitting.

    Whats A Fourier Transform

    Scala interview questions

    Fourier Transform is a mathematical technique that transforms any function of time to a function of frequency. Fourier transform is closely related to Fourier series. It takes any time-based pattern for input and calculates the overall cycle offset, rotation speed and strength for all possible cycles. Fourier transform is best applied to waveforms since it has functions of time and space. Once a Fourier transform applied on a waveform, it gets decomposed into a sinusoid.

    Read Also: Interview Questions And Answers For Rn Case Manager Position

    Q10 How Can You Select K For K

    To select K, two methods can be used. These are:

    • Direct methods: These contain elbow and silhouette.
    • Statistical testing methods: These have gap statistics.

    Most often, the silhouette is used when the optimal value of k has to be determined.

    These are some of the most important advanced machine learning interview questions. So when you prepare your study plan, make sure to include these.

    What Are Some Methods Of Reducing Dimensionality

    You can reduce dimensionality by combining features with feature engineering, removing collinear features, or using algorithmic dimensionality reduction.

    Now that you have gone through these machine learning interview questions, you must have got an idea of your strengths and weaknesses in this domain.

    Don’t Miss: What They Ask In A Job Interview

    Q9 How Should Outlier Values Be Handled

    An observation in the dataset that is pretty far from the others in the dataset is known as an outlier. The following tools can be used to discover outliers:

    Usually, three simple strategies can be followed to handle outliers:

    • Similarly, the feature can be transformed to decrease the effect of the outlier.

    What Is The Difference Between A Probability Distribution And A Likelihood Function

    Machine Learning Interview Questions And Answers | Data Science Interview Questions | Simplilearn

    A probability distribution is a function that describes the probability of different outcomes for a random variable. It specifies the probability of each possible value of the variable. A likelihood function, on the other hand, is a function that describes the probability of the data given a set of parameters. It is used to estimate the parameters of a model by finding the values that maximize the probability of the data under the model.

    Also Check: What To Say In A Job Interview

    How Do You Know Which Machine Is Learning The Algorithm For Choosing For Your Classification Problem

    Although there is no set rule for choosing the algorithm for the classification problem, you can follow these instructions:

    1: If accuracy is a concern, test different algorithms and correct them

    2: If the training dataset is small, use models that have less variability and more bias.

    3: If the training dataset is large, use models with more variability and less bias.

    Whats The Difference Between Probability And Likelihood

    Probability is the measure of the likelihood that an event will occur that is, what is the certainty that a specific event will occur? Where-as a likelihood function is a function of parameters within the parameter space that describes the probability of obtaining the observed data.So the fundamental difference is, Probability attaches to possible results likelihood attaches to hypotheses.

    Also Check: How To Record Interview On Iphone

    Machine Learning Interview Questions Based On Programming Fundamentals

    1) How will you find the middle element of a linked list in a single pass?

    Finding the middle element of a linked list in a single pass means we should traverse the complete linked list twice as we do in a two-pass case. To achieve this task, we can use two pointers: slw_ptr and fst_ptr . If the slow pointer reads each element of the list and the fast pointer is made to run twice as fast as the slow pointer, then when the fast pointer is at the end of the linked list, the slow pointer will be at the middle element.

    Steps:

  • Create two pointers slw_ptr and fst_ptr that point to the first element of the list.

  • Move the pointer fast_ptr two steps and move the pointer slow_ptr one step ahead until the fast_ptr has reached the end of the string.

  • Return the value to which the slow_ptr pointer is pointing to.

  • 2) Write code to print the InOrder traversal of a tree.

    The following function will print the InOrder traversal of a tree in C++:

    void printInorder

    Be Sure To Write Clearly

    Guru99 Machine Learning Interview Questions

    Part of the interview might include specific tests or written tasks. If this is the case, make sure you write clearly and fully explain your answers. You may be tested on your scientific rigor, so include charts, citations, and introduce notions when necessary. For example, whether you’re tasked with creating a simple model or a complex model, it’s important to show every step of the process so your potential employer can see the work you’ve done.

    Don’t Miss: How To Interview Someone For An Article

    Build An Awesome Job Winning Deep Learning Project Portfolio To Nail Your Next Deep Learning Job Interview

    âSo that pretty much makes it for this post the most common deep learning engineer interview questions and answers. Whether youre a beginner or a seasoned professional, hopefully, these deep learning job interview questions and answers have been useful and been able to boost your confidence for your next deep learning engineer job interview.

    Congrats! You now have the know-how on the kind of deep learning interview questions you can expect in your next job interview. However, there is still a lot to learn to solidify your deep learning knowledge and get hands-on experience working with diverse deep learning projects and all the deep learning frameworks like PyTorch, TensorFlow, and Keras. ProjectPro helps you move right into practice with over 60+ end-to-end solved data science and machine learning projects where you will learn how to develop machine learning/deep learning models from scratch and develop a high-level ability to think about productionized machine learning systems. Get started today to take your deep learning skills to the next level and build a fantastic job-winning portfolio of projects.

    What Is Naive In The Naive Bayes Classifier

    The classifier is called naive because it makes assumptions that may or may not turn out to be correct.

    The algorithm assumes that the presence of one feature of a class is not related to the presence of any other feature , given the class variable.

    For instance, a fruit may be considered to be a cherry if it is red in color and round in shape, regardless of other features. This assumption may or may not be right .

    Recommended Reading: What Are Typical Questions For A Phone Interview

    What Is Bayes Theorem State At Least 1 Use Case With Respect To The Machine Learning Context

    Bayes Theorem describes the probability of an event, based on prior knowledge of conditions that might be related to the event. For example, if cancer is related to age, then, using Bayes theorem, a persons age can be used to more accurately assess the probability that they have cancer than can be done without the knowledge of the persons age.Chain rule for Bayesian probability can be used to predict the likelihood of the next word in the sentence.

    More articles

    Popular Articles