module ml.lasso_random_forest_regressor

Inheritance diagram of ensae_teaching_cs.ml.lasso_random_forest_regressor

Short summary

module ensae_teaching_cs.ml.lasso_random_forest_regressor

Implements LassoRandomForestRegressor.

source on GitHub

Classes

class

truncated documentation

LassoRandomForestRegressor

Fits a random forest and then selects trees by using a Lasso regression. The traning produces the following attributes: …

Methods

method

truncated documentation

__init__

decision_function

Computes the predictions.

fit

Fits the random forest first, then applies a lasso and finally removes all trees mapped to a null coefficient.

predict

Computes the predictions.

Documentation

Implements LassoRandomForestRegressor.

source on GitHub

class ensae_teaching_cs.ml.lasso_random_forest_regressor.LassoRandomForestRegressor(rf_estimator=None, lasso_estimator=None)[source]

Bases : sklearn.base.BaseEstimator, sklearn.base.RegressorMixin

Fits a random forest and then selects trees by using a Lasso regression. The traning produces the following attributes:

  • rf_estimator_: trained random forest

  • lasso_estimator_: trained Lasso

  • estimators_: trained estimators mapped to a not null coefficients

  • intercept_: bias

  • coef_: estimators weights

source on GitHub

Paramètres

source on GitHub

__init__(rf_estimator=None, lasso_estimator=None)[source]
Paramètres

source on GitHub

decision_function(X)[source]

Computes the predictions.

source on GitHub

fit(X, y, sample_weight=None)[source]

Fits the random forest first, then applies a lasso and finally removes all trees mapped to a null coefficient.

Paramètres
  • X – training features

  • y – training labels

  • sample_weight – sample weights

source on GitHub

predict(X)[source]

Computes the predictions.

source on GitHub