3.2.Tuning the hyper-parameters of an estimator#

Hyper-parameters are parameters that are not directly learnt within estimators.In scikit-learn they are passed as arguments to the constructor of theestimator classes. Typical examples includeC,kernel andgammafor Support Vector Classifier,alpha for Lasso, etc.

It is possible and recommended to search the hyper-parameter space for thebestcross validation score.

Any parameter provided when constructing an estimator may be optimized in thismanner. Specifically, to find the names and current values for all parametersfor a given estimator, use:

estimator.get_params()

A search consists of:

  • an estimator (regressor or classifier such assklearn.svm.SVC());

  • a parameter space;

  • a method for searching or sampling candidates;

  • a cross-validation scheme; and

  • ascore function.

Two generic approaches to parameter search are provided inscikit-learn: for given values,GridSearchCV exhaustively considersall parameter combinations, whileRandomizedSearchCV can sample agiven number of candidates from a parameter space with a specifieddistribution. Both these tools have successive halving counterpartsHalvingGridSearchCV andHalvingRandomSearchCV, which can bemuch faster at finding a good parameter combination.

After describing these tools we detailbest practices applicable to these approaches. Some models allow forspecialized, efficient parameter search strategies, outlined inAlternatives to brute force parameter search.

Note that it is common that a small subset of those parameters can have a largeimpact on the predictive or computation performance of the model while otherscan be left to their default values. It is recommended to read the docstring ofthe estimator class to get a finer understanding of their expected behavior,possibly by reading the enclosed reference to the literature.

3.2.1.Exhaustive Grid Search#

The grid search provided byGridSearchCV exhaustively generatescandidates from a grid of parameter values specified with theparam_gridparameter. For instance, the followingparam_grid:

param_grid=[{'C':[1,10,100,1000],'kernel':['linear']},{'C':[1,10,100,1000],'gamma':[0.001,0.0001],'kernel':['rbf']},]

specifies that two grids should be explored: one with a linear kernel andC values in [1, 10, 100, 1000], and the second one with an RBF kernel,and the cross-product of C values ranging in [1, 10, 100, 1000] and gammavalues in [0.001, 0.0001].

TheGridSearchCV instance implements the usual estimator API: when“fitting” it on a dataset all the possible combinations of parameter values areevaluated and the best combination is retained.

Examples

Advanced examples#

3.2.2.Randomized Parameter Optimization#

While using a grid of parameter settings is currently the most widely usedmethod for parameter optimization, other search methods have morefavorable properties.RandomizedSearchCV implements a randomized search over parameters,where each setting is sampled from a distribution over possible parameter values.This has two main benefits over an exhaustive search:

  • A budget can be chosen independent of the number of parameters and possible values.

  • Adding parameters that do not influence the performance does not decrease efficiency.

Specifying how parameters should be sampled is done using a dictionary, verysimilar to specifying parameters forGridSearchCV. Additionally,a computation budget, being the number of sampled candidates or samplingiterations, is specified using then_iter parameter.For each parameter, either a distribution over possible values or a list ofdiscrete choices (which will be sampled uniformly) can be specified:

{'C':scipy.stats.expon(scale=100),'gamma':scipy.stats.expon(scale=.1),'kernel':['rbf'],'class_weight':['balanced',None]}

This example uses thescipy.stats module, which contains many usefuldistributions for sampling parameters, such asexpon,gamma,uniform,loguniform orrandint.

In principle, any function can be passed that provides arvs (randomvariate sample) method to sample a value. A call to thervs function shouldprovide independent random samples from possible parameter values onconsecutive calls.

Warning

The distributions inscipy.stats prior to version scipy 0.16do not allow specifying a random state. Instead, they use the globalnumpy random state, that can be seeded vianp.random.seed or setusingnp.random.set_state. However, beginning scikit-learn 0.18,thesklearn.model_selection module sets the random state providedby the user if scipy >= 0.16 is also available.

For continuous parameters, such asC above, it is important to specifya continuous distribution to take full advantage of the randomization. This way,increasingn_iter will always lead to a finer search.

A continuous log-uniform random variable is the continuous version ofa log-spaced parameter. For example to specify the equivalent ofC from above,loguniform(1,100) can be used instead of[1,10,100].

Mirroring the example above in grid search, we can specify a continuous randomvariable that is log-uniformly distributed between1e0 and1e3:

