{ "info": { "author": "Bluesheeptoken", "author_email": "louis.fruleux1@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# CPT\n\nThis project is a cython open-source implementation of the Compact Prediction Tree algorithm using multithreading.\n\nCPT is a sequence prediction algorithm. It is a highly explainable model and good at predicting, in a finite alphabet, next value of a sequence. However, given a sequence, CPT cannot predict an element already present in this sequence. CPT needs a [tuning][2].\n\nThis implementation is based on the following research papers\n\nhttp://www.philippe-fournier-viger.com/ADMA2013_Compact_Prediction_trees.pdf\n\nhttp://www.philippe-fournier-viger.com/spmf/PAKDD2015_Compact_Prediction_tree+.pdf\n\n## Installation\n\nYou can simply use `pip install cpt`.\n\nFor windows users, the sources are precompiled. For others, you will need to install `cython`.\n\n## Simple example\n\nYou can test the model with the following code\n\n```python\nfrom cpt.cpt import Cpt\nmodel = Cpt()\n\nmodel.fit([['hello', 'world'],\n ['hello', 'this', 'is', 'me'],\n ['hello', 'me']\n ])\n\nmodel.predict([['hello'], ['hello', 'this']])\n# Output: ['me', 'is']\n```\nFor an example with the compatibility with sklearn, you should check the [documentation][1].\n\n## Features\n### Train\n\nThe model can be trained with the `fit` method.\n\nIf needed the model can be retrained with the same method. It adds new sequences to the model and do not remove the old ones.\n\n### Multithreading\n\nThe predictions are launched by default with multithreading with OpenMP.\n\nThe predictions can also be launched in a single thread with the option `multithread=False` in the `predict` method.\n\nYou can control the number of threads by setting the following environment variable `OMP_NUM_THREADS`.\n\n### Pickling\n\nYou can pickle the model to save it, and load it later via pickle library.\n```python\nfrom cpt.cpt import Cpt\nimport pickle\n\n\nmodel = Cpt()\nmodel.fit([['hello', 'world']])\n\ndumped = pickle.dumps(model)\n\nunpickled_model = pickle.loads(dumped)\n\nprint(model == unpickled_model)\n```\n\n### Explainability\n\nThe CPT class has several methods to explain the predictions.\n\nYou can see which elements are considered as `noise` (with a low presence in sequences) with `model.compute_noisy_items(noise_ratio)`.\n\nYou can retrieve trained sequences with `model.retrieve_sequence(id)`.\n\nYou can find similar sequences with `find_similar_sequences(sequence)`.\n\nYou can not yet retrieve automatically all similar sequences with the noise reduction technique.\n\n### Tuning\n\nCPT has 3 meta parameters that need to be tuned. You can check how to tune them in the [documentation][1]. To tune you can use the `model_selection` module from `sklearn`, you can find an example [here][3] on how to.\n\n[1]: https://cpt.readthedocs.io/en/latest/\n[2]: https://github.com/bluesheeptoken/CPT#tuning\n[3]: https://cpt.readthedocs.io/en/latest/example.html#sklearn-example\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://cpt.readthedocs.io/en/latest/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "cpt", "package_url": "https://pypi.org/project/cpt/", "platform": "", "project_url": "https://pypi.org/project/cpt/", "project_urls": { "Homepage": "https://cpt.readthedocs.io/en/latest/" }, "release_url": "https://pypi.org/project/cpt/1.0.2/", "requires_dist": null, "requires_python": "", "summary": "Compact Prediction Tree: A Lossless Model for Accurate Sequence Prediction", "version": "1.0.2" }, "last_serial": 5582697, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "601f1e4717fd4cb9128da9225ed20386", "sha256": "e724bdfea1669a5b558401ddaa9b933ed477ed7fc501303a5b2410096e9af4e7" }, "downloads": -1, "filename": "cpt-1.0.1-cp35-cp35m-win32.whl", "has_sig": false, "md5_digest": "601f1e4717fd4cb9128da9225ed20386", "packagetype": "bdist_wheel", "python_version": "cp35", "requires_python": null, "size": 69311, "upload_time": "2019-04-18T12:31:04", "url": "https://files.pythonhosted.org/packages/b9/4e/c03cd5b13be21d0ea4eacd042d6b7f3d247f81f5709f5641131b06bc6390/cpt-1.0.1-cp35-cp35m-win32.whl" }, { "comment_text": "", "digests": { "md5": "a5179e66d054943fd67d590c88ae4c3b", "sha256": "ee097c00fe80f02d32238bfd21a872707176bfeebe20cb460a271e0e2bd40901" }, "downloads": -1, "filename": "cpt-1.0.1-cp35-cp35m-win_amd64.whl", "has_sig": false, "md5_digest": "a5179e66d054943fd67d590c88ae4c3b", "packagetype": "bdist_wheel", "python_version": "cp35", "requires_python": null, "size": 85851, "upload_time": "2019-04-18T12:32:00", "url": "https://files.pythonhosted.org/packages/40/84/907a4211a30b51a20a79d60e7697f97315fc000576e0ca5b8e1bc816f3a1/cpt-1.0.1-cp35-cp35m-win_amd64.whl" }, { "comment_text": "", "digests": { "md5": "a900aa9947dc71b03b442223b6040f00", "sha256": "f9a4181a781fff5808dba9436382b0988858d94a061375485b72e5eef3254f3f" }, "downloads": -1, "filename": "cpt-1.0.1-cp36-cp36m-win32.whl", "has_sig": false, "md5_digest": "a900aa9947dc71b03b442223b6040f00", "packagetype": "bdist_wheel", "python_version": "cp36", "requires_python": null, "size": 70297, "upload_time": "2019-04-18T12:33:00", "url": "https://files.pythonhosted.org/packages/11/83/01290d4c0e6dd262e4b4a6088b19474c02076efa8946b6c85bc92d1eea9b/cpt-1.0.1-cp36-cp36m-win32.whl" }, { "comment_text": "", "digests": { "md5": "d4d53d837cb0ecc3b5d4b4486f1c7e21", "sha256": "ee17d6f80d580fe087074c918b42338b46bc66666fa2adfe8151dcf66ee221ea" }, "downloads": -1, "filename": "cpt-1.0.1-cp36-cp36m-win_amd64.whl", "has_sig": false, "md5_digest": "d4d53d837cb0ecc3b5d4b4486f1c7e21", "packagetype": "bdist_wheel", "python_version": "cp36", "requires_python": null, "size": 86968, "upload_time": "2019-04-18T12:33:51", "url": "https://files.pythonhosted.org/packages/0c/82/1c3122c6ce5bc70c1e5b88d5f94e3618d5638033518ed2477cf71fd976cd/cpt-1.0.1-cp36-cp36m-win_amd64.whl" }, { "comment_text": "", "digests": { "md5": "3c286643aad205a44778e30948abb550", "sha256": "b0917f0558f6dad33278cd8394d3a525d49b29de72d049e0e12ac1764d00f1bf" }, "downloads": -1, "filename": "cpt-1.0.1-cp37-cp37m-win32.whl", "has_sig": false, "md5_digest": "3c286643aad205a44778e30948abb550", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": null, "size": 70267, "upload_time": "2019-04-18T12:34:49", "url": "https://files.pythonhosted.org/packages/2c/84/16f392dbb7199320358e07b5b03e242e940c9aaddd0045f8360f03b110c6/cpt-1.0.1-cp37-cp37m-win32.whl" }, { "comment_text": "", "digests": { "md5": "e3fac11720fc1df1cdcbe8106d8d5dfb", "sha256": "6a4c322b4e5b2af2c64657f21c8902f001bc9d4ab4f20a088a825a4c49131a68" }, "downloads": -1, "filename": "cpt-1.0.1-cp37-cp37m-win_amd64.whl", "has_sig": false, "md5_digest": "e3fac11720fc1df1cdcbe8106d8d5dfb", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": null, "size": 86811, "upload_time": "2019-04-18T12:35:38", "url": "https://files.pythonhosted.org/packages/24/84/3f3f50cab30e675354923181c89902a586b550c3bec2c299839a6c45b195/cpt-1.0.1-cp37-cp37m-win_amd64.whl" }, { "comment_text": "", "digests": { "md5": "e324720497df48ba08cfbbff9b078439", "sha256": "1c5129e667d46263ea19f48a7f189fab4bff8650b8acedb4d76ca57245e526bb" }, "downloads": -1, "filename": "cpt-1.0.1.tar.gz", "has_sig": false, "md5_digest": "e324720497df48ba08cfbbff9b078439", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 97639, "upload_time": "2019-04-18T12:31:16", "url": "https://files.pythonhosted.org/packages/c2/80/8c0ffb104adf74b30cd401e28e03c4e9f8e0abf14f556b836fe88cb25db5/cpt-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "a913de9a2f206c468f363bb452a8ca6e", "sha256": "679f945c4344a29c93b0cd65dee21ec2c39a273fdc6266abb4ea3313eb3a4638" }, "downloads": -1, "filename": "cpt-1.0.2-cp35-cp35m-win32.whl", "has_sig": false, "md5_digest": "a913de9a2f206c468f363bb452a8ca6e", "packagetype": "bdist_wheel", "python_version": "cp35", "requires_python": null, "size": 69365, "upload_time": "2019-07-25T10:55:59", "url": "https://files.pythonhosted.org/packages/9b/fc/9ed84061563ae1e8f178667ed641f525ba33ae3ddecf7b23b9c1863e673d/cpt-1.0.2-cp35-cp35m-win32.whl" }, { "comment_text": "", "digests": { "md5": "25214a16f7cfe66b19f4b5cacfbb9f4b", "sha256": "30e0f189b86a8f652640e6c36af52efdfd1764bb80b4946910d29fc0af54ed82" }, "downloads": -1, "filename": "cpt-1.0.2-cp35-cp35m-win_amd64.whl", "has_sig": false, "md5_digest": "25214a16f7cfe66b19f4b5cacfbb9f4b", "packagetype": "bdist_wheel", "python_version": "cp35", "requires_python": null, "size": 85863, "upload_time": "2019-07-25T10:57:58", "url": "https://files.pythonhosted.org/packages/65/e0/c7c3a8755cd4bf59376fa9c3636b021ef6807256f4f4089f56ebbfcf2377/cpt-1.0.2-cp35-cp35m-win_amd64.whl" }, { "comment_text": "", "digests": { "md5": "9c24eda940bff1c414d934b2286911d5", "sha256": "86049cc88a21ba6a932b21b1a236a260eeb0052b86be6d30bae594b6061da833" }, "downloads": -1, "filename": "cpt-1.0.2-cp36-cp36m-win32.whl", "has_sig": false, "md5_digest": "9c24eda940bff1c414d934b2286911d5", "packagetype": "bdist_wheel", "python_version": "cp36", "requires_python": null, "size": 70386, "upload_time": "2019-07-25T11:00:13", "url": "https://files.pythonhosted.org/packages/d2/04/547225177ad528d22e91531d2527f894733d67df71048e85808665b9f0ad/cpt-1.0.2-cp36-cp36m-win32.whl" }, { "comment_text": "", "digests": { "md5": "10ddec5a779ff0ac314ead74ab0f6c7e", "sha256": "67150f9eb80b3e6665383aeb7114ff9eeac981384fd39206297e309b3b2c906b" }, "downloads": -1, "filename": "cpt-1.0.2-cp36-cp36m-win_amd64.whl", "has_sig": false, "md5_digest": "10ddec5a779ff0ac314ead74ab0f6c7e", "packagetype": "bdist_wheel", "python_version": "cp36", "requires_python": null, "size": 86789, "upload_time": "2019-07-25T11:01:47", "url": "https://files.pythonhosted.org/packages/03/2f/347b2c1977ee2967bbce5ffc5044755c68aac49f6de5def11a1ba3071e91/cpt-1.0.2-cp36-cp36m-win_amd64.whl" }, { "comment_text": "", "digests": { "md5": "c3d2e439e518c78d35a6387775c2a439", "sha256": "2a81eee043e10b575775033a2e45e4956a30d66e874d4c783f7fad826224ff8b" }, "downloads": -1, "filename": "cpt-1.0.2-cp37-cp37m-win32.whl", "has_sig": false, "md5_digest": "c3d2e439e518c78d35a6387775c2a439", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": null, "size": 70316, "upload_time": "2019-07-25T11:03:43", "url": "https://files.pythonhosted.org/packages/16/e6/61b08193016ac73abe4578d84b7d62c0a26847b5557824e3eed29a9dda3d/cpt-1.0.2-cp37-cp37m-win32.whl" }, { "comment_text": "", "digests": { "md5": "38a322e991e75d7bac97700cbbd67900", "sha256": "a6965b215727478e3709c990aa0cc8f8055cf0da228274ace03926a025a2993a" }, "downloads": -1, "filename": "cpt-1.0.2-cp37-cp37m-win_amd64.whl", "has_sig": false, "md5_digest": "38a322e991e75d7bac97700cbbd67900", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": null, "size": 86637, "upload_time": "2019-07-25T11:05:49", "url": "https://files.pythonhosted.org/packages/06/22/075d362e74677a127afc751a6b63999dbc46cc76c07023a4bb01e312adf7/cpt-1.0.2-cp37-cp37m-win_amd64.whl" }, { "comment_text": "", "digests": { "md5": "135463c7d1a8046a7be9050d9decaad7", "sha256": "facc33644334c4a502c460d3fcef2cccc37db1369a1dde00e0cf4e7617f68791" }, "downloads": -1, "filename": "cpt-1.0.2.tar.gz", "has_sig": false, "md5_digest": "135463c7d1a8046a7be9050d9decaad7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 103828, "upload_time": "2019-07-25T10:56:22", "url": "https://files.pythonhosted.org/packages/06/e6/71674c2bff6da649426b807a4d9836528be7b34a7ac1f4d4e185bf628be7/cpt-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a913de9a2f206c468f363bb452a8ca6e", "sha256": "679f945c4344a29c93b0cd65dee21ec2c39a273fdc6266abb4ea3313eb3a4638" }, "downloads": -1, "filename": "cpt-1.0.2-cp35-cp35m-win32.whl", "has_sig": false, "md5_digest": "a913de9a2f206c468f363bb452a8ca6e", "packagetype": "bdist_wheel", "python_version": "cp35", "requires_python": null, "size": 69365, "upload_time": "2019-07-25T10:55:59", "url": "https://files.pythonhosted.org/packages/9b/fc/9ed84061563ae1e8f178667ed641f525ba33ae3ddecf7b23b9c1863e673d/cpt-1.0.2-cp35-cp35m-win32.whl" }, { "comment_text": "", "digests": { "md5": "25214a16f7cfe66b19f4b5cacfbb9f4b", "sha256": "30e0f189b86a8f652640e6c36af52efdfd1764bb80b4946910d29fc0af54ed82" }, "downloads": -1, "filename": "cpt-1.0.2-cp35-cp35m-win_amd64.whl", "has_sig": false, "md5_digest": "25214a16f7cfe66b19f4b5cacfbb9f4b", "packagetype": "bdist_wheel", "python_version": "cp35", "requires_python": null, "size": 85863, "upload_time": "2019-07-25T10:57:58", "url": "https://files.pythonhosted.org/packages/65/e0/c7c3a8755cd4bf59376fa9c3636b021ef6807256f4f4089f56ebbfcf2377/cpt-1.0.2-cp35-cp35m-win_amd64.whl" }, { "comment_text": "", "digests": { "md5": "9c24eda940bff1c414d934b2286911d5", "sha256": "86049cc88a21ba6a932b21b1a236a260eeb0052b86be6d30bae594b6061da833" }, "downloads": -1, "filename": "cpt-1.0.2-cp36-cp36m-win32.whl", "has_sig": false, "md5_digest": "9c24eda940bff1c414d934b2286911d5", "packagetype": "bdist_wheel", "python_version": "cp36", "requires_python": null, "size": 70386, "upload_time": "2019-07-25T11:00:13", "url": "https://files.pythonhosted.org/packages/d2/04/547225177ad528d22e91531d2527f894733d67df71048e85808665b9f0ad/cpt-1.0.2-cp36-cp36m-win32.whl" }, { "comment_text": "", "digests": { "md5": "10ddec5a779ff0ac314ead74ab0f6c7e", "sha256": "67150f9eb80b3e6665383aeb7114ff9eeac981384fd39206297e309b3b2c906b" }, "downloads": -1, "filename": "cpt-1.0.2-cp36-cp36m-win_amd64.whl", "has_sig": false, "md5_digest": "10ddec5a779ff0ac314ead74ab0f6c7e", "packagetype": "bdist_wheel", "python_version": "cp36", "requires_python": null, "size": 86789, "upload_time": "2019-07-25T11:01:47", "url": "https://files.pythonhosted.org/packages/03/2f/347b2c1977ee2967bbce5ffc5044755c68aac49f6de5def11a1ba3071e91/cpt-1.0.2-cp36-cp36m-win_amd64.whl" }, { "comment_text": "", "digests": { "md5": "c3d2e439e518c78d35a6387775c2a439", "sha256": "2a81eee043e10b575775033a2e45e4956a30d66e874d4c783f7fad826224ff8b" }, "downloads": -1, "filename": "cpt-1.0.2-cp37-cp37m-win32.whl", "has_sig": false, "md5_digest": "c3d2e439e518c78d35a6387775c2a439", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": null, "size": 70316, "upload_time": "2019-07-25T11:03:43", "url": "https://files.pythonhosted.org/packages/16/e6/61b08193016ac73abe4578d84b7d62c0a26847b5557824e3eed29a9dda3d/cpt-1.0.2-cp37-cp37m-win32.whl" }, { "comment_text": "", "digests": { "md5": "38a322e991e75d7bac97700cbbd67900", "sha256": "a6965b215727478e3709c990aa0cc8f8055cf0da228274ace03926a025a2993a" }, "downloads": -1, "filename": "cpt-1.0.2-cp37-cp37m-win_amd64.whl", "has_sig": false, "md5_digest": "38a322e991e75d7bac97700cbbd67900", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": null, "size": 86637, "upload_time": "2019-07-25T11:05:49", "url": "https://files.pythonhosted.org/packages/06/22/075d362e74677a127afc751a6b63999dbc46cc76c07023a4bb01e312adf7/cpt-1.0.2-cp37-cp37m-win_amd64.whl" }, { "comment_text": "", "digests": { "md5": "135463c7d1a8046a7be9050d9decaad7", "sha256": "facc33644334c4a502c460d3fcef2cccc37db1369a1dde00e0cf4e7617f68791" }, "downloads": -1, "filename": "cpt-1.0.2.tar.gz", "has_sig": false, "md5_digest": "135463c7d1a8046a7be9050d9decaad7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 103828, "upload_time": "2019-07-25T10:56:22", "url": "https://files.pythonhosted.org/packages/06/e6/71674c2bff6da649426b807a4d9836528be7b34a7ac1f4d4e185bf628be7/cpt-1.0.2.tar.gz" } ] }