Class

NumCosmoMathFit

Description [src]

abstract class NumCosmoMath.Fit : GObject.Object
{
  /* No available fields */
}

Abstract class for implementing fitting methods.

This object implements a abstract class for implementing fitting methods.

Ancestors

Functions

ncm_fit_clear

The reference count of fit is decreased and the pointer is set to NULL.

ncm_fit_factory

Creates a new NcmFit object.

Instance methods

ncm_fit_add_equality_constraint

Adds an equality constraint with the function func and the tolerance tot.

ncm_fit_add_inequality_constraint

Adds an inequality constraint with the function func and the tolerance tot.

ncm_fit_chisq_test
No description available.

ncm_fit_copy_new

Duplicates the NcmFit object with new references for its contents.

ncm_fit_covar_cor

Computes the correlation between the parameters pid1 and pid2 of the models mid1 and mid2, respectively.

ncm_fit_covar_cov

Computes the covariance between the parameters pid1 and pid2 of the models mid1 and mid2, respectively.

ncm_fit_covar_fparam_cor

Computes the correlation between the fitted parameters fpi1 and fpi2. These indices refers to the list of all FREE parameters set in the MSet.

ncm_fit_covar_fparam_cov

Computes the covariance between the fitted parameters fpi1 and fpi2. These indices refers to the list of all FREE parameters set in the MSet.

ncm_fit_covar_fparam_sd

Computes the standard deviation of the fitted parameter fpi. This index refers to the list of all FREE parameters set in the MSet.

ncm_fit_covar_fparam_var

Computes the variance of the fitted parameter fpi. This index refers to the list of all FREE parameters set in the MSet.

ncm_fit_covar_sd

Computes the standard deviation of the fitted parameter pid of the model mid.

ncm_fit_covar_var

Computes the variance of the fitted parameter pid of the model mid.

ncm_fit_data_m2lnL_val

This function computes minus two times the logarithm base e of the likelihood using only the data set and not considering any prior. The result is set on data_m2lnL.

ncm_fit_dup

Duplicates the NcmFit object duplicating all its contents.

ncm_fit_equality_constraints_len

Gets the number of equality constraints.

ncm_fit_fisher

Calculates the covariance from the Fisher matrix, see ncm_dataset_fisher_matrix(). Note that this function does not use the gradient defined in the fit object, it always uses the accurate numerical differentiation methods implemented in the NcmDiff object.

ncm_fit_fisher_bias

Calculates the covariance from the Fisher matrix and the bias vector, see ncm_dataset_fisher_matrix_bias(). The bias vector is calculated using the the theory vector f_true as the true model expectation values.

ncm_fit_free

Atomically decrements the reference count of fit by one. If the reference count drops to 0, all memory allocated by fit is released.

ncm_fit_function_error

Propagates the errors in the free parameters to the function func. If no free parameters are set in the NcmMSet object associated to the fit object, the computed error is 0.

ncm_fit_get_covar

Returns a copy of the covariance matrix (pre-calculated by, e.g, ncm_fit_numdiff_m2lnL_covar()).

ncm_fit_get_desc

Gets the fit object description.

ncm_fit_get_equality_constraint

Gets the equality constraint at index i.

ncm_fit_get_grad_type

Gets the differentiation method to be used.

ncm_fit_get_inequality_constraint

Gets the inequality constraint at index i.

ncm_fit_get_m2lnL_abstol

Gets the absolute tolerance for the m2lnL.

ncm_fit_get_m2lnL_reltol

Gets the relative tolerance for the m2lnL.

ncm_fit_get_maxiter

Gets the maximum number of iterations.

ncm_fit_get_messages

Gets the log level for the messages to be printed during the fit.

ncm_fit_get_params_reltol

Gets the relative tolerance for the fitted parameters.

ncm_fit_get_sub_fit

Gets a NcmFit object to be used as subsidiary fit.

ncm_fit_has_sub_fit

Checks if fit has a subsidiary fit.

ncm_fit_inequality_constraints_len

Gets the number of inequality constraints.

ncm_fit_is_least_squares

Indicates if the least squares fitting is being used (TRUE) or not (FALSE).

ncm_fit_log_covar

Prints to the log file the names and indices of the fitted parameters, their best-fit values, standard deviations and correlation matrix.

ncm_fit_log_end

This function prints in the log the precision with which the best-fit was found.

ncm_fit_log_info

Prints to the log the data set and the model set.

ncm_fit_log_start

This function prints in the log the initial state.

ncm_fit_log_state

This function prints in the log the current state.

ncm_fit_log_step

This function prints in the log one step of the minimization.

ncm_fit_log_step_error

This function prints in the log the error message.

ncm_fit_lr_test

Computes the likelihood ratio test for the parameter pid of the model mid with the value val. The function returns the probability of the null hypothesis assuming a chi-squared distribution with dof degrees of freedom. That is, it computes the left tail of the chi-squared distribution with dof degrees of freedom.

ncm_fit_lr_test_range

Computes the likelihood ratio test for the parameter pid of the model mid in the interval [start, stop] subdivided by nsteps. The function returns a NcmMatrix with the following columns: 1. Parameter value. 2. The difference in -2 times the natural logarithm of the likelihood between the full model and the model with the parameter pid fixed to the value in the first column. 3. The probability density of the difference in -2 times the natural logarithm of the likelihood between the full model and the model with the parameter pid fixed to the value in the first column, assuming a chi-squared distribution with one degree of freedom. 4. Cumulative probability (two-sides) of the difference (Column 3).

ncm_fit_ls_J

Computes the Jacobian matrix for the least squares problem.

ncm_fit_ls_f

Computes the residuals vector.