fromsklearn.utils.fixesimportloguniform{'C':loguniform(1e0,1e3),'gamma':loguniform(1e-4,1e-3),'kernel':['rbf'],'class_weight':['balanced',None]}

Examples

References

  • Bergstra, J. and Bengio, Y.,Random search for hyper-parameter optimization,The Journal of Machine Learning Research (2012)

3.2.3.Searching for optimal parameters with successive halving#

Scikit-learn also provides theHalvingGridSearchCV andHalvingRandomSearchCV estimators that can be used tosearch a parameter space using successive halving[1][2]. Successivehalving (SH) is like a tournament among candidate parameter combinations.SH is an iterative selection process where all candidates (theparameter combinations) are evaluated with a small amount of resources atthe first iteration. Only some of these candidates are selected for the nextiteration, which will be allocated more resources. For parameter tuning, theresource is typically the number of training samples, but it can also be anarbitrary numeric parameter such asn_estimators in a random forest.

Note

The resource increase chosen should be large enough so that a large improvementin scores is obtained when taking into account statistical significance.

As illustrated in the figure below, only a subset of candidates‘survive’ until the last iteration. These are the candidates that haveconsistently ranked among the top-scoring candidates across all iterations.Each iteration is allocated an increasing amount of resources per candidate,here the number of samples.

../_images/sphx_glr_plot_successive_halving_iterations_001.png

We here briefly describe the main parameters, but each parameter and theirinteractions are described more in detail in the dropdown section below. Thefactor (> 1) parameter controls the rate at which the resources grow, andthe rate at which the number of candidates decreases. In each iteration, thenumber of resources per candidate is multiplied byfactor and the numberof candidates is divided by the same factor. Along withresource andmin_resources,factor is the most important parameter to control thesearch in our implementation, though a value of 3 usually works well.factor effectively controls the number of iterations inHalvingGridSearchCV and the number of candidates (by default) anditerations inHalvingRandomSearchCV.aggressive_elimination=Truecan also be used if the number of available resources is small. More controlis available through tuning themin_resources parameter.

These estimators are stillexperimental: their predictionsand their API might change without any deprecation cycle. To use them, youneed to explicitly importenable_halving_search_cv:

>>>fromsklearn.experimentalimportenable_halving_search_cv# noqa>>>fromsklearn.model_selectionimportHalvingGridSearchCV>>>fromsklearn.model_selectionimportHalvingRandomSearchCV

Examples

The sections below dive into technical aspects of successive halving.

Choosingmin_resources and the number of candidates#

Besidefactor, the two main parameters that influence the behaviour of asuccessive halving search are themin_resources parameter, and thenumber of candidates (or parameter combinations) that are evaluated.min_resources is the amount of resources allocated at the firstiteration for each candidate. The number of candidates is specified directlyinHalvingRandomSearchCV, and is determined from theparam_gridparameter ofHalvingGridSearchCV.

Consider a case where the resource is the number of samples, and where wehave 1000 samples. In theory, withmin_resources=10 andfactor=2, weare able to runat most 7 iterations with the following number ofsamples:[10,20,40,80,160,320,640].

But depending on the number of candidates, we might run less than 7iterations: if we start with asmall number of candidates, the lastiteration might use less than 640 samples, which means not using all theavailable resources (samples). For example if we start with 5 candidates, weonly need 2 iterations: 5 candidates for the first iteration, then5//2=2 candidates at the second iteration, after which we know whichcandidate performs the best (so we don’t need a third one). We would only beusing at most 20 samples which is a waste since we have 1000 samples at ourdisposal. On the other hand, if we start with ahigh number ofcandidates, we might end up with a lot of candidates at the last iteration,which may not always be ideal: it means that many candidates will run withthe full resources, basically reducing the procedure to standard search.

In the case ofHalvingRandomSearchCV, the number of candidates is setby default such that the last iteration uses as much of the availableresources as possible. ForHalvingGridSearchCV, the number ofcandidates is determined by theparam_grid parameter. Changing the value ofmin_resources will impact the number of possible iterations, and as aresult will also have an effect on the ideal number of candidates.

Another consideration when choosingmin_resources is whether or not itis easy to discriminate between good and bad candidates with a small amountof resources. For example, if you need a lot of samples to distinguishbetween good and bad parameters, a highmin_resources is recommended. Onthe other hand if the distinction is clear even with a small amount ofsamples, then a smallmin_resources may be preferable since it wouldspeed up the computation.

