|
Mantid
|
In contrast to CostFuncLeastSquares, this variant of the cost function assumes that there are no weights attached to the values, so all observations will have unit weights. More...
#include <CostFuncUnweightedLeastSquares.h>
Public Member Functions | |
| CostFuncUnweightedLeastSquares () | |
| std::string | name () const override |
| Get name of minimizer. | |
| std::string | shortName () const override |
| Get short name of minimizer - useful for say labels in guis. | |
Public Member Functions inherited from Mantid::CurveFitting::CostFunctions::CostFuncLeastSquares | |
| CostFuncLeastSquares () | |
| Constructor. | |
Public Member Functions inherited from Mantid::CurveFitting::CostFunctions::CostFuncFitting | |
| void | applyTies () |
| Apply ties in the fitting function. | |
| virtual void | calCovarianceMatrix (EigenMatrix &covar, double epsrel=1e-8) |
| Calculates covariance matrix. | |
| virtual void | calFittingErrors (const EigenMatrix &covar, double chi2) |
| Calculate fitting errors. | |
| CostFuncFitting () | |
| Constructor. | |
| virtual void | deriv (std::vector< double > &der) const override |
| Calculate the derivatives of the cost function. | |
| void | drop () |
| Discard saved parameters, derivatives and hessian. | |
| const EigenVector & | getDeriv () const |
| Return cached or calculate the drivatives. | |
| API::FunctionDomain_sptr | getDomain () const |
| Get the domain the fitting function is applied to. | |
| virtual API::IFunction_sptr | getFittingFunction () const |
| Get fitting function. | |
| const EigenMatrix & | getHessian () const |
| Return cached or calculate the Hessian. | |
| double | getParameter (size_t i) const override |
| Get i-th parameter. | |
| void | getParameters (EigenVector ¶ms) const |
| Get all parameters into a GSLVector. | |
| API::FunctionValues_sptr | getValues () const |
| Get FunctionValues where function values are stored. | |
| size_t | nParams () const override |
| Number of parameters. | |
| std::string | parameterName (size_t i) const |
| Get name of i-th parameter. | |
| void | pop () |
| Restore saved parameters, derivatives and hessian. | |
| void | push () |
| Save current parameters, derivatives and hessian. | |
| void | reset () const |
| Reset the fitting function (neccessary if parameters get fixed/unfixed) | |
| virtual void | setFittingFunction (API::IFunction_sptr function, API::FunctionDomain_sptr domain, API::FunctionValues_sptr values) |
| Set fitting function. | |
| void | setIgnoreInvalidData (bool ignoreInvalidData) |
| Set to ignore invalid data. | |
| void | setParameter (size_t i, const double &value) override |
| Set i-th parameter. | |
| void | setParameters (const EigenVector ¶ms) |
| Set all parameters. | |
| virtual double | val () const override |
| Calculate value of cost function. | |
| virtual double | valAndDeriv (std::vector< double > &der) const override |
| Calculate the value and the derivatives of the cost function. | |
| virtual double | valDerivHessian (bool evalDeriv=true, bool evalHessian=true) const |
| Calculate the value, the first and the second derivatives of the cost function. | |
Public Member Functions inherited from Mantid::API::ICostFunction | |
| virtual | ~ICostFunction ()=default |
| Virtual destructor. | |
Protected Member Functions | |
| void | calActiveCovarianceMatrix (EigenMatrix &covar, double epsrel) override |
| Calculates covariance matrix for fitting function's active parameters. | |
| std::vector< double > | getFitWeights (API::FunctionValues_sptr values) const override |
| Return unit weights for all data points. | |
| double | getResidualVariance () const |
| Calculates the residual variance from the internally stored FunctionValues. | |
| void | updateValidateFitWeights () override |
| Update the fit weights of m_values so that correct fit weights are used by the minimizer and GSLFunctions. | |
Protected Member Functions inherited from Mantid::CurveFitting::CostFunctions::CostFuncLeastSquares | |
| void | addVal (API::FunctionDomain_sptr domain, API::FunctionValues_sptr values) const override |
| Add a contribution to the cost function value from the fitting function evaluated on a particular domain. | |
| void | addValDerivHessian (API::IFunction_sptr function, API::FunctionDomain_sptr domain, API::FunctionValues_sptr values, bool evalDeriv=true, bool evalHessian=true) const override |
| Update the cost function, derivatives and hessian by adding values calculated on a domain. | |
Protected Member Functions inherited from Mantid::CurveFitting::CostFunctions::CostFuncFitting | |
| void | calTransformationMatrixNumerically (EigenMatrix &tm) |
| Calculate the transformation matrix T by numeric differentiation. | |
| void | checkValidity () const |
| Throw a runtime_error if function is invalid. | |
| bool | isValid () const |
| Is the function set and valid? | |
| void | setDirty () |
| Set all dirty flags. | |
| void | validateNegativeFitWeights () |
| Functionality to validate negative fit weights. | |
Additional Inherited Members | |
Protected Attributes inherited from Mantid::CurveFitting::CostFunctions::CostFuncLeastSquares | |
| double | m_factor |
Protected Attributes inherited from Mantid::CurveFitting::CostFunctions::CostFuncFitting | |
| EigenVector | m_der |
| bool | m_dirtyDeriv |
| dirty derivatives flag | |
| bool | m_dirtyHessian |
| dirty hessian flag | |
| bool | m_dirtyVal |
| dirty value flag | |
| API::FunctionDomain_sptr | m_domain |
| Shared pointer to the function domain. | |
| API::IFunction_sptr | m_function |
| Shared pointer to the fitting function. | |
| EigenMatrix | m_hessian |
| bool | m_ignoreInvalidData |
| bool | m_includePenalty |
| Flag to include constraint in cost function value. | |
| std::vector< size_t > | m_indexMap |
| maps the cost function's parameters to the ones of the fitting function. | |
| size_t | m_numberFunParams |
| Number of all parameters in the fitting function. | |
| bool | m_pushed |
| EigenVector | m_pushedParams |
| double | m_pushedValue |
| double | m_value |
| API::FunctionValues_sptr | m_values |
| Shared poinetr to the function values. | |
In contrast to CostFuncLeastSquares, this variant of the cost function assumes that there are no weights attached to the values, so all observations will have unit weights.
The covariance matrix is multiplied with the variance of the residuals.
Definition at line 26 of file CostFuncUnweightedLeastSquares.h.
| Mantid::CurveFitting::CostFunctions::CostFuncUnweightedLeastSquares::CostFuncUnweightedLeastSquares | ( | ) |
Definition at line 21 of file CostFuncUnweightedLeastSquares.cpp.
|
overrideprotectedvirtual |
Calculates covariance matrix for fitting function's active parameters.
| covar | :: Output cavariance matrix. |
| epsrel | :: Tolerance. |
Reimplemented from Mantid::CurveFitting::CostFunctions::CostFuncLeastSquares.
Definition at line 23 of file CostFuncUnweightedLeastSquares.cpp.
References Mantid::CurveFitting::CostFunctions::CostFuncLeastSquares::calActiveCovarianceMatrix(), Mantid::Kernel::Logger::debug(), Mantid::API::g_log, Mantid::CurveFitting::EigenMatrix::get(), getResidualVariance(), Mantid::Kernel::Logger::is(), Mantid::CurveFitting::EigenMatrix::size1(), and Mantid::CurveFitting::EigenMatrix::size2().
|
overrideprotectedvirtual |
Return unit weights for all data points.
Reimplemented from Mantid::CurveFitting::CostFunctions::CostFuncLeastSquares.
Definition at line 47 of file CostFuncUnweightedLeastSquares.cpp.
|
protected |
Calculates the residual variance from the internally stored FunctionValues.
Definition at line 72 of file CostFuncUnweightedLeastSquares.cpp.
References Mantid::Kernel::Logger::debug(), Mantid::API::g_log, Mantid::Kernel::Logger::is(), Mantid::CurveFitting::CostFunctions::CostFuncFitting::m_values, and Mantid::CurveFitting::CostFunctions::CostFuncFitting::nParams().
Referenced by calActiveCovarianceMatrix().
|
inlineoverridevirtual |
Get name of minimizer.
Reimplemented from Mantid::CurveFitting::CostFunctions::CostFuncLeastSquares.
Definition at line 30 of file CostFuncUnweightedLeastSquares.h.
|
inlineoverridevirtual |
Get short name of minimizer - useful for say labels in guis.
Reimplemented from Mantid::CurveFitting::CostFunctions::CostFuncLeastSquares.
Definition at line 31 of file CostFuncUnweightedLeastSquares.h.
|
overrideprotectedvirtual |
Update the fit weights of m_values so that correct fit weights are used by the minimizer and GSLFunctions.
Reimplemented from Mantid::CurveFitting::CostFunctions::CostFuncLeastSquares.
Definition at line 57 of file CostFuncUnweightedLeastSquares.cpp.
References Mantid::CurveFitting::CostFunctions::CostFuncFitting::m_ignoreInvalidData, and Mantid::CurveFitting::CostFunctions::CostFuncFitting::m_values.