Top 50 Questions Flashcards

1
Q

What are the differences between supervised and unsupervised learning?

A

Supervised:

  • uses known and labeled data as input
  • has a feedback mechanism

Unsupervised:

  • uses unlabeled data as input
  • has no feedback mechanism
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the most commonly used learning algorithms for supervised learning?

A

decision trees, logistic regression, and support vector machines (SVM)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the most commonly used learning algorithms for unsupervised learning?

A

k-means clustering, hierarchical clustering, and apriori algorithm.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How is logistic regression done?

A

Logistic regression measures the relationship between the dependent variable (our label of what we want to predict) and one or more independent variables (our features) by estimating probability using its underlying logistic function (sigmoid).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain the steps in making a decision tree?

A
  • Take the entire data set as input
  • Calculate entropy of the target variable, as well as the predictor attributes
  • Calculate your information gain of all attributes (we gain information on sorting different objects from each other)
  • Choose the attribute with the highest information gain as the root node
  • Repeat the same procedure on every branch until the decision node of each branch is finalized
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is clear from the decision tree that an offer is accepted if?

A
  • Salary is greater than $50,000
  • The commute is less than an hour
  • Incentives are offered
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you build a random forest model?

A

Steps to build a random forest model:

  • Randomly select ‘k’ features from a total of ‘m’ features where k << m
  • Among the ‘k’ features, calculate the node D using the best split point
  • Split the node into daughter nodes using the best split
  • Repeat steps two and three until leaf nodes are finalized
  • Build forest by repeating steps one to four for ‘n’ times to create ‘n’ number of trees
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How can you avoid the overfitting of a random forest model?

A
  • Keep the model simple—take fewer variables into account, thereby removing some of the noise in the training data
  • Use cross-validation techniques, such as k folds cross-validation
  • Use regularization techniques, such as LASSO, that penalize certain model parameters if they’re likely to cause overfitting
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

_______ data contains only one variable. The purpose of the _________ analysis is to describe the data and find patterns that exist within it.

A

Univariate

Example: height of students

The patterns can be studied by drawing conclusions using mean, median, mode, dispersion or range, minimum, maximum, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

_______ data involves two different variables. The analysis of this type of data deals with causes and relationships and the analysis is done to determine the relationship between the two variables.

A

Bivariate

Example: temperature and ice cream sales in the summer season.

Here, the relationship is visible from the table that temperature and sales are directly proportional to each other. The hotter the temperature, the better the sales.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

_________ data involves three or more variables, it is categorized under __________. It is similar to a bivariate but contains more than one dependent variable.

A

Multivariate

Example: data for house price prediction

The patterns can be studied by drawing conclusions using mean, median, and mode, dispersion or range, minimum, maximum, etc. You can start describing the data and using it to guess what the price of the house will be.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the feature selection methods used to select the right variables?

A

There are two main methods for feature selection, i.e, filter, and wrapper methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Cite three filter feature selection methods?

A
  • Linear discrimination analysis
  • ANOVA
  • Chi-Square

The best analogy for selecting features is “bad data in, bad answer out.” When we’re limiting or selecting the features, it’s all about cleaning up the data coming in.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Cite three wrapper feature selection methods?

A
  • Forward Selection: We test one feature at a time and keep adding them until we get a good fit
  • Backward Selection: We test all the features and start removing them to see what works better
  • Recursive Feature Elimination: Recursively looks through all the different features and how they pair together

Wrapper methods are very labor-intensive, and high-end computers are needed if a lot of data analysis is performed with the wrapper method.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

In your choice of language, write a program that prints the numbers ranging from one to 16.

But for multiples of three, print “Fizz” instead of the number, and for the multiples of five, print “Buzz.” For numbers which are multiples of both three and five, print “FizzBuzz”

A

fizzbuzz
1
2
fizz
4
buzz
5
fizz
7
8
fizz buzz
10
11
fizz
13
14
fizzbuzz

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

You are given a data set consisting of variables with more than 30 percent missing values. How will you deal with them?

A
  1. If the data set is large, we can just simply remove the rows with missing data values.
  2. For smaller data sets, we can substitute missing values with the mean or average of the rest of the data using the pandas’ data frame in python. There are different ways to do so, such as df.mean( ), df.fillna(mean).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

For the given points, how will you calculate the Euclidean distance in Python?

plot1 = [1,3]

plot2 = [2,5]

A

The Euclidean distance can be calculated as follows:

euclidean_distance = sqrt( (plot1[0]-plot2[0])**2 + (plot1[1]-plot2[1])**2 )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What are dimensionality reduction and its benefits?

A

Dimensionality reduction refers to the process of converting a data set with vast dimensions into data with fewer dimensions (fields) to convey similar information concisely.

This reduction helps in compressing data and reducing storage space. It also reduces computation time as fewer dimensions lead to less computing. It removes redundant features; for example, there’s no point in storing a value in two different units (meters and inches).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How should you maintain a deployed model?

A
  1. monitor
  2. evaluate
  3. compare
  4. rebuild
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What are recommender systems?

A

A recommender system predicts what a user would rate a specific product based on their preferences. It can be split into two different areas:

  • Collaborative Filtering

As an example, Last.fm recommends tracks that other users with similar interests play often. This is also commonly seen on Amazon after making a purchase; customers may notice the following message accompanied by product recommendations: “Users who bought this also bought…”

  • Content-based Filtering

As an example: Pandora uses the properties of a song to recommend music with similar properties. Here, we look at content, instead of looking at who else is listening to music.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

How do you find RMSE and MSE in a linear regression model?

A

RMSE indicates the Root Mean Square Error.

MSE indicates the Mean Square Error.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

How can you select k for k-means?

A

We use the elbow method to select k for k-means clustering. The idea of the elbow method is to run k-means clustering on the data set where ‘k’ is the number of clusters.

Within the sum of squares (WSS), it is defined as the sum of the squared distance between each member of the cluster and its centroid.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is the significance of p-value of less than 0.05?

A

p-value typically ≤ 0.05

This indicates strong evidence against the null hypothesis; so you reject the null hypothesis.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is the significance of a p-value of 0.27?

A

p-value typically > 0.05

This indicates weak evidence against the null hypothesis, so you accept the null hypothesis.

25
Q

A p-value at cutoff 0.05 can be interruptible as?

A

marginal, meaning it could go either way.

26
Q

How can outlier values be treated?

A

You can drop outliers only if it is a garbage value.

If the outliers have extreme values, they can be removed. For example, if all the data points are clustered between zero to 10, but one point lies at 100, then we can remove this point.

If you cannot drop outliers, you can try the following:

  • Try a different model. Data detected as outliers by linear models can be fit by nonlinear models. Therefore, be sure you are choosing the correct model.
  • Try normalizing the data. This way, the extreme data points are pulled to a similar range.
  • You can use algorithms that are less affected by outliers; an example would be random forests.
27
Q

How can a time-series data be declared as stationery?

A

It is stationary when the variance and mean of the series are constant with time.

28
Q

How can you calculate accuracy using a confusion matrix?

A

You can see the values for total data, actual values, and predicted values.

The formula for accuracy is:

Accuracy = (True Positive + True Negative) / Total Observations

= (262 + 347) / 650

= 609 / 650

= 0.93

29
Q

Write the equation and calculate the precision and recall rate.

A

Precision = (True positive) / (True Positive + False Positive)

= 262 / 277

= 0.94

Recall Rate = (True Positive) / (Total Positive + False Negative)

= 262 / 288

= 0.90

30
Q

‘People who bought this also bought…’ recommendations seen on Amazon are a result of which algorithm?

A

The recommendation engine is accomplished with collaborative filtering. Collaborative filtering explains the behavior of other users and their purchase history in terms of ratings, selection, etc.

The engine makes predictions on what might interest a person based on the preferences of other users. In this algorithm, item features are unknown.

31
Q

You are given a dataset on cancer detection. You have built a classification model and achieved an accuracy of 96 percent. Why shouldn’t you be happy with your model performance? What can you do about it?

A

Cancer detection results in imbalanced data. In an imbalanced dataset, accuracy should not be based as a measure of performance. It is important to focus on the remaining four percent, which represents the patients who were wrongly diagnosed. Early diagnosis is crucial when it comes to cancer detection, and can greatly improve a patient’s prognosis.

Hence, to evaluate model performance, we should use Sensitivity (True Positive Rate), Specificity (True Negative Rate), F measure to determine the class wise performance of the classifier.

32
Q

Which of the following machine learning algorithms can be used for inputting missing values of both categorical and continuous variables?

A
  • K-means clustering
  • Linear regression
  • K-NN (k-nearest neighbor)
  • Decision trees

The K nearest neighbor algorithm can be used because it can compute the nearest neighbor and if it doesn’t have a value, it just computes the nearest neighbor based on all the other features.

When you’re dealing with K-means clustering or linear regression, you need to do that in your pre-processing, otherwise, they’ll crash. Decision trees also have the same problem, although there is some variance.

33
Q

Below are the eight actual values of the target variable in the train file. What is the entropy of the target variable?

[0, 0, 0, 1, 1, 1, 1, 1]

A

The formula for calculating the entropy is:

Putting p=5 and n=8, we get

Entropy = A = -(5/8 log(5/8) + 3/8 log(3/8))

34
Q

We want to predict the probability of death from heart disease based on three risk factors: age, gender, and blood cholesterol level. What is the most appropriate algorithm for this case?

Choose the correct option:

  1. Logistic Regression
  2. Linear Regression
  3. K-means clustering
  4. Apriori algorithm
A

The most appropriate algorithm for this case is logistic regression.

35
Q

After studying the behavior of a population, you have identified four specific individual types that are valuable to your study. You would like to find all users who are most similar to each individual type. Which algorithm is most appropriate for this study?

Choose the correct option:

  1. K-means clustering
  2. Linear regression
  3. Association rules
  4. Decision trees
A

As we are looking for grouping people together specifically by four different similarities, it indicates the value of k. Therefore, K-means clustering (answer A) is the most appropriate algorithm for this study.

36
Q

You have run the association rules algorithm on your dataset, and the two rules {banana, apple} => {grape} and {apple, orange} => {grape} have been found to be relevant. What else must be true?

Choose the right answer:

  1. {banana, apple, grape, orange} must be a frequent itemset
  2. {banana, apple} => {orange} must be a relevant rule
  3. {grape} => {banana, apple} must be a relevant rule
  4. {grape, apple} must be a frequent itemset
A

The answer is {grape, apple} must be a frequent itemset

37
Q

Your organization has a website where visitors randomly receive one of two coupons. It is also possible that visitors to the website will not receive a coupon. You have been asked to determine if offering a coupon to website visitors has any impact on their purchase decisions. Which analysis method should you use?

  1. One-way ANOVA
  2. K-means clustering
  3. Association rules
  4. Student’s t-test
A

The answer is: One-way ANOVA

38
Q

What are the feature vectors?

A

A feature vector is an n-dimensional vector of numerical features that represent an object. In machine learning, feature vectors are used to represent numeric or symbolic characteristics (called features) of an object in a mathematical way that’s easy to analyze.

39
Q

What are the steps in making a decision tree?

A
  1. Take the entire data set as input.
  2. Look for a split that maximizes the separation of the classes. A split is any test that divides the data into two sets.
  3. Apply the split to the input data (divide step).
  4. Re-apply steps one and two to the divided data.
  5. Stop when you meet any stopping criteria.
  6. This step is called pruning. Clean up the tree if you went too far doing splits.
40
Q

What is root cause analysis?

A

Root cause analysis was initially developed to analyze industrial accidents but is now widely used in other areas. It is a problem-solving technique used for isolating the root causes of faults or problems. A factor is called a root cause if its deduction from the problem-fault-sequence averts the final undesirable event from recurring.