Notice in the example above that the last iteration does not use the maximumamount of resources available: 1000 samples are available, yet only 640 areused, at most. By default, bothHalvingRandomSearchCV andHalvingGridSearchCV try to use as many resources as possible in thelast iteration, with the constraint that this amount of resources must be amultiple of bothmin_resources andfactor (this constraint will be clearin the next section).HalvingRandomSearchCV achieves this bysampling the right amount of candidates, whileHalvingGridSearchCVachieves this by properly settingmin_resources.

Amount of resource and number of candidates at each iteration#

At any iterationi, each candidate is allocated a given amount of resourceswhich we denoten_resources_i. This quantity is controlled by theparametersfactor andmin_resources as follows (factor is strictlygreater than 1):

n_resources_i=factor**i*min_resources,

or equivalently:

n_resources_{i+1}=n_resources_i*factor

wheremin_resources==n_resources_0 is the amount of resources used atthe first iteration.factor also defines the proportions of candidatesthat will be selected for the next iteration:

n_candidates_i=n_candidates//(factor**i)

or equivalently:

n_candidates_0=n_candidatesn_candidates_{i+1}=n_candidates_i//factor

So in the first iteration, we usemin_resources resourcesn_candidates times. In the second iteration, we usemin_resources*factor resourcesn_candidates//factor times. The third againmultiplies the resources per candidate and divides the number of candidates.This process stops when the maximum amount of resource per candidate isreached, or when we have identified the best candidate. The best candidateis identified at the iteration that is evaluatingfactor or less candidates(see just below for an explanation).

Here is an example withmin_resources=3 andfactor=2, starting with70 candidates:

n_resources_i

n_candidates_i

3 (=min_resources)

70 (=n_candidates)

3 * 2 = 6

70 // 2 = 35

6 * 2 = 12

35 // 2 = 17

12 * 2 = 24

17 // 2 = 8

24 * 2 = 48

8 // 2 = 4

48 * 2 = 96

4 // 2 = 2

We can note that:

  • the process stops at the first iteration which evaluatesfactor=2candidates: the best candidate is the best out of these 2 candidates. Itis not necessary to run an additional iteration, since it would onlyevaluate one candidate (namely the best one, which we have alreadyidentified). For this reason, in general, we want the last iteration torun at mostfactor candidates. If the last iteration evaluates morethanfactor candidates, then this last iteration reduces to a regularsearch (as inRandomizedSearchCV orGridSearchCV).

  • eachn_resources_i is a multiple of bothfactor andmin_resources (which is confirmed by its definition above).

The amount of resources that is used at each iteration can be found in then_resources_ attribute.

Choosing a resource#

By default, the resource is defined in terms of number of samples. That is,each iteration will use an increasing amount of samples to train on. You canhowever manually specify a parameter to use as the resource with theresource parameter. Here is an example where the resource is defined interms of the number of estimators of a random forest:

>>>fromsklearn.datasetsimportmake_classification>>>fromsklearn.ensembleimportRandomForestClassifier>>>fromsklearn.experimentalimportenable_halving_search_cv# noqa>>>fromsklearn.model_selectionimportHalvingGridSearchCV>>>importpandasaspd>>>param_grid={'max_depth':[3,5,10],...'min_samples_split':[2,5,10]}>>>base_estimator=RandomForestClassifier(random_state=0)>>>X,y=make_classification(n_samples=1000,random_state=0)>>>sh=HalvingGridSearchCV(base_estimator,param_grid,cv=5,...factor=2,resource='n_estimators',...max_resources=30).fit(X,y)>>>sh.best_estimator_RandomForestClassifier(max_depth=5, n_estimators=24, random_state=0)

Note that it is not possible to budget on a parameter that is part of theparameter grid.

Exhausting the available resources#

As mentioned above, the number of resources that is used at each iterationdepends on themin_resources parameter.If you have a lot of resources available but start with a low number ofresources, some of them might be wasted (i.e. not used):

>>>fromsklearn.datasetsimportmake_classification>>>fromsklearn.svmimportSVC>>>fromsklearn.experimentalimportenable_halving_search_cv# noqa>>>fromsklearn.model_selectionimportHalvingGridSearchCV>>>importpandasaspd>>>param_grid={'kernel':('linear','rbf'),...'C':[1,10,100]}>>>base_estimator=SVC(gamma='scale')>>>X,y=make_classification(n_samples=1000)>>>sh=HalvingGridSearchCV(base_estimator,param_grid,cv=5,...factor=2,min_resources=20).fit(X,y)>>>sh.n_resources_[20, 40, 80]

