mlrl.common.cython.prediction module

@author: Michael Rapp (michael.rapp.ml@gmail.com)

class mlrl.common.cython.prediction.BinaryPredictor

Bases: object

Allows to predict binary labels for given query examples.

can_predict_incrementally() bool

Returns whether the predictor allows to obtain predictions incrementally or not.

Returns:

True, if the predictor allows to obtain predictions incrementally, False otherwise

create_incremental_predictor(max_rules) IncrementalBinaryPredictor

Creates and returns a predictor that allows to predict binary labels incrementally. If incremental prediction is not supported, a RuntimeError is thrown.

Parameters:

max_rules – The maximum number of rules to be used for prediction. Must be at least 1 or 0, if the number of rules should not be restricted

Returns:

A predictor that allows to predict binary labels incrementally

predict(max_rules) ndarray

Obtains and returns predictions for all query examples.

Parameters:

max_rules – The maximum number of rules to be used for prediction or 0, if the number of rules should not be restricted

Returns:

A numpy.ndarray of type uint8, shape (num_examples, num_labels), that stores the predictions

class mlrl.common.cython.prediction.IncrementalBinaryPredictor

Bases: object

Allows to predict binary labels for given query examples incrementally.

apply_next(step_size) ndarray

Updates the current predictions by considering several of the remaining ensemble members. If not enough ensemble members are remaining, only the available ones will be used for updating the current predictions.

Parameters:

step_size – The number of additional ensemble members to be considered for prediction

Returns:

A numpy.ndarray of type uint8, shape (num_examples, num_labels), that stores the updated predictions

get_num_next() int

Returns the number of remaining ensemble members that have not been used yet.

Returns:

The number of remaining ensemble members

has_next() bool

Returns whether there are any remaining ensemble members that have not been used yet or not.

Returns:

True, if there are any remaining ensemble members, False otherwise

class mlrl.common.cython.prediction.IncrementalProbabilityPredictor

Bases: object

Allows to predict probability estimates for given query examples incrementally.

apply_next(step_size) ndarray

Updates the current predictions by considering several of the remaining ensemble members. If not enough ensemble members are remaining, only the available ones will be used for updating the current predictions.

Parameters:

step_size – The number of additional ensemble members to be considered for prediction

Returns:

A numpy.ndarray of type float64, shape (num_examples, num_labels), that stores the updated predictions

get_num_next() int

Returns the number of remaining ensemble members that have not been used yet.

Returns:

The number of remaining ensemble members

has_next() bool

Returns whether there are any remaining ensemble members that have not been used yet or not.

Returns:

True, if there are any remaining ensemble members, False otherwise

class mlrl.common.cython.prediction.IncrementalScorePredictor

Bases: object

Allows to predict regression scores for given query examples incrementally.

apply_next(step_size) ndarray

Updates the current predictions by considering several of the remaining ensemble members. If not enough ensemble members are remaining, only the available ones will be used for updating the current predictions.

Parameters:

step_size – The number of additional ensemble members to be considered for prediction

Returns:

A numpy.ndarray of type float64, shape (num_examples, num_labels), that stores the updated predictions

get_num_next() int

Returns the number of remaining ensemble members that have not been used yet.

Returns:

The number of remaining ensemble members

has_next() bool

Returns whether there are any remaining ensemble members that have not been used yet or not.

Returns:

True, if there are any remaining ensemble members, False otherwise

class mlrl.common.cython.prediction.IncrementalSparseBinaryPredictor

Bases: object

Allows to predict sparse binary labels for given query examples incrementally.

apply_next(step_size) ndarray

Updates the current predictions by considering several of the remaining ensemble members. If not enough ensemble members are remaining, only the available ones will be used for updating the current predictions.

Parameters:

step_size – The number of additional ensemble members to be considered for prediction

Returns:

A scipy.sparse.csr_matrix of type uint8, shape (num_examples, num_labels) that stores the predictions

get_num_next() int

Returns the number of remaining ensemble members that have not been used yet.

Returns:

The number of remaining ensemble members

has_next() bool

Returns whether there are any remaining ensemble members that have not been used yet or not.

Returns:

True, if there are any remaining ensemble members, False otherwise

class mlrl.common.cython.prediction.ProbabilityPredictor

Bases: object

Allows to predict probability estimates for given query examples.

can_predict_incrementally() bool

Returns whether the predictor allows to obtain predictions incrementally or not.

Returns:

True, if the predictor allows to obtain predictions incrementally, False otherwise

create_incremental_predictor(max_rules) IncrementalProbabilityPredictor

Creates and returns a predictor that allows to predict probability estimates incrementally. If incremental prediction is not supported, a RuntimeError is thrown.

Parameters:

max_rules – The maximum number of rules to be used for prediction. Must be at least 1 or 0, if the number of rules should not be restricted

Returns:

A predictor that allows to predict probability estimates incrementally

predict(max_rules) ndarray

Obtains and returns predictions for all query examples.

Parameters:

max_rules – The maximum number of rules to be used for prediction or 0, if the number of rules should not be restricted

Returns:

A numpy.ndarray of type float64, shape (num_examples, num_labels), that stores the predictions

class mlrl.common.cython.prediction.ScorePredictor

Bases: object

Allows to predict regression scores for given query examples.

can_predict_incrementally() bool

Returns whether the predictor allows to obtain predictions incrementally or not.

Returns:

True, if the predictor allows to obtain predictions incrementally, False otherwise

create_incremental_predictor(max_rules) IncrementalScorePredictor

Creates and returns a predictor that allows to predict regression scores incrementally. If incremental prediction is not supported, a RuntimeError is thrown.

Parameters:

max_rules – The maximum number of rules to be used for prediction. Must be at least 1 or 0, if the number of rules should not be restricted

Returns:

A predictor that allows to predict regression scores incrementally

predict(max_rules) ndarray

Obtains and returns predictions for all query examples.

Parameters:

max_rules – The maximum number of rules to be used for prediction or 0, if the number of rules should not be restricted

Returns:

A numpy.ndarray of type float64, shape (num_examples, num_labels), that stores the predictions

class mlrl.common.cython.prediction.SparseBinaryPredictor

Bases: object

Allows to predict sparse binary labels for given query examples.

can_predict_incrementally() bool

Returns whether the predictor allows to obtain predictions incrementally or not.

Returns:

True, if the predictor allows to obtain predictions incrementally, False otherwise

create_incremental_predictor(max_rules) IncrementalSparseBinaryPredictor

Creates and returns a predictor that allows to predict sparse binary labels incrementally. If incremental prediction is not supported, a RuntimeError is thrown.

Parameters:

max_rules – The maximum number of rules to be used for prediction. Must be at least 1 or 0, if the number of rules should not be restricted

Returns:

A predictor that allows to predict sparse binary labels incrementally

predict(max_rules) csr_matrix

Obtains and returns predictions for all query examples.

Parameters:

max_rules – The maximum number of rules to be used for prediction or 0, if the number of rules should not be restricted

Returns:

A scipy.sparse.csr_matrix of type uint8, shape (num_examples, num_labels) that stores the predictions