41
Q

What is logistic regression?

A

Logistic regression is also known as the logit model. It is a technique used to forecast the binary outcome from a linear combination of predictor variables.

42
Q

What are recommender systems?

A

Recommender systems are a subclass of information filtering systems that are meant to predict the preferences or ratings that a user would give to a product.

43
Q

Explain cross-validation?

A

Cross-validation is a model validation technique for evaluating how the outcomes of a statistical analysis will generalize to an independent data set. It is mainly used in backgrounds where the objective is to forecast and one wants to estimate how accurately a model will accomplish in practice.

The goal of cross-validation is to term a data set to test the model in the training phase (i.e. validation data set) to limit problems like overfitting and gain insight into how the model will generalize to an independent data set.

44
Q

What is collaborative filtering?

A

Most recommender systems use this filtering process to find patterns and information by collaborating perspectives, numerous data sources, and several agents.

45
Q

Do gradient descent methods always converge to similar points?

A

They do not, because in some cases, they reach a local minima or a local optima point. You would not reach the global optima point. This is governed by the data and the starting conditions.

46
Q

What is the goal of A/B Testing?

A

This is statistical hypothesis testing for randomized experiments with two variables, A and B. The objective of A/B testing is to detect any changes to a web page to maximize or increase the outcome of a strategy.

47
Q

What are the drawbacks of the linear model?

A
  • The assumption of linearity of the errors
  • It can’t be used for count outcomes or binary outcomes
  • There are overfitting problems that it can’t solve
48
Q

What is the law of large numbers?

A

It is a theorem that describes the result of performing the same experiment very frequently. This theorem forms the basis of frequency-style thinking. It states that the sample mean, sample variance, and sample standard deviation converge to what they are trying to estimate.

49
Q

What are the confounding variables?

A

These are extraneous variables in a statistical model that correlates directly or inversely with both the dependent and the independent variable. The estimate fails to account for the confounding factor.

50
Q

What is star schema?

A

It is a traditional database schema with a central table. Satellite tables map IDs to physical names or descriptions and can be connected to the central fact table using the ID fields; these tables are known as lookup tables and are principally useful in real-time applications, as they save a lot of memory. Sometimes, star schemas involve several layers of summarization to recover information faster.

51
Q

How regularly must an algorithm be updated?

A

You will want to update an algorithm when:

  • You want the model to evolve as data streams through infrastructure
  • The underlying data source is changing
  • There is a case of non-stationarity
52
Q

What is eigenvalue?

A

Eigenvalues are the directions along which a particular linear transformation acts by flipping, compressing, or stretching.

53
Q

What is an eigenvector?

A

Eigenvectors are for understanding linear transformations. In data analysis, we usually calculate the eigenvectors for a correlation or covariance matrix.

54
Q

Why is resampling done?

A

Resampling is done in any of these cases:

  • Estimating the accuracy of sample statistics by using subsets of accessible data, or drawing randomly with replacement from a set of data points
  • Substituting labels on data points when performing significance tests
  • Validating models by using random subsets (bootstrapping, cross-validation)
55
Q

What is selection bias?

A

Selection bias, in general, is a problematic situation in which error is introduced due to a non-random population sample.

56
Q

What are the types of biases that can occur during sampling?

A
  1. Selection bias
  2. Undercoverage bias
  3. Survivorship bias
57
Q

What is survivorship bias?

A

Survivorship bias is the logical error of focusing on aspects that support surviving a process and casually overlooking those that did not because of their lack of prominence. This can lead to wrong conclusions in numerous ways.

58
Q

How do you work towards a random forest?

A

The underlying principle of this technique is that several weak learners combine to provide a strong learner. The steps involved are:

  1. Build several decision trees on bootstrapped training samples of data
  2. On each tree, each time a split is considered, a random sample of mm predictors is chosen as split candidates out of all pp predictors
  3. Rule of thumb: At each split m=p√m=p
  4. Predictions: At the majority rule