mirapy.fitting

Package Contents

class mirapy.fitting.Model1D

Base class for 1-D model.

__call__(self, x)

Return the value of evaluate function by calling it.

Parameters

x – Array of 1-D input values.

Returns

Return the output of the evaluate function.

evaluate(self, x)

Return the value of a model of the given input.

Parameters

x – Array of 1-D input values.

Returns

Return the output of the model.

set_params_from_array(self, params)

Sets the parameters of the model from an array.

Parameters

params – Array of parameter values.

get_params_as_array(self)

Returns the parameters of the model as an array.

class mirapy.fitting.Gaussian1D(amplitude=1.0, mean=0.0, stddev=1.0)

Bases: mirapy.fitting.models.Model1D

One dimensional Gaussian model.

Parameters
  • amplitude – Amplitude.

  • mean – Mean.

  • stddev – Standard deviation.

evaluate(self, x)

Return the value of Gaussian model of the given input.

Parameters

x – Array of 1-D input values.

Returns

Return the output of the model.

set_params_from_array(self, params)

Sets the parameters of the model from an array.

Parameters

params – Array of parameter values.

get_params_as_array(self)

Returns the parameters of the model as an array.

mirapy.fitting.mean_squared_error(y_true, y_pred)

Function for mean squared error.

Parameters
  • y_true – Array of true values.

  • y_pred – Array of predicted values.

Returns

Float. Loss value.

mirapy.fitting.negative_log_likelihood(y_true, y_pred)

Function for negative log-likelihood error.

Parameters
  • y_true – Array of true values.

  • y_pred – Array of predicted values.

Returns

Float. Loss value.

class mirapy.fitting.ParameterEstimation(x, y, model, loss_function, callback=None)

Base class of parameter estimation of a model using regression.

Parameters
  • x – Array of input values.

  • y – Array of target values.

  • model – Model instance.

  • loss_function – Instance of loss function.

  • callback – Callback function.

regression_function(self, params)

Return the output of loss function.

Parameters

params – Array of new parameters of the model.

Returns

Output of loss function.

get_model(self)

Returns a copy of model used in estimation.

Returns

Model instance.

fit(self)

Fits the data into the model using regression.

Returns

Returns the result.