inversion_ideas.base.Scaled#

class inversion_ideas.base.Scaled(multiplier, function)[source]#

Scaled objective function.

Important

This class is not meant to be instantiated. Multiply an Objective by a scalar to generate a Scaled object.

Parameters:
multiplierfloat or numbers.Real

Multiplier for the objective function. It can be a float or any instance of numbers.Real.

functioninversion_ideas.base.Objective

Objective function that will get scaled.

Attributes

function

Objective function that gets scaled.

multiplier

Scalar multiplier.

n_params

Number of model parameters.

name

Name of the objective function.

Methods

__call__(model)

Evaluate the objective function for a given model.

gradient(model)

Evaluate the gradient of the objective function for a given model.

hessian(model)

Evaluate the hessian of the objective function for a given model.

hessian_diagonal(model)

Get the main diagonal of the Hessian.

info()

Get information about the objective function.

set_name(value)

Set name for the objective function.

Attributes#

Scaled.function#

Objective function that gets scaled.

Scaled.multiplier#

Scalar multiplier.

Scaled.n_params#

Number of model parameters.

Scaled.name#

Name of the objective function.

Methods#

Methods documentation

Scaled.__call__(model)[source]#

Evaluate the objective function for a given model.

Parameters:
model(n_params,) array

Array with model values.

Returns:
float

Value of the objective function for the given model.


Scaled.gradient(model)[source]#

Evaluate the gradient of the objective function for a given model.

Parameters:
model(n_params,) array

Array with model values.

Returns:
(n_params,) array

Gradient vector for the given model.


Scaled.hessian(model)[source]#

Evaluate the hessian of the objective function for a given model.

Parameters:
model(n_params,) array

Array with model values.

Returns:
(n_params, n_params) array or LinearOperator

2D array or LinearOperator that represents the Hessian matrix of the objective funciton, or an approximated version of it.


Scaled.hessian_diagonal(model)[source]#

Get the main diagonal of the Hessian.

Parameters:
model(n_params,) array

Array with model values.

Returns:
(n_params,) array

Array containing the diagonal of the Hessian.


Scaled.info()[source]#

Get information about the objective function.


Scaled.set_name(value)[source]#

Set name for the objective function.