ncm_fit_ls_f_J

Computes the residuals vector and the Jacobian matrix for the least squares problem.

ncm_fit_ls_fisher

Computes the covariance matrix using the jacobian matrix and the least squares problem, see ncm_fit_ls_J(). Note that this function uses the gradient defined in the fit object using ncm_fit_set_grad_type() to compute the jacobian matrix.

ncm_fit_m2lnL_grad

Computes the gradient of the minus two times the logarithm base e of the likelihood.

ncm_fit_m2lnL_val

Computes minus two times the logarithm base e of the likelihood.

ncm_fit_m2lnL_val_grad

Computes the minus two times the logarithm base e of the likelihood and its gradient.

ncm_fit_numdiff_m2lnL_covar

Calculates the covariance matrix using the inverse of the Hessian matrix $\partial_i\partial_j -\ln(L)$, where the derivatives are taken with respect to the free parameters.

deprecated: 0.18.2 

ncm_fit_numdiff_m2lnL_lndet_covar

Calculates the logarithm of the determinant of the covariance matrix using the inverse of the Hessian matrix $\partial_i\partial_j -\ln(L)$, where the derivatives are taken with respect to the free parameters.

ncm_fit_obs_fisher

Computes the covariance matrix using the inverse of the Hessian matrix $\partial_i\partial_j -\ln(L)$, where the derivatives are taken with respect to the free parameters. This function does not use the gradient defined in the fit object, it always uses the accurate numerical differentiation methods implemented in the NcmDiff object.

ncm_fit_params_set

Sets the parameters vector.

ncm_fit_params_set_array

Sets the parameters from array x.

ncm_fit_params_set_gsl_vector

Sets the parameters from a gsl_vector x.

ncm_fit_params_set_vector

Sets the parameters vector.

ncm_fit_params_set_vector_offset

Sets the parameters from vector x starting at offset.

ncm_fit_params_update

Updates the parameters vector.

ncm_fit_peek_diff

Peeks the NcmDiff object.

ncm_fit_peek_likelihood

Peeks the NcmLikelihood object.

ncm_fit_peek_mset

Peeks the NcmMSet object.

ncm_fit_peek_state

Peeks the NcmFitState object.

ncm_fit_priors_m2lnL_val

This function computes minus two times the logarithm base e of the likelihood using the data set and taking into account the assumed priors. The result is set on priors_m2lnL.

ncm_fit_ref

Increases the reference count of fit.

ncm_fit_remove_equality_constraints

Removes all equality constraints.

ncm_fit_remove_inequality_constraints

Removes all inequality constraints.

ncm_fit_reset

Resets the fit.

ncm_fit_run

Computes the minimization.

ncm_fit_run_restart

Re-runs the fit until the difference between fits are less than the required tolerance, i.e., $$ m2lnL_{i-1} - m2lnL_i < \mathrm{abstol} + \mathrm{reltol}\vert m2lnL_{i-1}\vert. $$.

ncm_fit_set_grad_type

Sets the differentiation method to be used.

ncm_fit_set_logger

Sets the logger functions. The writer function is called to write the messages to the log. The updater function is called to update the parameters. The start_update is called before the minimization starts and the end_update is called after the minimization ends.

ncm_fit_set_m2lnL_abstol

Sets the absolute tolerance for the m2lnL.

ncm_fit_set_m2lnL_reltol

Sets the relative tolerance for the m2lnL.

ncm_fit_set_maxiter

Sets the maximum number of iterations.

ncm_fit_set_messages

Sets the log level for the messages to be printed during the fit.

ncm_fit_set_params_reltol

Sets the relative tolerance for the fitted parameters.

ncm_fit_set_sub_fit

Sets a NcmFit object to be used as subsidiary fit.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

NumCosmoMath.Fit:equality-constraints
No description available.

NumCosmoMath.Fit:equality-constraints-tot
No description available.

NumCosmoMath.Fit:grad-type
No description available.

NumCosmoMath.Fit:inequality-constraints
No description available.

NumCosmoMath.Fit:likelihood
No description available.

NumCosmoMath.Fit:m2lnL-abstol
No description available.

NumCosmoMath.Fit:m2lnL-reltol
No description available.

NumCosmoMath.Fit:maxiter
No description available.

NumCosmoMath.Fit:mset
No description available.

NumCosmoMath.Fit:params-reltol
No description available.

NumCosmoMath.Fit:state
No description available.

NumCosmoMath.Fit:sub-fit
No description available.

Signals

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct NumCosmoMathFitClass {
  NcmFit* (* copy_new) (
    NcmFit* fit,
    NcmLikelihood* lh,
    NcmMSet* mset,
    NcmFitGradType gtype
  );
  void (* reset) (
    NcmFit* fit
  );
  gboolean (* run) (
    NcmFit* fit,
    NcmFitRunMsgs mtype
  );
  const gchar* (* get_desc) (
    NcmFit* fit
  );
  
}

No description available.

Class members
copy_new: NcmFit* (* copy_new) ( NcmFit* fit, NcmLikelihood* lh, NcmMSet* mset, NcmFitGradType gtype )

No description available.

reset: void (* reset) ( NcmFit* fit )

No description available.

run: gboolean (* run) ( NcmFit* fit, NcmFitRunMsgs mtype )

No description available.

get_desc: const gchar* (* get_desc) ( NcmFit* fit )

No description available.

Virtual methods

NumCosmoMath.FitClass.copy_new

Duplicates the NcmFit object with new references for its contents.

NumCosmoMath.FitClass.get_desc

Gets the fit object description.

NumCosmoMath.FitClass.reset

Resets the fit.

NumCosmoMath.FitClass.run

Computes the minimization.