Comments (1)
Hi @mattlorimor, are you still interested in this change? If so, I could give it a shot, but I would have some questions.
Would you be okay with leaving the existing constructors, and adding new constructors that include the hash as the last argument? For BloomFilter, that would look something like this:
public BloomFilter(uint n, double fpRate) :
this(n, fpRate, Defaults.GetDefaultHashAlgorithm())
{
}
public BloomFilter(uint n, double fpRate, HashAlgorithm hash)
{
var m = Utils.OptimalM(n, fpRate);
var k = Utils.OptimalK(fpRate);
Buckets = new Buckets(m, 1);
this.Hash = hash;
this.m = m;
this.k = k;
}
Another option would be to have one constructor, but make the hash default to null and have null mean "default"; e.g.,
public BloomFilter(uint n, double fpRate, HashAlgorithm hash = null)
{
var m = Utils.OptimalM(n, fpRate);
var k = Utils.OptimalK(fpRate);
Buckets = new Buckets(m, 1);
this.Hash = hash ?? Defaults.GetDefaultHashAlgorithm();
this.m = m;
this.k = k;
}
My personal preference would be for the two constructor approach, but either way is fine.
Would you be okay with actually removing the SetHash() functions entirely? That would be my vote. If you wanted to keep the SetHash() methods, I would suggest that we change them to throw an exception if any data has already been added to the collection, since changing the hash function at that time must be a mistake.
from probabilisticdatastructures.
Related Issues (13)
- Clean up folder structure in the main project
- Set up AppVeyor to publish releases to Github's release functionality HOT 4
- Deletable BF?
- Add support for large Bloom filters requiring more than 2^32 bits (2^29 bytes) of data HOT 1
- Take a look at BoomFilters again
- Add ability to serialize/deserialize the data structures
- License does not include year or name for copyright
- Integrate with Appveyor to do CI builds HOT 2
- Add SetHash() to the IFilter interface
- Integrate with Codecov HOT 1
- Improve TopK to use a real heap data structure HOT 1
- Confirm that all code samples work HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from probabilisticdatastructures.