{"id":21850620,"url":"https://github.com/freakwill/thomas","last_synced_at":"2026-04-29T21:04:10.561Z","repository":{"id":130366732,"uuid":"151841067","full_name":"Freakwill/Thomas","owner":"Freakwill","description":"My Bayes algorithm, for the name of Thomas Bayes 👨‍🔬","archived":false,"fork":false,"pushed_at":"2019-05-22T12:57:33.000Z","size":2744,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-21T15:04:14.374Z","etag":null,"topics":["bayes-classifier","naive-bayes-classifier","python"],"latest_commit_sha":null,"homepage":"","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/Freakwill.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-06T13:10:28.000Z","updated_at":"2019-05-22T12:57:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"200a599e-82e4-4a65-8ab6-09978132bad0","html_url":"https://github.com/Freakwill/Thomas","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Freakwill/Thomas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freakwill%2FThomas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freakwill%2FThomas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freakwill%2FThomas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freakwill%2FThomas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Freakwill","download_url":"https://codeload.github.com/Freakwill/Thomas/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freakwill%2FThomas/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32443576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T20:22:27.477Z","status":"ssl_error","status_checked_at":"2026-04-29T20:22:26.507Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["bayes-classifier","naive-bayes-classifier","python"],"created_at":"2024-11-28T00:18:30.611Z","updated_at":"2026-04-29T21:04:10.556Z","avatar_url":"https://github.com/Freakwill.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Thomas\nMy Bayes algorithm, for the name of Thomas Bayes\n\n## Features\n* Cope with continuous random varaibles intellegently.\n* integer random varaibles (e.g. the mass of things with integer gram) will be treated as continuous ones in some case.\n\n## Requirement\n* numpy\n* pandas\n* scikit-learn (in examples)\n* neupy\n\n## Install\n\n`pip install tomas`\nnot `thomas` which had been registered.\n\n## Why\nFor the Honor of T. Bayes\n\n![](https://github.com/Freakwill/Thomas/blob/master/Thomas_Bayes.gif)\n\n\n## Grammar\nJust see the example file.\n\n## Examples\n\n```python\n\nimport pandas as pd\n\nfrom mystat import *\n\nfrom scipy.stats import chi2_contingency\nfrom sklearn.model_selection import train_test_split\n\ntrain = pd.read_excel('modeling_data.xls', encoding='utf-8')\n\ntrain['批次时间'] = [_.total_seconds() for _ in train['批次完成时间'] - train['批次开始时间']]\ntrain['G-W-T'] = list(zip(train['克重'], train['重量'], train['批次时间']))\ntrain['L-M'] = list(zip(train['长度'], train['门幅']))\n# train = train.drop(columns=['批次开始时间', '批次完成时间', '配方ID', '流程卡号', '缸号', '批次时间'])\n\ny_train = train['质量问题']\n\nx_train, x_test, y_train, y_test = train_test_split(train, y_train, test_size=0.2)\n\n# seperate the data in x_train to 1 + 3 groups as x_train and z_trains\n\nx_train = x_train[['机器', '弹力', '氨纶', '织物', '纱线', '颜色', '客户', '月份', 'L-M', 'G-W-T']]\nz_trains = x_train[[s for s in train.columns if s.startswith('助')]], x_train[[s for s in train.columns if s.startswith('染')]], x_train[[s for s in train.columns if s.startswith('光')]]\n\nfrom tomas import *\n\ndef nb():\n    models = None # use GRNN to fit data (z_trains, y_train)\n    nbc = ZeroOneHemiNaiveBayesClassifier.fromDataFrame(x_train, z_trains, y_train, models)\n    y_pred = nbc.predictdf(x_test)\n    scores = check(y_test, y_pred)\n    print(report(scores))\n\nnb()\n\n# =\u003e\n   | -\u003e C1 | -\u003e C0|\n    C1 | 128 | 43 |\n    C0 | 217 | 431 |\n----------------\n    f-score(p) 0.4961\n    f-socre(n) 0.7683\n    mcc 0.3405\n```\n\n## Is it easy?\nYes\n\n## Principle\n\n![](https://github.com/Freakwill/Thomas/blob/master/README.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreakwill%2Fthomas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreakwill%2Fthomas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreakwill%2Fthomas/lists"}