deepensemble.combiner

Methods Combiner or Mixing Models

Base Class Combiner

class deepensemble.combiner.modelcombiner.ModelCombiner(param=None, type_model='regressor')[source]

Base class for mixing output of models.

Parameters:

param : dict

Parameters of combiner method.

type_model : str

Type of model: regressor or classifier

Attributes

_param (dict) Parameters of combiner method.
_type_model (str, “regressor” by default) Type of model: regressor or classifier
get_param(only_values=False)[source]

Getter model combinator parameters.

Returns:

theano.shared

Returns model parameters.

get_type_model()[source]

Get type of model.

Returns:

str

Returns one string with the type of model: “regressor” or “classifier”

output(ensemble_model, _input, prob)[source]

Mixing the output or diversity of ensemble’s models.

Parameters:

ensemble_model : EnsembleModel

Ensemble Model it uses for get ensemble’s models.

_input : theano.tensor.matrix or numpy.array

Input sample.

prob : bool

In the case of classifier if is True the output is probability, for False means the output is translated. Is recommended hold True for training because the translate function is non-differentiable.

Returns:

theano.tensor.matrix

Returns the mixing diversity of ensemble’s models.

predict(ensemble_model, _input)[source]

Compute the diversity of model.

Parameters:

ensemble_model : EnsembleModel

Ensemble model where gets the output.

_input : theano.tensor.matrix or numpy.array

Input sample.

Returns:

numpy.array

Return the diversity of model.

update_parameters(ensemble_model, _input, _target)[source]

Update internal parameters.

Parameters:

ensemble_model : EnsembleModel

Ensemble Model it uses for get ensemble’s models.

_input : theano.tensor.matrix

Input sample.

_target : theano.tensor.matrix

Target sample.

Returns:

OrderedDict

A dictionary mapping each parameter to its update expression.

Methods Combiner Regression

class deepensemble.combiner.averagecombiner.AverageCombiner(**kwargs)[source]

Class for compute the average the output models.

output(ensemble_model, _input, prob)[source]

Average the output of the ensemble’s models.

Parameters:

ensemble_model : EnsembleModel

Ensemble Model it uses for get ensemble’s models.

_input : theano.tensor.matrix or numpy.array

Input sample.

prob : bool

In the case of classifier if is True the output is probability, for False means the output is translated. Is recommended hold True for training because the translate function is non-differentiable.

Returns:

theano.Op

Returns the average of the output models.

class deepensemble.combiner.weightaveragecombiner.WeightAverageCombiner(n_models, **kwargs)[source]

Class for compute the average the output models.

Parameters:

n_models : int

Number of models of ensemble.

References

[R12]Zhi-Hua Zhou. (2012), pp 70: Ensemble Methods Foundations and Algorithms Chapman & Hall/CRC Machine Learning & Pattern Recognition Series.
[R22]M. P. Perrone and L. N. Cooper. When networks disagree: Ensemble method for neural networks. In R. J.Mammone, editor, Artificial Neural Networks for Spech and Vision, pages 126-142. Chapman & Hall, New York, NY, 1993.

Attributes

n_models (int) Number of models in ensemble.
params (theano.shared) This parameter contain the weights of method.
output(ensemble_model, _input, prob)[source]

Average the output of the ensemble’s models.

Parameters:

ensemble_model : EnsembleModel

Ensemble Model it uses for get ensemble’s models.

_input : theano.tensor.matrix or numpy.array

Input sample.

prob : bool

In the case of classifier if is True the output is probability, for False means the output is translated. Is recommended hold True for training because the translate function is non-differentiable.

Returns:

theano.Op

Returns the average of the output models.

update_parameters(ensemble_model, _input, _target)[source]

Update internal parameters.

Parameters:

ensemble_model : EnsembleModel

Ensemble Model it uses for get ensemble’s models.

_input : theano.tensor.matrix

Input sample.

_target : theano.tensor.matrix

