The FactorGraph provides several utility functions to evaluate and compare obtained results.
The function provides the estimate obtained by the weighted least-squares (WLS) method and root mean square error (RMSE), the mean absolute error (MAE) and the weighted residual sum of squares (WRSS) error metrics evaluated according to the WLS solutions. These results can be used to compare results obtained by the GBP algorithm.
exact = wls(gbp)
The function returns the composite type WeightedLeastSquares
with fields estimate
, rmse
, mae
, wrss
. Note that results are obtained according to variables ContinuousSystem.coefficient
, ContinuousSystem.observation
and ContinuousSystem.variance
.
The package provides the function to obtain RMSE, MAE, and WRSS error metrics of the GBP algorithm.
evaluation = errorMetric(gbp)
The function returns the composite type ErrorMetric
with fields rmse
, mae
, wrss
. Further, passing the composite type WeightedLeastSquares
, we obtained additional fields rmseGBPWLS
and maeGBPWLS
that determine the distance between the GBP estimate and WLS estimate.
evaluation = errorMetric(gbp, exact)
The function returns the composite type ErrorMetricWiden
with fields rmse
, mae
, wrss
, rmseGBPWLS
, maeGBPWLS
.
The root mean square error, the mean absolute error and the weighted residual sum of squares are evaluated according to:
where m
denotes the number of observations, z_i
is observation value, v_i
is observation variance, and corresponding equation h_i(\hat{\mathbf x})
is evaluated at the point \hat{\mathbf x}
obtained using the GBP or WLS algorithm. Note, wrss
is the value of the objective function of the optimization problem we are solving.
Fields rmseGBPWLS
and maeGBPWLS
determine distance beetwen the GBP estimate \hat{x}_{\text{gbp},i}
and WLS estimate \hat{x}_{\text{wls},i}
, where root mean square error and mean absolute error are obtained using:
where n
is the number of state variables.