How to Use Feature Importance Flashcards

1
Q

WHAT ARE THE 3 MAIN TYPES OF MORE ADVANCED FEATURE IMPORTANCE? P209

A

1-Feature importance from model coefficients (a crude method)
2-Feature importance from decision trees
3-Feature importance from permutation testing

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

IN WHICH MODELS CAN WE USE COEFFICIENTS AS FEATURE IMPORTANCE? P210

A

Linear machine learning algorithms fit a model where the prediction is the weighted sum of the input values. Examples include linear regression, logistic regression, and extensions that add regularization, such as ridge regression, LASSO, and the elastic net.

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

WHAT ATTRIBUTE DO WE USE TO GET COEFFICIENT FROM MODELS THAT HAVE IT? (REGRESSION AND CLASSIFICATION) WHAT ASSUMPTION DOES IT MAKE? P210

A

coef_ (for regression) coef_[0] (for classification)

It assumes that input variables are on the same scale.

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

WHAT DO POSITIVE/NEGATIVE COEFFICIENT SCORES INDICATE IN A CLASSIFICATION PROBLEM? P212

A

Negative: indicate a feature that predicts class 0/ Positive: indicate a feature that predicts class 1

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

HOW DOES DECISION TREE IMPORTANCE SCORES THE FEATURES? P213

A

Based on the reduction in the criterion used to select split points, like Gini or entropy.

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

WHICH MODELS CAN USE DECISION TREE FEATURE IMPORTANCE? P213

A

Classification and Regression trees (CART), Ensemble Decision Trees (Random Forest, Stochastic Gradient Boost, Extra Trees)

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

WHICH ATTRIBUTE OF CART ALGORITHMS IS USED FOR FEATURE IMPORTANCE SCORING? P213

A

feature_importances_

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

WHAT IS PERMUTATION FEATURE IMPORTANCE? P220

A

Permutation feature importance is a technique for calculating relative importance scores that is independent of the model used.

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

HOW DO WE IMPORT PERMUTATION FEATURE IMPORTANCE? P221

A

from sklearn.inspection import permutation_importance

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

WHAT DO WE HAVE TO DO WITH THE MODEL BEFORE USING PERMUTATION FEATURE IMPORTANCE? P221

A

Fit it to the dataset

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

WHAT ARE THE PARAMETERS OF PERMUTATION FEATURE IMPORTANCE? P221

A

permutation_importance (model, X, y, scoring=’neg_mean_squared_error’)

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

WHICH CLASS DO WE USE FOR A MODEL BASED FEATURE SELECTION? CODE P225

A

Fs= SelectFromModel (RandomForestClassifier (n_estimators=200), max_features=5)

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

WHAT DO WE NEED TO DO BEFORE CALCULATING IMPORTANCE SCORES USING A MODEL BASED FEATURE SELECTION (SelectFromModel class)? P225

A

By fit_transform the feature selection method on the training dataset

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