Target sample.

Returns:

OrderedDict

A dictionary mapping each parameter to its update expression.

class deepensemble.combiner.geometriccombiner.GeometricCombiner(**kwargs)[source]

Class for compute the average the output models.

output(ensemble_model, _input, prob)[source]

Multiplied the output of the ensemble’s models.

Parameters:

ensemble_model : EnsembleModel

Ensemble Model it uses for get ensemble’s models.

_input : theano.tensor.matrix or numpy.array

Input sample.

prob : bool

In the case of classifier if is True the output is probability, for False means the output is translated. Is recommended hold True for training because the translate function is non-differentiable.

Returns:

theano.Op

Returns the average of the output models.

Methods Combiner Classification

class deepensemble.combiner.averagecombiner.PluralityVotingCombiner[source]

Combiner classifier method where each model in ensemble votes by one class and the class with more votes win.

Plurality voting takes the class label which receives the largest number of votes as the final winner. That is, the output class label of the ensemble.

References

[R55]Zhi-Hua Zhou. (2012), pp 73: Ensemble Methods Foundations and Algorithms Chapman & Hall/CRC Machine Learning & Pattern Recognition Series.
output(ensemble_model, _input, prob)[source]

Average the output of the ensemble’s models.

Parameters:

ensemble_model : EnsembleModel

Ensemble Model it uses for get ensemble’s models.

_input : theano.tensor.matrix or numpy.array

Input sample.

prob : bool

In the case of classifier if is True the output is probability, for False means the output is translated. Is recommended hold True for training because the translate function is non-differentiable.

Returns:

theano.Op

Returns the average of the output models.

predict(ensemble_model, _input)[source]

Returns the class with more votes.

Parameters:

ensemble_model : EnsembleModel

Ensemble model where gets the output.

_input : theano.tensor.matrix or numpy.array

Input sample.

Returns:

numpy.array

Return the diversity of model.

class deepensemble.combiner.weightaveragecombiner.WeightedVotingCombiner(n_models)[source]

Class for compute the average the output models.

Parameters:

n_models : int

Number of models of ensemble.

References

[R77]Zhi-Hua Zhou. (2012), pp 74: Ensemble Methods Foundations and Algorithms Chapman & Hall/CRC Machine Learning & Pattern Recognition Series.
output(ensemble_model, _input, prob)[source]

Average the output of the ensemble’s models.

Parameters:

ensemble_model : EnsembleModel

Ensemble Model it uses for get ensemble’s models.

_input : theano.tensor.matrix or numpy.array

Input sample.

prob : bool

In the case of classifier if is True the output is probability, for False means the output is translated. Is recommended hold True for training because the translate function is non-differentiable.

Returns:

theano.Op

Returns the average of the output models.

predict(ensemble_model, _input)[source]

Returns the class with more votes.

Parameters:

ensemble_model : EnsembleModel

Ensemble model where gets the output.

_input : theano.tensor.matrix or numpy.array

Input sample.

Returns:

numpy.array

Return the diversity of model.

class deepensemble.combiner.geometriccombiner.GeometricVotingCombiner[source]

Combiner classifier method where each model in ensemble votes by one class and the class with more votes win.

output(ensemble_model, _input, prob)[source]

Average the output of the ensemble’s models.

Parameters:

ensemble_model : EnsembleModel

Ensemble Model it uses for get ensemble’s models.

_input : theano.tensor.matrix or numpy.array

Input sample.

prob : bool

In the case of classifier if is True the output is probability, for False means the output is translated. Is recommended hold True for training because the translate function is non-differentiable.

Returns:

theano.Op

Returns the average of the output models.

predict(ensemble_model, _input)[source]

Returns the class with more votes.

Parameters:

ensemble_model : EnsembleModel

Ensemble model where gets the output.

_input : theano.tensor.matrix or numpy.array

Input sample.

Returns:

numpy.array

Return the diversity of model.