{ "info": { "author": "Ilya Kavalerov", "author_email": "ilyakavalerov@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.5", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Scientific/Engineering :: Mathematics", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "`sumproduct `__\n========================================================\n\n|Build Status| |Downloads|\n\nAn implementation of Belief Propagation for factor graphs, also known as\nthe sum-product algorithm\n(`Reference `__).\n\n::\n\n pip install sumproduct\n\n.. figure:: http://f.cl.ly/items/2P021j2y3A2Q191F451h/unnamed0.png\n :alt: Simple factor graph\n\n Simple factor graph\nThe factor graph used in ``test.py`` (image made with\n`yEd `__).\n\nBasic Usage\n-----------\n\nCreate a factor graph\n~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n from sumproduct import Variable, Factor, FactorGraph\n import numpy as np\n\n g = FactorGraph(silent=True) # init the graph without message printouts\n x1 = Variable('x1', 2) # init a variable with 2 states\n x2 = Variable('x2', 3) # init a variable with 3 states\n f12 = Factor('f12', np.array([\n [0.8,0.2],\n [0.2,0.8],\n [0.5,0.5]\n ])) # create a factor, node potential for p(x1 | x2)\n # connect the parents to their children\n g.add(f12)\n g.append('f12', x2) # order must be the same as dimensions in factor potential!\n g.append('f12', x1) # note: f12 potential's shape is (3,2), i.e. (x2,x1)\n\nRun Inference\n~~~~~~~~~~~~~\n\nsum-product algorithm\n^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n >>> g.compute_marginals()\n >>> g.nodes['x1'].marginal()\n array([ 0.5, 0.5])\n\nBrute force marginalization and conditioning\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThe sum-product algorithm can only compute exact marginals for acyclic\ngraphs. Check against the brute force method (at great computational\nexpense) if you have a loopy graph.\n\n::\n\n >>> g.brute_force()\n >>> g.nodes['x1'].bfmarginal\n array([ 0.5, 0.5])\n\nCondition on Observations\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n >>> g.observe('x2', 2) # observe state 1 (middle of above f12 potential)\n >>> g.compute_marginals(max_iter=500, tolerance=1e-6)\n >>> g.nodes['x1'].marginal()\n array([ 0.2, 0.8])\n >>> g.brute_force()\n >>> g.nodes['x1'].bfmarginal\n array([ 0.2, 0.8])\n\nAdditional Information\n^^^^^^^^^^^^^^^^^^^^^^\n\n``sumproduct`` implements a parallel message passing schedule: Message\npassing alternates between Factors and Variables sending messages to all\ntheir neighbors until the convergence of marginals.\n\nCheck ``test.py`` for a detailed example.\n\nImplementation Details\n----------------------\n\nSee block comments in the code's methods for details, but the\nimplementation strategy comes from Chapter 5 of `David Barber's\nbook `__.\n\n.. |Build Status| image:: https://travis-ci.org/ilyakava/sumproduct.svg?branch=master\n :target: https://travis-ci.org/ilyakava/sumproduct\n.. |Downloads| image:: https://pypip.in/download/sumproduct/badge.svg\n :target: https://pypi.python.org/pypi/sumproduct/\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/ilyakava/sumproduct/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "sumproduct", "package_url": "https://pypi.org/project/sumproduct/", "platform": "", "project_url": "https://pypi.org/project/sumproduct/", "project_urls": { "Homepage": "http://github.com/ilyakava/sumproduct/" }, "release_url": "https://pypi.org/project/sumproduct/0.0.7/", "requires_dist": null, "requires_python": "", "summary": "The sum-product algorithm. (Loopy) Belief Propagation (message passing) for factor graphs", "version": "0.0.7" }, "last_serial": 3029049, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "867322283397074caa8954aef2fa2d24", "sha256": "20c02612ba0d2befe4393bca1b8e05a962481374de6ef4d534c920132a909a05" }, "downloads": -1, "filename": "sumproduct-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "867322283397074caa8954aef2fa2d24", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 7959, "upload_time": "2014-12-28T20:21:24", "url": "https://files.pythonhosted.org/packages/0a/8c/ddd2e28d2035b22e7db235e3e5787d0f3143eb4d4e61cabcd929dc8b00a5/sumproduct-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7cb9d8103d55cbbb0e211fde2f838eb5", "sha256": "abeae1bc306f273da3443d7ac39fa85bdcdff1644a8b0c149c208f6d8297c462" }, "downloads": -1, "filename": "sumproduct-0.0.1.tar.gz", "has_sig": false, "md5_digest": "7cb9d8103d55cbbb0e211fde2f838eb5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7020, "upload_time": "2014-12-28T20:20:19", "url": "https://files.pythonhosted.org/packages/06/b4/47dfa73df423114b486399dd29384df165e932093db17bf9d8f4b7162ddb/sumproduct-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "544a3f5846b873a75d74cb796a717ee0", "sha256": "f709998eb330d871e11785e270705dee010e60db82f99bdd0e0539898bf25882" }, "downloads": -1, "filename": "sumproduct-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "544a3f5846b873a75d74cb796a717ee0", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 8401, "upload_time": "2014-12-29T12:26:50", "url": "https://files.pythonhosted.org/packages/f6/83/ce40f732cdca28cbe17b42d5abb876e4bbc4e203590edcbf98b40cb3e32d/sumproduct-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "75e6e85acc953aef3fae722af5dd127f", "sha256": "0470e8f2abc78a757794ccfa03b99ed60118c8b77a43b5f06de8a6277da9bef6" }, "downloads": -1, "filename": "sumproduct-0.0.2.tar.gz", "has_sig": false, "md5_digest": "75e6e85acc953aef3fae722af5dd127f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7286, "upload_time": "2014-12-29T12:26:47", "url": "https://files.pythonhosted.org/packages/8b/21/37e3d939c9cf7f853f38ad2d38e53118114930bb8e3114f9ee5feedf5ffe/sumproduct-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "8de854a8b98114cadc1e4818cc36c9ce", "sha256": "2ef83aa02c3176c23e5e47361af304877648b70ac4d16719174c5df6cf786dd4" }, "downloads": -1, "filename": "sumproduct-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8de854a8b98114cadc1e4818cc36c9ce", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 8445, "upload_time": "2014-12-29T12:50:44", "url": "https://files.pythonhosted.org/packages/6f/f2/2bd30f0bbb482a1a6388436d2177fca0e7abfbd017632407329e5d71c3eb/sumproduct-0.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a9439dddf6fb47da9869c4cb756c2d2a", "sha256": "9453e11ec0ec1c78fd5297c9a636f3eaf2c73ac574eddbadc590c88d4880394e" }, "downloads": -1, "filename": "sumproduct-0.0.3.tar.gz", "has_sig": false, "md5_digest": "a9439dddf6fb47da9869c4cb756c2d2a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7328, "upload_time": "2014-12-29T12:50:40", "url": "https://files.pythonhosted.org/packages/89/dd/7c6c319d96359be22727f44c19a839bd0041e99968f8b88161291aecf3bf/sumproduct-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "655dbef2925de505bccc52e5f83b59ca", "sha256": "e0137deb62734b63630ec3abf57679af69540fa9f5cddbafb9ff877fb653f8f6" }, "downloads": -1, "filename": "sumproduct-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "655dbef2925de505bccc52e5f83b59ca", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 8705, "upload_time": "2014-12-29T19:11:54", "url": "https://files.pythonhosted.org/packages/27/bd/714549bfc9ae837f319935871036ffa18eb0eb3f7788659867d10a6818df/sumproduct-0.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9a69987620f851c97f3d2f6a84b1b0db", "sha256": "1949890e8d46e200e5444fab16ce93a4e9096b5915c1a6918a2018dc1c851d78" }, "downloads": -1, "filename": "sumproduct-0.0.4.tar.gz", "has_sig": false, "md5_digest": "9a69987620f851c97f3d2f6a84b1b0db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7457, "upload_time": "2014-12-29T19:11:51", "url": "https://files.pythonhosted.org/packages/65/78/1874cea31f2ded701ce10713f2c5e9d201cd4ab8ad7ed3af4bd5346c4266/sumproduct-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "7e37602cb0e694cc7824277204058306", "sha256": "c91b05cdf82e4641c8d38f35b2079455d3179a5495f64df251888bc8e91a43cd" }, "downloads": -1, "filename": "sumproduct-0.0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7e37602cb0e694cc7824277204058306", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 9109, "upload_time": "2014-12-31T14:00:59", "url": "https://files.pythonhosted.org/packages/ed/e5/354eb8a56f455792177eb1a39f102ad19c0b27ca95cfe0013fbe5132b1b5/sumproduct-0.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5bef66300085244ada487cf0c7d59a60", "sha256": "51e45634525393cdd0ae8dc3dd75a8e2c4808e0852898a366d0a781483cdf554" }, "downloads": -1, "filename": "sumproduct-0.0.5.tar.gz", "has_sig": false, "md5_digest": "5bef66300085244ada487cf0c7d59a60", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7713, "upload_time": "2014-12-31T14:00:55", "url": "https://files.pythonhosted.org/packages/b7/28/8aa07ef3261e19c98d7d051ccc8343d346c20b13c51cf0493040eaf099e9/sumproduct-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "4ea08ada8c07b5837477911db74dee49", "sha256": "766800d17588e103ff63787b05ba2cc743790ff0e36de50e63a19bb5740942fd" }, "downloads": -1, "filename": "sumproduct-0.0.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4ea08ada8c07b5837477911db74dee49", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 9369, "upload_time": "2014-12-31T15:49:40", "url": "https://files.pythonhosted.org/packages/13/47/067d4cba90df7340ac0ca675209a7984310b72650ee6869a0af6acf06097/sumproduct-0.0.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8558961d1f0f114be8cd3ebf3051d3ff", "sha256": "18f180da6f534b2db3926a7a12c0b07af75faa28979e5c706520fa8d72751b8c" }, "downloads": -1, "filename": "sumproduct-0.0.6.tar.gz", "has_sig": false, "md5_digest": "8558961d1f0f114be8cd3ebf3051d3ff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7947, "upload_time": "2014-12-31T15:49:37", "url": "https://files.pythonhosted.org/packages/67/c4/8a854a0fcbca6fa8d2e153f8eac6c2c454d210a15bba737c1dfa063cbf74/sumproduct-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "bf16566fbd5fa05cd82acb6aaa241fec", "sha256": "e52f463117c7d1f5c7d2c86d907ed061533f464a9b53bc7ec42184e3012f100d" }, "downloads": -1, "filename": "sumproduct-0.0.7-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bf16566fbd5fa05cd82acb6aaa241fec", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 9472, "upload_time": "2017-07-17T16:00:59", "url": "https://files.pythonhosted.org/packages/92/3f/d91528b980ddbb3a8403c3277b43db5083256a3699d73043c6dbf79cc95c/sumproduct-0.0.7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "090aef84437ff3bae1712e3ec930f8cc", "sha256": "5ad98ee9fdb6a5a9a12faed7f85323654d14a37e03c4cdbdb7d03d5ba27d83d2" }, "downloads": -1, "filename": "sumproduct-0.0.7.tar.gz", "has_sig": false, "md5_digest": "090aef84437ff3bae1712e3ec930f8cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8054, "upload_time": "2017-07-17T16:00:58", "url": "https://files.pythonhosted.org/packages/59/a3/4313f90feefe5d5004d7618a87a85e95798ce5afbc53b09cb4efcd32fa09/sumproduct-0.0.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bf16566fbd5fa05cd82acb6aaa241fec", "sha256": "e52f463117c7d1f5c7d2c86d907ed061533f464a9b53bc7ec42184e3012f100d" }, "downloads": -1, "filename": "sumproduct-0.0.7-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bf16566fbd5fa05cd82acb6aaa241fec", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 9472, "upload_time": "2017-07-17T16:00:59", "url": "https://files.pythonhosted.org/packages/92/3f/d91528b980ddbb3a8403c3277b43db5083256a3699d73043c6dbf79cc95c/sumproduct-0.0.7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "090aef84437ff3bae1712e3ec930f8cc", "sha256": "5ad98ee9fdb6a5a9a12faed7f85323654d14a37e03c4cdbdb7d03d5ba27d83d2" }, "downloads": -1, "filename": "sumproduct-0.0.7.tar.gz", "has_sig": false, "md5_digest": "090aef84437ff3bae1712e3ec930f8cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8054, "upload_time": "2017-07-17T16:00:58", "url": "https://files.pythonhosted.org/packages/59/a3/4313f90feefe5d5004d7618a87a85e95798ce5afbc53b09cb4efcd32fa09/sumproduct-0.0.7.tar.gz" } ] }