-
Notifications
You must be signed in to change notification settings - Fork 194
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
Questions about Weights
#749
Comments
1.) mutability is used to keep the sum updated |
Hmm, I think that just begs the question, since the sum should only change if some of the values change. |
Generally, julia> x = [true, false, false, true];
julia> typeof(x)
Vector{Bool} (alias for Array{Bool, 1})
julia> sum(x)
2
julia> typeof(sum(x))
Int64 |
Nope! Just mildly curious given immutability is the default and generally preferred. |
Yeah, making the types mutable was really just the path of least resistance for writing memory efficient algorithms. If it's becoming too cumbersome to handle, particularly when working with views, then I don't see why we can't disallow it. For the most part I can probably just switch our algs to use regular vectors instead. |
Shouldn't the values of the weights still be mutable (since the weights are stored in a mutable vector)? If you normalize the weights to have an unchanged sum, you should be able to mutate the weights in-place. |
Normalization means that you have to change all weights instead of just one and potentially run into type issues. E.g., you could use weights |
Theoretically possible, but that sounds like it could be fixed pretty easily by using float weights. |
No, it can't, you would still have to update the whole array instead of a single entry. There are also good reasons for using integers instead of floats, eg they don't cause undesired promotions and you don't have to deal with floating point issues. |
I have two main questions about the current implementation of weights:
The text was updated successfully, but these errors were encountered: