Supervised Learning Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Why KNN is the simplest algorithm?

A

Because Building the model consists only of storing the training dataset. To make a prediction for a new data point, the algorithm finds the closest data points in the training dataset—its“nearest neighbors.”

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

How k-neighbors classification works when your model has more than one k neighbors?

A
When considering more than one neighbor, we use voting to assign a label. This means that for each test point, we count how many neighbors belong to
class 0 and how many neighbors belong to class 1. We then assign the class that is more frequent.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
Which method evaluates the score of KNN supervised algorithm?
(Name the import module form skilearn and the skilearn method used)
A

from sklearn.neighbors import KNeighborsClassifier
clf = KNeighborsClassifier(n_neighbors=3)
clf.score(X_test, y_test)

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

At classification what is named a decision boundary?

meaning from geometry point of view

A

It is the line which divides the feature space between where the algorithm assigns class 0 versus where it assigns class 1

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

What are the conclusions by increasing the number of neighbours regarding the decision boundary?

A

Increasing the number of neighbours leads to a smoother decision boundary and a less complex model

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

How KNN meth0od is used in regression for one neighbor?

A

In regression the KNN method is used as following::

If you only have one neighbour, the target value of the test point gets equal of the nearest training data point

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

How KNN regression is implemented in skilearn?

A

from sklearn.neighbors import KNeighborsRegressor

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

How the pefrormance of a regression is evaluated? Explain what is R2

A

The performance of an regression is evaluated by the following measurement. The R2 score, also known as the coefficient of determination, is a measure of goodness of a prediction for a regression model, and yields a score between 0 and 1.

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

Which are the basic parameters of the KNN estimators?

A

the number of neighbors and how you measure distance between data points. In practice,using a small number of neighbors like three or five often works well, but you should certainly adjust this parameter. By default, Euclidean distance is used, which works
well in many settings

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

Which datasets are non ideal for the KNN estimator?

A

a) too big datasets either from feature or samples

b) sparse datasets

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

What geometrical graph lies a linear model for singe, multiple features and so on?

A

Linear models for regression can be characterized as regression models for which the prediction is a line for a single feature, a plane when using two features, or a hyper‐plane in higher dimensions (that is, when using more features).

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

State the differences between the linear predictors and the regression estimator

A

The linear model in the case of predicting the line, it deprives many of the fine details which the models seem to have .It is somehow unrealistic

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

What is under fitting and over-fitting in terms of training set score and testing set score?

A

High training set score and mediocre training test score is an indication of over-fitting.

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

What is ridge regression?

A

Ridge regression is same as linear regression however another constraint is considered. In this case, we also need that all the w coefficients to be close to zero. This mean that at the model none of the features has any serious contribution.This constraint is an example of what is called regularization. Regularization means explicitly restricting a model to avoid overfitting
from sklearn.linear_model import Ridge

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

What is the difference between ridge and linear regressor?

A

The Ridge model makes a trade-off between the simplicity of the model (near-zero coefficients) and its performance on the training set.
The simplicity is defined from the alpha parameter.
The alpha parameter as it goes upwards it increases generality, meaning we have better training test performance.

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

What is the alternatives to ridge?

A

The alternative to the ridge is the Lasso which is often called L1 estimator. L1 estimators lead some of the features to have zero coefficient, which this can be interpreted as automatic feature selection

17
Q

What are the linear models for classification?

A

The linear models for classification try to found lets say a line,plane or hyperplane from the training data. Above the line , meaning y>0, the training data belongs to the Class 1 and below the line the data belong to the Class )

18
Q

What is over fitting and why should be avoided?

A

Over fitting should be avoided because

a) it produces a complex model which may fits perfect the training set however it does not produce optimal results when it comes to training set
b) it does not capture the true properties of the dataset but only the random noise

19
Q

What actual Regularization means?

A

It is the technique that discourages learning a more complex or flexible model, so as to avoid the risk of overfitting.

20
Q

Which is the parameter that determines the regularization on LogisticRegression and SVM?

A

The C parameter.when you use a high value for the parameter C, LogisticRegression and LinearSVC try to fit the training set as best as possible, while with low values of the parameter C, the models put more emphasis on fnding a coefficient vector (w) that is close to zero