autogl.module.ensemble

class autogl.module.ensemble.Voting(ensemble_size=10, *args, **kwargs)[source]

An ensembler using the voting method.

Parameters:ensemble_size (int) – The number of base models selected by the voter. These selected models can be redundant. Default as 10.
ensemble(predictions, identifiers, *args, **kwargs)[source]

Ensemble the predictions of base models.

Parameters:
  • predictions (a list of np.ndarray) – Predictions of base learners (corresponding to the elements in identifiers).
  • identifiers (a list of str) – The names of base models.
Returns:

The ensembled predictions.

Return type:

np.ndarray

fit(predictions, label, identifiers, feval, *args, **kwargs)[source]

Fit the ensembler to the given data using Rich Caruana’s ensemble selection method.

Parameters:
  • predictions (a list of np.ndarray) – Predictions of base learners (corresponding to the elements in identifiers).
  • labels (a list of int) – Class labels of instances.
  • identifiers (a list of str) – The names of base models.
  • feval ((a list of) instances in autogl.module.train.evaluate) – Performance evaluation metrices.
Returns:

The validation performance of the final voter.

Return type:

(a list of) float

class autogl.module.ensemble.Stacking(meta_model='gbm', meta_params={}, *args, **kwargs)[source]

A stacking ensembler. Currently we support gradient boosting as the meta-algorithm.

Parameters:
  • meta_model ('gbm' or 'glm' (Optional)) –
    Type of the stacker:
    ’gbm’ : Gradient boosting model. This is the default. ‘glm’ : Generalized linear model.
  • meta_params (a dict (Optional)) – When meta_model is specified, you can customize the parameters of the stacker. If this argument is not provided, the stacker will be configurated with default parameters. Default {}.
ensemble(predictions, identifiers, *args, **kwargs)[source]

Ensemble the predictions of base models.

Parameters:
  • predictions (a list of np.ndarray) – Predictions of base learners (corresponding to the elements in identifiers).
  • identifiers (a list of str) – The names of base models.
Returns:

The ensembled predictions.

Return type:

np.ndarray

fit(predictions, label, identifiers, feval, n_classes='auto', *args, **kwargs)[source]

Fit the ensembler to the given data using Stacking method.

Parameters:
  • predictions (a list of np.ndarray) – Predictions of base learners (corresponding to the elements in identifiers).
  • label (a list of int) – Class labels of instances.
  • identifiers (a list of str) – The names of base models.
  • feval ((a list of) autogl.module.train.evaluate) – Performance evaluation metrices.
  • n_classes (int or str (Optional)) – The number of classes. Default as 'auto', which will use maximum label.
Returns:

The validation performance of the final stacker.

Return type:

(a list of) float

autogl.module.ensemble.build_ensembler_from_name(name: str) → autogl.module.ensemble.base.BaseEnsembler[source]
Parameters:name (str) – the name of ensemble module.
Returns:the ensembler built using default parameters
Return type:BaseEnsembler
Raises:AssertionError – If an invalid name is passed in