Closed JonathanHoffman closed 8 years ago
So far I have only implemented the filter function that I need. Should I add more?
Yes. Add the one for keys and the overall one, so 2 more.
Deltas: Should I pass the delta we want to the removeZeroes function, or just use the default set in ProbabilityMassConfig? Or just set delta to the value where ever it is used?
Leave as is, passing in a value.
In a new commit: Now that we have filterZeroFrequencies
, let's do like ProbabilityMass
does, and expose an internal initializer that has a flag to tell it to filter. That way if someone is evil and passing in [5: 0.0]
we can make it [:]
instead. Use a delta of 0.0
for that one. For nearly all local calls to our initializer, like after every operation, we would pass false
, just like ProbabilityMass
does. In subtract
though we would pass true
.
This would also fix normalizeFrequencies
in the zero case, since it won't have any elements to map over and get a division by zero error. This may have bigger implications, but I think it's worth fixing those than to allow people to pass in invalid frequencies.
I know it's not part of this, but as part of the PR can you update README Usage section on expressions? Maybe use -
instead of +
and change the comments to be more descriptive.
I've updated the title and description. This is ready for review. :mag:
Just the one comment left. Really nice work @JonathanHoffman!
After the CHANGELOG.md change, go ahead and merge. :+1:
The build failing was my issue. I've just fixed it. After you rebase it should pass just fine.
TODO:
Notes:
Deltas: Should I pass the delta we want to the removeZeroes function, or just use the default set in ProbabilityMassConfig? Or just set delta to the value where ever it is used?Closes #63