{"id":22707085,"url":"https://github.com/cair/tsetlinmachinecuda","last_synced_at":"2026-04-17T02:31:02.963Z","repository":{"id":62585433,"uuid":"354936721","full_name":"cair/tsetlinmachinecuda","owner":"cair","description":null,"archived":false,"fork":false,"pushed_at":"2021-11-15T12:39:21.000Z","size":433,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-10-05T11:50:56.827Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/cair.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}},"created_at":"2021-04-05T18:43:29.000Z","updated_at":"2021-11-15T12:39:24.000Z","dependencies_parsed_at":"2022-11-03T21:45:58.829Z","dependency_job_id":null,"html_url":"https://github.com/cair/tsetlinmachinecuda","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/cair/tsetlinmachinecuda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cair%2Ftsetlinmachinecuda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cair%2Ftsetlinmachinecuda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cair%2Ftsetlinmachinecuda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cair%2Ftsetlinmachinecuda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cair","download_url":"https://codeload.github.com/cair/tsetlinmachinecuda/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cair%2Ftsetlinmachinecuda/sbom","scorecard":{"id":262236,"data":{"date":"2025-08-11","repo":{"name":"github.com/cair/tsetlinmachinecuda","commit":"1dc94d054312c5cf92d8fd283f00762a9dab78ae"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/30 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":"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":"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":"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":"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":"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":"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":"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"}}]},"last_synced_at":"2025-08-17T11:05:52.288Z","repository_id":62585433,"created_at":"2025-08-17T11:05:52.289Z","updated_at":"2025-08-17T11:05:52.289Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31912306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"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":[],"created_at":"2024-12-10T10:11:26.774Z","updated_at":"2026-04-17T02:31:02.927Z","avatar_url":"https://github.com/cair.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tsetlin Machine Multi-GPU\n![License](https://img.shields.io/github/license/microsoft/interpret.svg?style=flat-square) ![Python Version](https://img.shields.io/pypi/pyversions/interpret.svg?style=flat-square) ![Maintenance](https://img.shields.io/maintenance/yes/2021?style=flat-square)\n\n### CIFAR Demo\n\n#### Code: CIFARDemo.py\n\n```python\nfrom PyTsetlinMachineCUDA.tm import MultiClassConvolutionalTsetlinMachine2D\nimport numpy as np\nfrom time import time\nfrom keras.preprocessing.image import ImageDataGenerator\n\nfrom keras.datasets import cifar10\n\nimport cv2\n\nfactor = 80\nclauses = int(4000*factor)\nT = int(75*10*factor)\ns = 20.0\npatch_size = 8\n\nlabels = [b'airplane', b'automobile', b'bird', b'cat', b'deer', b'dog', b'frog', b'horse', b'ship', b'truck']\n\n(X_train, Y_train), (X_test, Y_test) = cifar10.load_data()\n\nY_test=Y_test.reshape(Y_test.shape[0])\nfor i in range(X_test.shape[0]):\n        for j in range(X_test.shape[3]):\n                X_test[i,:,:,j] = cv2.adaptiveThreshold(X_test[i,:,:,j], 1, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 11, 2)#cv2.adaptiveThreshold(X_test[i,:,:,j], 1, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 5, 5)\n\ndatagen = ImageDataGenerator(\n    rotation_range=15,\n    horizontal_flip=True,\n    width_shift_range=0.1,\n    height_shift_range=0.1\n    #zoom_range=0.3\n    )\ndatagen.fit(X_train)\n\nf = open(\"cifar10_%.1f_%d_%d_%d.txt\" % (s, clauses, T,  patch_size), \"w+\")\n\ntm = MultiClassConvolutionalTsetlinMachine2D(clauses, T, s, (patch_size, patch_size), number_of_gpus=16)\n\nbatch = 0\nfor X_batch, Y_batch in datagen.flow(X_train, Y_train, batch_size=10000):\n        batch += 1\n        \n        Y_batch = Y_batch.reshape(Y_batch.shape[0]).astype(np.int32)\n        X_batch = X_batch.reshape(X_batch.shape[0], 32, 32, 3).astype(np.uint8)\n\n        for i in range(X_batch.shape[0]):\n                for j in range(X_batch.shape[3]):\n                        X_batch[i,:,:,j] = cv2.adaptiveThreshold(X_batch[i,:,:,j], 1, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 11, 2) \n\n        start_training = time()\n        tm.fit(X_batch, Y_batch, epochs=1, incremental=True)\n        stop_training = time()\n\n        start_testing = time()\n        result_test = 100*(tm.predict(X_test) == Y_test).mean()\n        stop_testing = time()\n\n        result_train = 100*(tm.predict(X_batch) == Y_batch).mean()\n        print(\"%d %.2f %.2f %.2f %.2f\" % (batch, result_train, result_test, stop_training-start_training, stop_testing-start_testing))\n        print(\"%d %.2f %.2f %.2f %.2f\" % (batch, result_train, result_test, stop_training-start_training, stop_testing-start_testing), file=f)\n        f.flush()\nf.close()\n```\n\n#### Output\n\n```bash\npython ./CIFARDemo.py\n\nPreparing GPU #0\nPreparing GPU #1\nPreparing GPU #2\nPreparing GPU #3\nPreparing GPU #4\nPreparing GPU #5\nPreparing GPU #6\nPreparing GPU #7\nPreparing GPU #8\nPreparing GPU #9\nPreparing GPU #10\nPreparing GPU #11\nPreparing GPU #12\nPreparing GPU #13\nPreparing GPU #14\nPreparing GPU #15\n\n1 45.11 41.06 26.91 11.10\n2 52.29 47.12 21.88 10.81\n3 57.00 49.78 21.81 10.96\n...\n\n278 99.98 70.30 20.64 10.94\n279 99.97 70.20 20.73 10.89\n280 99.97 70.33 20.72 10.86\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcair%2Ftsetlinmachinecuda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcair%2Ftsetlinmachinecuda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcair%2Ftsetlinmachinecuda/lists"}