{ "info": { "author": "William Song", "author_email": "songcwzjut@163.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Science/Research", "License :: Public Domain", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Topic :: Scientific/Engineering :: Mathematics" ], "description": "# Bayes Classifier\n\n## Principle\n\n### Naive Bayes\n\n\n$$\np(c|x)=\\frac{p(x|c)p(c)}{p(x)}\\sim p(x|c)p(c)\\\\\n\\sim \\prod_ip(x_i|c)p(c) = \\prod_ip(x_i,c)p(c)^{1-n}~~~~~~~~~\\text{(Naive condition)}\\\\\n\\sim\\prod_i\\frac{N(x_i,c)}{N}p(c)^{1-n}\n$$\n\n### Semi Naive Bayes\n\n$$\np(c|x,y)=\\sim p(x|c)p(c|y)\\\\\n\\sim \\prod_ip(x_i|c)p(c|y) ~~~~~~~~~\\text{(Semi-Naive condition)}\n$$\n\nwhere $p(c|y)\u200b$ will be estimated by say of neural networks.\n\n### Hemi Naive Bayes, in more general form\n\nWhen $y$ is empty, it is equiv. to the naive one.\n\n$$\np(c|x,y_1,\\cdots y_m)\n\\sim \\prod_ip(x_i|c)\\prod_ip(c|y_i)p(c)^{1-m} ~~~~~~~~~~(Hemi-condition)\\\\\n\\sim \\prod_ip(x_i|c)\\prod_if_c(y_i)p(c)^{1-m}\\\\\n\\sim \\prod_ip(x_i,c)\\prod_if_c(y_i)p(c)^{1-m-n}\n$$\n\n## Predict\n\n$$\n\\frac{p(c|x,y)}{p(c'|x,y)}= \\prod_i(\\frac{p(x_i|c)}{p(x_i|c')})\\frac{p(c|y)}{p(c'|y)}\\\\\n= \\prod_i(\\frac{p(x_i,c)}{p(x_i,c')})\\frac{p(c|y)}{p(c'|y)}(\\frac{p(c')}{p(c)})^n\n~~~~~~~~~\\text{(Semi-Naive condition)}\\\\\n\\sim \\prod_i(\\frac{N(x_i,c)}{N(x_i,c')})\\frac{p(c|y)}{p(c'|y)}(\\frac{N(c')}{N(c)})^n ~~~~~~~~~~~~~~~~~~~~~\\text{(estimate)}\n$$\n\n$$\n\\frac{p(c|x,y_1,\\cdots, y_m)}{p(c'|x,y_1,...,y_m)}\\sim ... (\\frac{N(c')}{N(c)})^{n+m-1}\\prod_i\\frac{p(c|y_i)}{p(c'|y_i)} ~~~~~~~~~(\\text{Hemi-condition})\n$$\n\n\n\n### 0-1 cases\n\n$$\nr = \\frac{p(1|x,y)}{p(0|x,y)}\\sim \\prod_i(\\frac{N(x_i,1)}{N(x_i,0)})\\frac{p(1|y)}{1-p(1|y)}(\\frac{N(0)}{N(1)})^n (Semi)\\\\\n\nr \\sim \\prod_i(\\frac{N(x_i,1)}{N(x_i,0)})\\prod_i\\frac{p(1|y_i)}{1-p(1|y_i)}(\\frac{N(0)}{N(1)})^{n+m-1} (Hemi)\n$$\n\niff $r\\geq 1$, $(x,y)$ is in class 1, else in class 0.\n\n\n\n## Estimate (for continuous rv)\n\n$p(x)\\sim \\frac{N(x)}{N}, N(x):$ the number of samples in a neighborhood of $x$", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Freakwill/thomas", "keywords": "Bayes Classifier,Statistical Learning", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "tomas", "package_url": "https://pypi.org/project/tomas/", "platform": "", "project_url": "https://pypi.org/project/tomas/", "project_urls": { "Homepage": "https://github.com/Freakwill/thomas" }, "release_url": "https://pypi.org/project/tomas/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "My Bayes algorithm, for the name of Thomas Bayes.", "version": "0.1.1" }, "last_serial": 4449254, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e5c6bee79872e07dc9e3a3b59f8d985b", "sha256": "aadb4becd6a2e0bf7485cecb9ebd034ecb81319990d8c88111e512bd3fdd774c" }, "downloads": -1, "filename": "tomas-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e5c6bee79872e07dc9e3a3b59f8d985b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2166, "upload_time": "2018-10-20T08:08:51", "url": "https://files.pythonhosted.org/packages/f0/55/aa2a03f711ae053419dc364b3b2d9a3e112fee0ffd82cd5803dafa9c82d5/tomas-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "d2ef2a5a1e32098a83ec83a1cff9b8c0", "sha256": "2d526fa3ece879d97198ebe4d0ae04883234591a28c1176625598c6c61a7c252" }, "downloads": -1, "filename": "tomas-0.1.1.tar.gz", "has_sig": false, "md5_digest": "d2ef2a5a1e32098a83ec83a1cff9b8c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2161, "upload_time": "2018-10-25T02:45:29", "url": "https://files.pythonhosted.org/packages/9b/13/430a6ef1c9d0b0c5a86ce6134d3b6d7c0ed0e69bb63c55b23df869483548/tomas-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d2ef2a5a1e32098a83ec83a1cff9b8c0", "sha256": "2d526fa3ece879d97198ebe4d0ae04883234591a28c1176625598c6c61a7c252" }, "downloads": -1, "filename": "tomas-0.1.1.tar.gz", "has_sig": false, "md5_digest": "d2ef2a5a1e32098a83ec83a1cff9b8c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2161, "upload_time": "2018-10-25T02:45:29", "url": "https://files.pythonhosted.org/packages/9b/13/430a6ef1c9d0b0c5a86ce6134d3b6d7c0ed0e69bb63c55b23df869483548/tomas-0.1.1.tar.gz" } ] }