-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Type consistency #256
Comments
I'm not sure what you mean by type info is lost. To your second point, |
In my specific use case I am using My current implementation returns a However, when constructing the solution object, a Long story short, I had >eltype(eltype(Float64))
Float64 as reference for the behaviour I had been expecting, and was hence surprised. |
Hmm, okay. Where is the I'm not sure what a "trajectory" is in this context, but maybe you want to use |
A trajectory in the ODE/ dynamical system sense, where one might have The way I went about this is to have a I suppose I could do this via > g = Group(FitNormal(), FitNormal())
> fit!(g, rand(2)) I can't get the means out as easily as both Further, even though > eltype(g)
Any This is sensible, since a group could contain anything, but in a case like this, where all stats in the group are the same, one might expect a more specific Also comparing to > eltype(Distributions.Normal(2.f0))
Float32
> eltype(Distributions.MvNormal([2.f0, 3.f0]))
Float32 Given that I think that |
Thanks for the info! I'll have to mull this over a bit since I'd rather not add methods to the OnlineStatsBase interface if I can avoid it. |
I just took a stab at creating a convenience constructor (see #258), but stumbled over additional surprising behaviour. julia> m = FitNormal(Variance(Float32))
FitNormal: n=0 | value=(0.0, 1.0)
julia> typeof(value(m))
Tuple{Float64, Float64}
julia> for _ in 1:3
fit!(m, rand(Float32))
end
julia> m
FitNormal: n=3 | value=(0.482926, 0.478244)
julia> typeof(value(m))
Tuple{Float32, Float32} I also note that julia> typeof(m.v)
Variance{Float32, Float32, EqualWeight} which suggests that it is possible to have a I have made an attempt to fix the above, let me know what you think. On that note, I am using Float32/ Float64 as placeholders, that could also be replaced with any new user-defined type |
I have found this repo recently, and as I am integrating it into my code, I noticed that a lot of type information is lost.
I.e.
which is surprising, given that
Mean
has a<:Number
type parameter. I personally would expect thatSurprisingly other objects like
FitNormal
don't allow a type parameter, even though it is parametrized withV<:Variance
, so one might expect something liketo work.
I am not sure when I would have time to work on something like this, but I first wanted to open this issue, and see if the above would be a desired behaviour.
The text was updated successfully, but these errors were encountered: