{"id":37744628,"url":"https://github.com/nmtoan91/lshkrepresentatives","last_synced_at":"2026-01-16T14:14:09.117Z","repository":{"id":47530156,"uuid":"399716751","full_name":"nmtoan91/lshkrepresentatives","owner":"nmtoan91","description":"Categorial and numerical (ordinal and nonordinal) Data Clustering Algorithm","archived":false,"fork":false,"pushed_at":"2024-05-18T07:03:16.000Z","size":277,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-21T04:49:55.402Z","etag":null,"topics":["categorical-data","clustering","color","dataset","machine-learning","nonmetric-data","python","random-forest","shape","unordered-data-structures-solutions"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/lshkrepresentatives/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nmtoan91.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-08-25T06:41:37.000Z","updated_at":"2024-05-29T08:25:55.000Z","dependencies_parsed_at":"2024-01-25T06:24:55.924Z","dependency_job_id":"0e09f5e7-cda9-453b-9c18-188b741488d5","html_url":"https://github.com/nmtoan91/lshkrepresentatives","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"6528320a8872db0754dad3c0ae627327915fac48"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/nmtoan91/lshkrepresentatives","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmtoan91%2Flshkrepresentatives","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmtoan91%2Flshkrepresentatives/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmtoan91%2Flshkrepresentatives/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmtoan91%2Flshkrepresentatives/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nmtoan91","download_url":"https://codeload.github.com/nmtoan91/lshkrepresentatives/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmtoan91%2Flshkrepresentatives/sbom","scorecard":{"id":691025,"data":{"date":"2025-08-11","repo":{"name":"github.com/nmtoan91/lshkrepresentatives","commit":"b14d91f3a5794a76289f3902c10e70e67dc14432"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/29 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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: topLevel 'contents' permission set to 'read': .github/workflows/python-publish.yml:16","Info: no jobLevel write permissions found"],"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":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/nmtoan91/lshkrepresentatives/python-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/nmtoan91/lshkrepresentatives/python-publish.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yml:31","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yml:32","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"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":"Binary-Artifacts","score":0,"reason":"binaries present in source code","details":["Warn: binary detected: LSHkRepresentatives/__pycache__/ClusteringAlgorithm.cpython-310.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/ClusteringAlgorithm.cpython-311.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/ClusteringAlgorithm.cpython-312.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/DILCA.cpython-310.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/DILCA.cpython-311.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/DILCA.cpython-312.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/LSH.cpython-310.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/LSH.cpython-311.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/LSH.cpython-312.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/LSHkPrototypes.cpython-311.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/LSHkPrototypes.cpython-312.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/LSHkRepresentatives.cpython-310.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/LSHkRepresentatives.cpython-311.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/LSHkRepresentatives.cpython-312.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/LSHkRepresentatives_Full.cpython-310.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/LSHkRepresentatives_Full.cpython-312.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/MathUtils.cpython-310.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/MathUtils.cpython-311.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/MathUtils.cpython-312.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/Measure.cpython-310.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/Measure.cpython-311.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/Measure.cpython-312.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/MeasureManager.cpython-310.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/MeasureManager.cpython-311.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/MeasureManager.cpython-312.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/SimpleHashing.cpython-310.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/SimpleHashing.cpython-311.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/SimpleHashing.cpython-312.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/__init__.cpython-310.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/__init__.cpython-311.pyc:1","Warn: binary detected: LSHkRepresentatives/__pycache__/__init__.cpython-312.pyc:1"],"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T02:18:33.370Z","repository_id":47530156,"created_at":"2025-08-22T02:18:33.370Z","updated_at":"2025-08-22T02:18:33.370Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28479260,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["categorical-data","clustering","color","dataset","machine-learning","nonmetric-data","python","random-forest","shape","unordered-data-structures-solutions"],"created_at":"2026-01-16T14:14:08.966Z","updated_at":"2026-01-16T14:14:09.108Z","avatar_url":"https://github.com/nmtoan91.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Clustering algorithm for Mixed data of categorial and numerical (ordinal and nonordinal) data using LSH.\r\n## Notebook samples:\r\n### 1. LSH-k-Representatives : Clustering of categorical attributes only:\r\n### https://github.com/nmtoan91/lshkrepresentatives/blob/main/notebook_sample_clustering_categorical_data.ipynb\r\n\r\n### 2. LSH-k-Prototypes : Clustering of mixed data (categorical and numerical attributes):\r\n### https://github.com/nmtoan91/lshkrepresentatives/blob/main/notebook_sample_clustering_mixed_data_type.ipynb\r\n\r\n### 3. LSH-k-Representatives-Full : Clustering of HUGE categorical attributes only:\r\n### https://github.com/nmtoan91/lshkrepresentatives/blob/main/notebook_sample_LSHkRepresentatives_Full.ipynb\r\n\r\n### 4. Normalizing unstructed normal dataset: \r\n### https://github.com/nmtoan91/lshkrepresentatives/blob/main/notebook_dataset_normalization.ipynb\r\n\r\n\u003cbr /\u003e\r\n\u003cbr /\u003e\r\nNote 1: Different from k-Modes algorithm, LSH-k-Representatives define the \"representatives\" that keep the frequencies of all categorical values of the clusters. There are threee algorithms \r\nNote 2: The dataset is auto normalized if it detect string, or disjointed data, or nan \r\n\r\n\r\n## Installation:\r\n### Using pip: \r\n```shell\r\npip install lshkrepresentatives numpy scikit-learn pandas networkx termcolor\r\n```\r\n\r\n### Import the packages:\r\n```python\r\nimport numpy as np\r\nfrom LSHkRepresentatives.LSHkRepresentatives import LSHkRepresentatives\r\n```\r\n### Generate a simple categorical dataset:\r\n\r\n```python\r\nX = np.array([['red',0,np.nan],['green',1,1],['blue',0,0],[1,5111,1],[2,2,2],[2,6513,'rectangle'],[2,3,6565]])\r\n```\r\n\r\n## Using LSHk-Representatives (categorical clustering): \r\n\r\n```python\r\n#Init instance of LSHkRepresentatives \r\nkreps = LSHkRepresentatives(n_clusters=2,n_init=5) \r\n#Do clustering for dataset X\r\nlabels = kreps.fit(X)\r\n#Print the label for dataset X\r\nprint('Labels:',labels)\r\n#Predict label for the random instance x\r\nx = np.array(['red',5111,0])\r\nlabel = kreps.predict(x)\r\nprint(f'Cluster of object {x} is: {label}')\r\n```\r\n\r\n#### Outcome:\r\n```shell\r\nSKIP LOADING distMatrix because: False bd=None\r\nGenerating disMatrix for DILCA\r\nSaving DILCA to: saved_dist_matrices/json/DILCA_None.json\r\nGenerating LSH hash table:   hbits: 2(4)  k 1  d 3  n= 7\r\nLSH time: 0.006518099999993865 Score:  6.333333333333334  Time: 0.0003226400000130525\r\nLabels: [1 1 1 1 0 0 0]\r\nCluster of object [1 2 0] is: 1\r\n```\r\n\r\n### Call built-in evaluattion metrics:\r\n```python\r\ny = np.array([0,0,0,0,1,1,1])\r\nkreps.CalcScore(y)\r\n```\r\n#### Outcome:\r\n```shell\r\nPurity: 1.00 NMI: 1.00 ARI: 1.00 Sil:  0.59 Acc: 1.00 Recall: 1.00 Precision: 1.00\r\n```\r\n\r\n## Using LSHk-Prototypes (Mixed categorical and numerical attributes clustering): \r\nFor example: We have a dataset of 5 attributes (3 categorical and 2 numerical).\r\n```python\r\nfrom LSHkRepresentatives.LSHkPrototypes import LSHkPrototypes\r\nkprototypes = LSHkPrototypes(n_clusters=2,n_init=5) \r\nX = np.array([['red',0,np.nan,1,1],\r\n              ['green',1,1,0,0],\r\n              ['blue',0,0,3,4],\r\n              [1,5111,1,1.1,1.2],\r\n              [2,2,2,29.0,38.9],\r\n              [2,6513,'rectangle',40,41.1],\r\n              ['red',0,np.nan,30.4,30.1]])\r\n\r\nattributeMasks = [0,0,0,1,1]\r\n# attributeMasks = [0,0,0,1,1] means attributes are\r\n# [categorial,categorial,categorial,numerical,numerical]\r\na = kprototypes.fit(X,attributeMasks,numerical_weight=2, categorical_weight=1)\r\nprint(a)\r\n```\r\n\r\n\r\n## References:\r\nT. N. Mau and V.-N. Huynh, ``An LSH-based k-Representatives Clustering Method for Large Categorical Data.\" Neurocomputing,\r\n\t\t\tVolume 463, 2021, Pages 29-44, ISSN 0925-2312, https://doi.org/10.1016/j.neucom.2021.08.050.\r\n\r\n## Bibtex:\r\n```\r\n@article{mau2021lsh,\r\n  title={An LSH-based k-representatives clustering method for large categorical data},\r\n  author={Mau, Toan Nguyen and Huynh, Van-Nam},\r\n  journal={Neurocomputing},\r\n  volume={463},\r\n  pages={29--44},\r\n  year={2021},\r\n  publisher={Elsevier}\r\n}\r\n```\r\n## pypi/github repository\r\nhttps://pypi.org/project/lshkrepresentatives/ \\\r\nhttps://github.com/nmtoan91/lshkrepresentatives\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmtoan91%2Flshkrepresentatives","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnmtoan91%2Flshkrepresentatives","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmtoan91%2Flshkrepresentatives/lists"}