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: …

Properties#

property

truncated documentation

_repr_html_

HTML representation of estimator. This is redundant with the logic of _repr_mimebundle_. The latter should …

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)#

Bases : BaseEstimator, 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)#
Paramètres:

source on GitHub

decision_function(X)#

Computes the predictions.

source on GitHub

fit(X, y, sample_weight=None)#

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)#

Computes the predictions.

source on GitHub