deepsensor.active_learning.acquisition_fns

deepsensor.active_learning.acquisition_fns#

class AcquisitionFunction(model=None, context_set_idx=0, target_set_idx=0)[source]#

Parent class for acquisition functions.

__call__(task, *args, **kwargs)[source]#

No-index:

Parameters:

task (Task) – Task object containing context and target sets.

Returns:

numpy.ndarray – Acquisition function value/s. Shape ().

Raises:

NotImplementedError – Because this is an abstract method, it must be implemented by the subclass.

min_or_max = None#
class AcquisitionFunctionOracle(model=None, context_set_idx=0, target_set_idx=0)[source]#

Signifies that the acquisition function is computed using the true target values.

class AcquisitionFunctionParallel(model=None, context_set_idx=0, target_set_idx=0)[source]#

Parent class for acquisition functions that are computed across all search points in parallel.

__call__(task, X_s, **kwargs)[source]#

Parameters:
  • **kwargs

  • task (Task) – Task object containing context and target sets.

  • X_s (numpy.ndarray) – Search points. Shape (2, N_search).

No-index:

Returns:

numpy.ndarray – Should return acquisition function value/s. Shape (N_search,).

Raises:

NotImplementedError – Because this is an abstract method, it must be implemented by the subclass.

class ContextDist(model=None, context_set_idx=0, target_set_idx=0)[source]#

Distance to closest context point.

__call__(task, X_s, **kwargs)[source]#

Parameters:
  • **kwargs

  • task (Task) – [Description of the task parameter.]

  • X_s (numpy.ndarray) – [Description of the X_s parameter.]

No-index:

Returns:

[Type of the return value] – [Description of the return value.]

min_or_max = 'max'#
class ExpectedImprovement(model=None, context_set_idx=0, target_set_idx=0)[source]#

Expected improvement acquisition function.

Note

The current implementation of this acquisition function is only valid for maximisation.

__call__(task, X_s, **kwargs)[source]#
Parameters:
  • **kwargs

  • task (Task) – Task object containing context and target sets.

  • X_s (numpy.ndarray) – Search points. Shape (2, N_search).

No-index:

Returns:

numpy.ndarray – Acquisition function value/s. Shape (N_search,).

min_or_max = 'max'#
class JointEntropy(model=None, context_set_idx=0, target_set_idx=0)[source]#

Joint entropy of the predictive distribution.

__call__(task)[source]#

No-index:

Parameters:

task (Task) – Task object containing context and target sets.

Returns:

[Type of the return value] – [Description of the return value.]

min_or_max = 'min'#
class MeanMarginalEntropy(model=None, context_set_idx=0, target_set_idx=0)[source]#

Mean of the entropies of the marginal predictive distributions.

__call__(task)[source]#

No-index:

Parameters:

task (Task) – Task object containing context and target sets.

Returns:

[Type of the return value] – [Description of the return value.]

min_or_max = 'min'#
class MeanStddev(model=None, context_set_idx=0, target_set_idx=0)[source]#

Mean of the marginal variances.

__call__(task)[source]#

No-index:

Parameters:

task (Task) – [Description of the task parameter.]

Returns:

[Type of the return value] – [Description of the return value.]

min_or_max = 'min'#
class MeanVariance(model=None, context_set_idx=0, target_set_idx=0)[source]#

Mean of the marginal variances.

__call__(task)[source]#

No-index:

Parameters:

task (Task) – [Description of the task parameter.]

Returns:

[Type of the return value] – [Description of the return value.]

min_or_max = 'min'#
class OracleJointNLL(model=None, context_set_idx=0, target_set_idx=0)[source]#

Oracle joint negative log-likelihood.

__call__(task)[source]#

No-index:

Parameters:

task (Task) – Task object containing context and target sets.

Returns:

[Type of the return value] – [Description of the return value.]

min_or_max = 'min'#
class OracleMAE(model=None, context_set_idx=0, target_set_idx=0)[source]#

Oracle mean absolute error.

__call__(task)[source]#

No-index:

Parameters:

task (Task) – Task object containing context and target sets.

Returns:

[Type of the return value] – [Description of the return value.]

min_or_max = 'min'#
class OracleMarginalNLL(model=None, context_set_idx=0, target_set_idx=0)[source]#

Oracle marginal negative log-likelihood.

__call__(task)[source]#

No-index:

Parameters:

task (Task) – Task object containing context and target sets.

Returns:

[Type of the return value] – [Description of the return value.]

min_or_max = 'min'#
class OracleRMSE(model=None, context_set_idx=0, target_set_idx=0)[source]#

Oracle root mean squared error.

__call__(task)[source]#

No-index:

Parameters:

task (Task) – Task object containing context and target sets.

Returns:

[Type of the return value] – [Description of the return value.]

min_or_max = 'min'#
class Random(*args, seed=42, **kwargs)[source]#

Random acquisition function.

__call__(task, X_s, **kwargs)[source]#

Parameters:
  • **kwargs

  • task (Task) – [Description of the task parameter.]

  • X_s (numpy.ndarray) – [Description of the X_s parameter.]

No-index:

Returns:

float – A random acquisition function value.

min_or_max = 'max'#
class Stddev(model=None, context_set_idx=0, target_set_idx=0)[source]#

Model standard deviation.

__call__(task, X_s, **kwargs)[source]#

Parameters:
  • **kwargs

  • task (Task) – [Description of the task parameter.]

  • X_s (numpy.ndarray) – [Description of the X_s parameter.]

No-index:

Returns:

[Type of the return value] – [Description of the return value.]

min_or_max = 'max'#
class pNormStddev(*args, p=1, **kwargs)[source]#

p-norm of the vector of marginal standard deviations.

__call__(task)[source]#

No-index:

Parameters:

task (Task) – [Description of the task parameter.]

Returns:

[Type of the return value] – [Description of the return value.]

min_or_max = 'min'#