The search process will only use 80 resources at most, while our maximumamount of available resources isn_samples=1000. Here, we havemin_resources=r_0=20.

ForHalvingGridSearchCV, by default, themin_resources parameteris set to ‘exhaust’. This means thatmin_resources is automatically setsuch that the last iteration can use as many resources as possible, withinthemax_resources limit:

>>>sh=HalvingGridSearchCV(base_estimator,param_grid,cv=5,...factor=2,min_resources='exhaust').fit(X,y)>>>sh.n_resources_[250, 500, 1000]

min_resources was here automatically set to 250, which results in the lastiteration using all the resources. The exact value that is used depends onthe number of candidate parameters, onmax_resources and onfactor.

ForHalvingRandomSearchCV, exhausting the resources can be done in 2ways:

  • by settingmin_resources='exhaust', just like forHalvingGridSearchCV;

  • by settingn_candidates='exhaust'.

Both options are mutually exclusive: usingmin_resources='exhaust' requiresknowing the number of candidates, and symmetricallyn_candidates='exhaust'requires knowingmin_resources.

In general, exhausting the total number of resources leads to a better finalcandidate parameter, and is slightly more time-intensive.

3.2.3.1.Aggressive elimination of candidates#

Using theaggressive_elimination parameter, you can force the searchprocess to end up with less thanfactor candidates at the lastiteration.

Code example of aggressive elimination#

Ideally, we want the last iteration to evaluatefactor candidates. Wethen just have to pick the best one. When the number of available resources issmall with respect to the number of candidates, the last iteration may have toevaluate more thanfactor candidates:

>>>fromsklearn.datasetsimportmake_classification>>>fromsklearn.svmimportSVC>>>fromsklearn.experimentalimportenable_halving_search_cv# noqa>>>fromsklearn.model_selectionimportHalvingGridSearchCV>>>importpandasaspd>>>param_grid={'kernel':('linear','rbf'),...'C':[1,10,100]}>>>base_estimator=SVC(gamma='scale')>>>X,y=make_classification(n_samples=1000)>>>sh=HalvingGridSearchCV(base_estimator,param_grid,cv=5,...factor=2,max_resources=40,...aggressive_elimination=False).fit(X,y)>>>sh.n_resources_[20, 40]>>>sh.n_candidates_[6, 3]

Since we cannot use more thanmax_resources=40 resources, the processhas to stop at the second iteration which evaluates more thanfactor=2candidates.

When usingaggressive_elimination, the process will eliminate as manycandidates as necessary usingmin_resources resources:

>>>sh=HalvingGridSearchCV(base_estimator,param_grid,cv=5,...factor=2,...max_resources=40,...aggressive_elimination=True,...).fit(X,y)>>>sh.n_resources_[20, 20, 40]>>>sh.n_candidates_[6, 3, 2]

Notice that we end with 2 candidates at the last iteration since we haveeliminated enough candidates during the first iterations, usingn_resources=min_resources=20.

3.2.3.2.Analyzing results with thecv_results_ attribute#

Thecv_results_ attribute contains useful information for analyzing theresults of a search. It can be converted to a pandas dataframe withdf=pd.DataFrame(est.cv_results_). Thecv_results_ attribute ofHalvingGridSearchCV andHalvingRandomSearchCV is similarto that ofGridSearchCV andRandomizedSearchCV, withadditional information related to the successive halving process.

Example of a (truncated) output dataframe:#

iter

n_resources

mean_test_score

params

0

0

125

0.983667

{‘criterion’: ‘log_loss’, ‘max_depth’: None, ‘max_features’: 9, ‘min_samples_split’: 5}

1

0

125

0.983667

{‘criterion’: ‘gini’, ‘max_depth’: None, ‘max_features’: 8, ‘min_samples_split’: 7}

2

0

125

0.983667

{‘criterion’: ‘gini’, ‘max_depth’: None, ‘max_features’: 10, ‘min_samples_split’: 10}

3

0

125

0.983667

{‘criterion’: ‘log_loss’, ‘max_depth’: None, ‘max_features’: 6, ‘min_samples_split’: 6}

15

2

500

0.951958

