hyperloglog-redis:Redis支持的HyperLogLog算法的实现

时间:2021-05-10 13:43:15
【文件属性】:
文件名称:hyperloglog-redis:Redis支持的HyperLogLog算法的实现
文件大小:17KB
文件格式:ZIP
更新时间:2021-05-10 13:43:15
Ruby 超级日志 该gem是HyperLogLog算法的纯Ruby实现,用于估计通过事件流观察到的集合的基数。 实例用于存储计数器。 一个最小的例子: require 'redis' require 'hyperloglog-redis' counter = HyperLogLog::Counter.new(Redis.new) ['john', 'paul', 'george', 'ringo', 'john', 'paul'].each do |beatle| counter.add('beatles', beatle) end puts "There are approximately #{counter.count('beatles')} distinct Beatles" 每个HyperLogLog计数器使用固定的少量空间,但可以估计高达约十亿个值的任何集合的基数,相对误差为1.0
【文件预览】:
hyperloglog-redis-master
----LICENSE.txt(1KB)
----VERSION(5B)
----.document(55B)
----lib()
--------time_series_counter.rb(4KB)
--------algorithm.rb(2KB)
--------counter.rb(1KB)
--------hyperloglog-redis.rb(68B)
----Gemfile(227B)
----spec()
--------spec_helper.rb(981B)
--------hyper_log_log_spec.rb(10KB)
--------time_series_counter_spec.rb(10KB)
----Rakefile(1KB)
----HISTORY.md(1KB)
----README.md(10KB)
----.rspec(8B)
----hyperloglog-redis.gemspec(2KB)
----Gemfile.lock(681B)
----.gitignore(168B)

网友评论