module ml.lasso_random_forest_regressor
#
Short summary#
module ensae_teaching_cs.ml.lasso_random_forest_regressor
Implements LassoRandomForestRegressor.
Classes#
class |
truncated documentation |
---|---|
Fits a random forest and then selects trees by using a Lasso regression. The traning produces the following attributes: … |
Properties#
property |
truncated documentation |
---|---|
|
HTML representation of estimator. This is redundant with the logic of _repr_mimebundle_. The latter should … |
Methods#
method |
truncated documentation |
---|---|
Computes the predictions. |
|
Fits the random forest first, then applies a lasso and finally removes all trees mapped to a null coefficient. |
|
Computes the predictions. |
Documentation#
Implements LassoRandomForestRegressor.
- 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
- Paramètres:
rf_estimator – random forest estimator, sklearn.ensemble.RandomForestRegressor by default
lass_estimator – Lasso estimator, sklearn.linear_model.LassoRegression by default
- __init__(rf_estimator=None, lasso_estimator=None)#
- Paramètres:
rf_estimator – random forest estimator, sklearn.ensemble.RandomForestRegressor by default
lass_estimator – Lasso estimator, sklearn.linear_model.LassoRegression by default
- decision_function(X)#
Computes the predictions.
- 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
- predict(X)#
Computes the predictions.