Skip to main content
Objective functions define how the discrepancy between model predictions and experimental data is quantified during parameter fitting.

Cost Function Formulations

Residual Form (Array)

The residual vector represents the difference between model predictions and data: r(x)=ymodel(x)ydatar(x) = y_{\text{model}}(x) - y_{\text{data}} where xx represents the parameter vector.

Canonical Form (Scalar)

The canonical cost function aggregates the residuals into a single scalar value: Φ(x)r(x)r(x)=iNri(x)2\Phi(x) \propto r(x)^\top r(x) = \sum_i^N r_i(x)^2 This sum-of-squares formulation is fundamental to least-squares optimization.

Common Cost Functions

The basic sum of squared residuals:ΦSSE(x)=iNri2=rr\Phi_{\text{SSE}}(x) = \sum_i^N r_i^2 = r^\top rThis can be represented in both array and scalar forms, making it compatible with all optimization algorithms.

Maximum Likelihood Estimation (MLE)

Under the assumption of independent, identically distributed Gaussian errors, the MLE cost function is: rMLE(x)=ymodelydatar_{\text{MLE}}(x) = y_{\text{model}} - y_{\text{data}} ΦMLE(x)=iNri2=rr\Phi_{\text{MLE}}(x) = \sum_i^N r_i^2 = r^\top r This is equivalent to the sum squared error formulation, providing a probabilistic interpretation of least-squares fitting.
For most optimization algorithms, the default sum-squared-error formulation provides the best compatibility and performance. Use MSE or RMSE when you need interpretable, scale-independent metrics.
To pair an objective with a cost function in a data fit, see Pipelines → Data Fitting → Objective Functions.