Download platform/dbops/binaries/redis/src/utils/hyperloglog/hll-err.rb from LevelUp2x/adaptai: direct link, hf CLI and curl.
- Browser
- Download file 637 Bytes
-
https://huggingface.co/datasets/LevelUp2x/adaptai/resolve/main/platform/dbops/binaries/redis/src/utils/hyperloglog/hll-err.rb
- Command line
-
hf download hf://datasets/LevelUp2x/adaptai/platform/dbops/binaries/redis/src/utils/hyperloglog/hll-err.rb
-
curl -L -o hll-err.rb https://huggingface.co/datasets/LevelUp2x/adaptai/resolve/main/platform/dbops/binaries/redis/src/utils/hyperloglog/hll-err.rb
637 Bytes
| # hll-err.rb - Copyright (C) 2014 Salvatore Sanfilippo | |
| # BSD license, See the COPYING file for more information. | |
| # | |
| # Check error of HyperLogLog Redis implementation for different set sizes. | |
| require 'rubygems' | |
| require 'redis' | |
| require 'digest/sha1' | |
| r = Redis.new | |
| r.del('hll') | |
| i = 0 | |
| while true do | |
| 100.times { | |
| elements = [] | |
| 1000.times { | |
| ele = Digest::SHA1.hexdigest(i.to_s) | |
| elements << ele | |
| i += 1 | |
| } | |
| r.pfadd('hll',elements) | |
| } | |
| approx = r.pfcount('hll') | |
| abs_err = (approx-i).abs | |
| rel_err = 100.to_f*abs_err/i | |
| puts "#{i} vs #{approx}: #{rel_err}%" | |
| end | |