{"id":20013752,"url":"https://github.com/gregorybchris/hlucb","last_synced_at":"2026-09-25T14:30:31.278Z","repository":{"id":62569357,"uuid":"438582622","full_name":"gregorybchris/hlucb","owner":"gregorybchris","description":"Implementation of Hamming-LUCB algorithm for approximate sorting","archived":false,"fork":false,"pushed_at":"2023-02-12T22:09:34.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T14:06:54.988Z","etag":null,"topics":["algorithm","approximate","confidence","hamming","lucb","sorting"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/hlucb/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gregorybchris.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-15T10:10:39.000Z","updated_at":"2024-09-25T03:55:11.000Z","dependencies_parsed_at":"2024-11-13T07:37:49.802Z","dependency_job_id":"24fa5093-a140-4f4c-afcb-00a10d56a55f","html_url":"https://github.com/gregorybchris/hlucb","commit_stats":{"total_commits":7,"total_committers":2,"mean_commits":3.5,"dds":0.4285714285714286,"last_synced_commit":"f9c95d155246ae7d34039c91210bd110c5fb7dc2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gregorybchris/hlucb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorybchris%2Fhlucb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorybchris%2Fhlucb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorybchris%2Fhlucb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorybchris%2Fhlucb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregorybchris","download_url":"https://codeload.github.com/gregorybchris/hlucb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorybchris%2Fhlucb/sbom","scorecard":{"id":445050,"data":{"date":"2025-08-11","repo":{"name":"github.com/gregorybchris/hlucb","commit":"f9c95d155246ae7d34039c91210bd110c5fb7dc2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/7 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2022-42969"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T06:30:29.771Z","repository_id":62569357,"created_at":"2025-08-19T06:30:29.771Z","updated_at":"2025-08-19T06:30:29.771Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":341189360,"owners_count":37679296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-08-22T15:14:58.755Z","status":"online","status_checked_at":"2026-09-25T02:00:20.896Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","approximate","confidence","hamming","lucb","sorting"],"created_at":"2024-11-13T07:37:45.446Z","updated_at":"2026-09-25T14:30:30.901Z","avatar_url":"https://github.com/gregorybchris.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hamming-LUCB\n\nThe `hlucb` package is a Python implementation of the paper [Approximate ranking from pairwise comparisons](http://proceedings.mlr.press/v84/heckel18a.html).\n\n\u003e Heckel, R., Simchowitz, M., Ramchandran, K., \u0026 Wainwright, M. (2018, March). Approximate ranking from pairwise comparisons. In International Conference on Artificial Intelligence and Statistics (pp. 1057-1066). PMLR.\n\n## Installation\n\n`hlucb` is installable with pip:\n\n```bash\n$ pip install hlucb\n```\n\n## Usage\n\n### Ranking with a comparator\n\n```python\nfrom hlucb import HammingLUCB\n\nitems = [4, 1, 2, 6, 5, 8, 9, 3]\nk = 5\nh = 2\ndelta = 0.9\n\ndef compare(item_a: int, item_b: int) -\u003e bool:\n    return item_a \u003e item_b\n\nscores, bounds = HammingLUCB.from_comparator(items, k, h, delta, compare, seed=42)\n\nprint(\"Scores: \", scores)\nprint(\"Bounds: \", bounds)\n```\n\n### Ranking with a generator\n\n```python\nfrom hlucb import HammingLUCB\n\nitems = [4, 1, 2, 6, 5, 8, 9, 3]\nn = len(items)\nk = 5\nh = 2\ndelta = 0.9\n\ngenerator = HammingLUCB.get_generator(n, k, h, delta, seed=42)\nscores = None\nbounds = None\nfor (i, j), (scores, bounds) in generator:\n    comparison = items[i] \u003e items[j]\n    generator.send(comparison)\n\nprint(\"Scores: \", scores)\nprint(\"Bounds: \", bounds)\n```\n\n## Intuition\n\nThe Hamming-LUCB algorithm approximately ranks $n$ items, estimates the score of each item, and provides confidence bounds for each score. The intuition behind the approximate ranking is that it's easier to compare items with very different scores, so it should be possible to separate high-scoring items from low-scoring items with few comparisons and high confidence even if the exact ranking is not discovered.\n\nThe sets of high- and low-scoring items are designated $S_1$ and $S_2$ respectively. Hamming-LUCB extracts $S_1$ and $S_2$ such that all items in $S_1$ are expected to have higher scores than all items in $S_2$.\n\nParameters:\n\n- $n$ - the total number of items\n- $k$ - the number of items to extract as high-scoring items\n- $h$ - half the margin between $S_1$ and $S_2$\n- $\\delta$ - confidence parameter for the probability of achieving $h$-Hamming accuracy\n\nDefinitions:\n\n- The Hamming distance between two sets: $D_H(S_1, S_2) = \\lvert (S_1 \\cup S_2) \\setminus (S_1 \\cap S_2) \\rvert$\n- A ranking $\\hat{S_1}$, $\\hat{S_2}$ is $h$-Hamming accurate if: $D_H(\\hat{S_l}, S_l) \\leq 2h$ for\n  - $\\lvert \\hat{S_l} \\rvert = \\lvert S_l \\rvert$\n  - $l \\in \\{1, 2\\}$\n- A ranking algorithm is $(h, \\delta)$-accurate if the ranking returned is $h$-Hamming accurate with probability at least $1 - \\delta$.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregorybchris%2Fhlucb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregorybchris%2Fhlucb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregorybchris%2Fhlucb/lists"}