{‘criterion’: ‘log_loss’, ‘max_depth’: None, ‘max_features’: 9, ‘min_samples_split’: 10}

16

2

500

0.947958

{‘criterion’: ‘gini’, ‘max_depth’: None, ‘max_features’: 10, ‘min_samples_split’: 10}

17

2

500

0.951958

{‘criterion’: ‘gini’, ‘max_depth’: None, ‘max_features’: 10, ‘min_samples_split’: 4}

18

3

1000

0.961009

{‘criterion’: ‘log_loss’, ‘max_depth’: None, ‘max_features’: 9, ‘min_samples_split’: 10}

19

3

1000

0.955989

{‘criterion’: ‘gini’, ‘max_depth’: None, ‘max_features’: 10, ‘min_samples_split’: 4}

Each row corresponds to a given parameter combination (a candidate) and a giveniteration. The iteration is given by theiter column. Then_resourcescolumn tells you how many resources were used.

In the example above, the best parameter combination is{'criterion':'log_loss','max_depth':None,'max_features':9,'min_samples_split':10}since it has reached the last iteration (3) with the highest score:0.96.

References

[1]

K. Jamieson, A. Talwalkar,Non-stochastic Best Arm Identification and HyperparameterOptimization, inproc. of Machine Learning Research, 2016.

[2]

L. Li, K. Jamieson, G. DeSalvo, A. Rostamizadeh, A. Talwalkar,Hyperband: A Novel Bandit-Based Approach to Hyperparameter Optimization, in Machine Learning Research 18, 2018.

3.2.4.Tips for parameter search#

3.2.4.1.Specifying an objective metric#

By default, parameter search uses thescore function of the estimator toevaluate a parameter setting. These are thesklearn.metrics.accuracy_score for classification andsklearn.metrics.r2_score for regression. For some applications, otherscoring functions are better suited (for example in unbalanced classification,the accuracy score is often uninformative), seeWhich scoring function should I use?for some guidance. An alternative scoring function can be specified via thescoring parameter of most parameter search tools, seeThe scoring parameter: defining model evaluation rules for more details.

3.2.4.2.Specifying multiple metrics for evaluation#

GridSearchCV andRandomizedSearchCV allow specifyingmultiple metrics for thescoring parameter.

Multimetric scoring can either be specified as a list of strings of predefinedscores names or a dict mapping the scorer name to the scorer function and/orthe predefined scorer name(s). SeeUsing multiple metric evaluation for more details.

When specifying multiple metrics, therefit parameter must be set to themetric (string) for which thebest_params_ will be found and used to buildthebest_estimator_ on the whole dataset. If the search should not berefit, setrefit=False. Leaving refit to the default valueNone willresult in an error when using multiple metrics.

SeeDemonstration of multi-metric evaluation on cross_val_score and GridSearchCVfor an example usage.

HalvingRandomSearchCV andHalvingGridSearchCV do not supportmultimetric scoring.

3.2.4.3.Composite estimators and parameter spaces#

GridSearchCV andRandomizedSearchCV allow searching overparameters of composite or nested estimators such asPipeline,ColumnTransformer,VotingClassifier orCalibratedClassifierCV using a dedicated<estimator>__<parameter> syntax:

>>>fromsklearn.model_selectionimportGridSearchCV>>>fromsklearn.calibrationimportCalibratedClassifierCV>>>fromsklearn.ensembleimportRandomForestClassifier>>>fromsklearn.datasetsimportmake_moons>>>X,y=make_moons()>>>calibrated_forest=CalibratedClassifierCV(...estimator=RandomForestClassifier(n_estimators=10))>>>param_grid={...'estimator__max_depth':[2,4,6,8]}>>>search=GridSearchCV(calibrated_forest,param_grid,cv=5)>>>search.fit(X,y)GridSearchCV(cv=5,             estimator=CalibratedClassifierCV(estimator=RandomForestClassifier(n_estimators=10)),             param_grid={'estimator__max_depth': [2, 4, 6, 8]})

Here,<estimator> is the parameter name of the nested estimator,in this caseestimator.If the meta-estimator is constructed as a collection of estimators as inpipeline.Pipeline, then<estimator> refers to the name of the estimator,seeAccess to nested parameters. In practice, there can be severallevels of nesting:

