How to Transform the Target in Regression Flashcards

1
Q

WHICH CLASS IN SCIKIT-LEARN IS FOR TRANSFORMING THE TARGET VARIABLE? P341

A

TransformedTargetRegressor

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

WHAT ARE TWO WAYS WE CAN SCALE THE TARGET VARIABLE? P342

A

Manually transform the target variable.

Automatically transform the target variable.

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

HOW CAN WE MANUALLY TRANSFORM THE TARGET? P342

A

Create the transform object, e.g. a MinMaxScaler.
Fit the transform on the training dataset.
Apply the transform to the train and test datasets.
Invert the transform on any predictions made (target_scaler.inverse_transform (y_pred)).

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

WHAT IS THE DOWNSIDE OF MANUALLY TRANSFORMING THE TARGET? P343

A

You cannot use convenience functions in scikit-learn, such as cross_val_score(), to quickly evaluate a model.

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

HOW DOES TransformedTargetRegressor WORK? P343

A

TransformedTargetRegressor object wraps a given model (or a pipeline) and a scaling object.
wrapped_model = TransformedTargetRegressor (regressor=model, transformer=MinMaxScaler())

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

HOW CAN WE USE TransformedTargetRegressor? P343

A

The TransformedTargetRegressor instance can be fit like any other model by calling the fit() function and used to make predictions by calling the predict() function.

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