Closed mstimberg closed 4 years ago
Somewhat forgot about this PR. @romainbrette, what do you think?
It runs, but does it apply also to refine?
It runs, but does it apply also to refine?
Oops, good catch! No it didn't, but now it does :)
What does the error correspond to now? mean(t_weight*error)?
What does the error correspond to now? mean(t_weight*error)?
Yes. I now realize that we should maybe make this clearer in the documentation. Weighting the first part of the trace as 0 or using t_start
is similar, but it will not give the same result for the error – in the former case the error is considered 0 (but included in the mean) and in the latter it is simply ignored.
We could renormalize things by considering the total weight (so only the relative weights would matter)?
for example with something like t_weights = t_weights/(sum(t_weights)*dt)
?
En tout cas ça marche!
Ah non ça ne doit pas être exactement ça
(la normalisation je veux dire)
I guess
t_weights = len(t_weights)*t_weights/sum(t_weights)
would work?
yes that seems rights (ie t_weights/mean(weights)
).
I implemented the normalization of the weights. This makes sure that using t_start
generates the same error as using t_weights
with zero for time points < t_start
and any kind of constant value for the other time points.
Currently, the weights weigh the squared error, or in other words the residual is weighted by the square root of the provided weight. Not sure whether this is the best approach, especially given that the normalization
scales the residual and not the squared error.
Discussed with @romainbrette and decided that applying the weighting to the squared error is ok. After all, users will chose this value somewhat arbitrarily anyway. Going ahead with the merge.
This adds a simple temporal weighting factor to
MSEMetric
. Instead oft_start
you can providet_weights
, a vector of values of the same size as the trace that gets multiplied with the error (i.e. scales the squared error in the case ofMSEMetric
). For simplicity, it cannot be combined witht_start
.Closes #22