>>>fromsklearn.pipelineimportPipeline>>>fromsklearn.feature_selectionimportSelectKBest>>>pipe=Pipeline([...('select',SelectKBest()),...('model',calibrated_forest)])>>>param_grid={...'select__k':[1,2],...'model__estimator__max_depth':[2,4,6,8]}>>>search=GridSearchCV(pipe,param_grid,cv=5).fit(X,y)

Please refer toPipeline: chaining estimators for performing parameter searches overpipelines.

3.2.4.4.Model selection: development and evaluation#

Model selection by evaluating various parameter settings can be seen as a wayto use the labeled data to “train” the parameters of the grid.

When evaluating the resulting model it is important to do it onheld-out samples that were not seen during the grid search process:it is recommended to split the data into adevelopment set (tobe fed to theGridSearchCV instance) and anevaluation setto compute performance metrics.

This can be done by using thetrain_test_splitutility function.

3.2.4.5.Parallelism#

The parameter search tools evaluate each parameter combination on each datafold independently. Computations can be run in parallel by using the keywordn_jobs=-1. See function signature for more details, and also the Glossaryentry forn_jobs.

3.2.4.6.Robustness to failure#

Some parameter settings may result in a failure tofit one or more folds ofthe data. By default, the score for those settings will benp.nan. This canbe controlled by settingerror_score="raise" to raise an exception if one fitfails, or for exampleerror_score=0 to set another value for the score offailing parameter combinations.

3.2.5.Alternatives to brute force parameter search#

3.2.5.1.Model specific cross-validation#

Some models can fit data for a range of values of some parameter almostas efficiently as fitting the estimator for a single value of theparameter. This feature can be leveraged to perform a more efficientcross-validation used for model selection of this parameter.

The most common parameter amenable to this strategy is the parameterencoding the strength of the regularizer. In this case we say that wecompute theregularization path of the estimator.

Here is the list of such models:

linear_model.ElasticNetCV(*[, l1_ratio, ...])

Elastic Net model with iterative fitting along a regularization path.

linear_model.LarsCV(*[, fit_intercept, ...])

Cross-validated Least Angle Regression model.

linear_model.LassoCV(*[, eps, n_alphas, ...])

Lasso linear model with iterative fitting along a regularization path.

linear_model.LassoLarsCV(*[, fit_intercept, ...])

Cross-validated Lasso, using the LARS algorithm.

linear_model.LogisticRegressionCV(*[, Cs, ...])

Logistic Regression CV (aka logit, MaxEnt) classifier.

linear_model.MultiTaskElasticNetCV(*[, ...])

Multi-task L1/L2 ElasticNet with built-in cross-validation.

linear_model.MultiTaskLassoCV(*[, eps, ...])

Multi-task Lasso model trained with L1/L2 mixed-norm as regularizer.

linear_model.OrthogonalMatchingPursuitCV(*)

Cross-validated Orthogonal Matching Pursuit model (OMP).

linear_model.RidgeCV([alphas, ...])

Ridge regression with built-in cross-validation.

linear_model.RidgeClassifierCV([alphas, ...])

Ridge classifier with built-in cross-validation.

3.2.5.2.Information Criterion#

Some models can offer an information-theoretic closed-form formula of theoptimal estimate of the regularization parameter by computing a singleregularization path (instead of several when using cross-validation).

Here is the list of models benefiting from the Akaike InformationCriterion (AIC) or the Bayesian Information Criterion (BIC) for automatedmodel selection:

linear_model.LassoLarsIC([criterion, ...])

Lasso model fit with Lars using BIC or AIC for model selection.

3.2.5.3.Out of Bag Estimates#

When using ensemble methods based upon bagging, i.e. generating newtraining sets using sampling with replacement, part of the training setremains unused. For each classifier in the ensemble, a different partof the training set is left out.

This left out portion can be used to estimate the generalization errorwithout having to rely on a separate validation set. This estimatecomes “for free” as no additional data is needed and can be used formodel selection.

This is currently implemented in the following classes:

ensemble.RandomForestClassifier([...])

A random forest classifier.

ensemble.RandomForestRegressor([...])

A random forest regressor.

ensemble.ExtraTreesClassifier([...])

An extra-trees classifier.

ensemble.ExtraTreesRegressor([n_estimators, ...])

An extra-trees regressor.

ensemble.GradientBoostingClassifier(*[, ...])

Gradient Boosting for classification.

ensemble.GradientBoostingRegressor(*[, ...])

Gradient Boosting for regression.