Weights in least squares estimation #389
-
Hello, I am trying to estimate the rotation between two vectors in R^3 with a least squares estimator. As shown in one of my residuals below, I am the function to_tangent() to calculate the residual. How can I incorporate uncertainties/weights to make a weighted least squares estimator? What do the elements in the to_tangent-element represent? Any help is much appreciated. def sun_angle_residual(R_n_b: sm.Rot3, sun_b: sm.V3, sun_n_almanac: sm.V3, epsilon: sm.Scalar):
sun_n_pred = R_n_b*sun_b
sun_n_pred_unit = geo.Unit3.from_vector(sun_n_pred)
sun_n_almanac_unit = geo.Unit3.from_vector(sun_n_almanac)
diff = sun_n_almanac_unit.between(sun_n_pred_unit)
return diff.to_tangent() |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
The tangent space for
For simple weights, you can multiply the result by the weight (or the sqrt of the weight, if you want to pass in the weight on the cost rather than the residual), e.g.: def sun_angle_residual(R_n_b: sm.Rot3, sun_b: sm.V3, sun_n_almanac: sm.V3, weight: sm.Scalar, epsilon: sm.Scalar):
sun_n_pred = R_n_b*sun_b
sun_n_pred_unit = geo.Unit3.from_vector(sun_n_pred)
sun_n_almanac_unit = geo.Unit3.from_vector(sun_n_almanac)
diff = sun_n_almanac_unit.between(sun_n_pred_unit)
return sm.sqrt(weight) * diff.to_tangent() This is equivalent to |
Beta Was this translation helpful? Give feedback.
Ah, I guess that doesn't really answer your question. If you have a covariance on
sun_n_almanac
, you could project that to a covariance on the result with something like this I think?