-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
middle is undefined for Date and DateTime (so median does not work) #47
Comments
the problem runs deeper. apparently Statistics.jl assumes vector spaces, but most things work in affine spaces as well. in particular mean is the same concept as barycenter in affine spaces. DateTime forms an affine space, and thus mean should be defined for it, but it isn't as it is implemented now. adding a specialization for DateTime to mean (and middle) seems like a patchwork. the true solution would be an implementation of mean which is affine space aware. consider: mean t = t_base + sum (t_i - t_base) / n it raises a number of issues, namely the choice of t_base, which is arbitrary in theory, but might introduce practical differences. we also don't want to work with numbers in this way for performance reasons, so some kind of Holy traits might come to the rescue. |
This issue is about @quinnj Do you think the definition proposed in the OP is correct? Or would it make sense to define |
OP definition seems.....fine. It's just treating But yeah, seems fine to me. |
Cool. Feel free to make a PR @jameslefevre. |
To clarify what this addition would entail: it would mean that This may be OK though and would kind of justify the existence of |
That makes most sense to me. AFAICT it's equivalent to the current definition I'm also not really convinced rounding is the right thing. How do we know whether to round up or down? This will also apply for |
|
I have this working code:
But I wanted to quickly check that this is an appropriate approach before putting in a pull request. I saw open pull request #28 (relax type definition of middle), but I don't think helps - Date and DateTime should not subtype either Real or Number.
The text was updated successfully, but these errors were encountered: