{ "info": { "author": "Shay Palachy", "author_email": "shay.palachy@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "fossa |fossa_icon|\n##################\n|PyPI-Status| |PyPI-Versions| |Build-Status| |Codecov| |LICENCE|\n\n.. |fossa_icon| image:: https://github.com/shaypal5/fossa/blob/88d480fd90820ea58c062029ce7e926201794e47/fossa_small.png\n\nDistribution-based anomaly detection for time series data.\n\n.. code-block:: python\n\n >>> from fossa import LastWindowX2AnomalyDetector\n >>> clf = LastWindowX2AnomalyDetector(p_threshold=0.005, normalize=True)\n >>> clf.fit(historic_data_df)\n >>> clf.predict(new_data)\n direction\n date category\n 2018-06-01 hockey 1.0\n footbal 0.0\n soccer -1.0\n tennis 0.0\n\n\n.. contents::\n\n.. section-numbering::\n\n\nInstallation\n============\n\n.. code-block:: bash\n\n pip install fossa\n\n\n\nFeatures\n========\n\n* ``scikit-learn``-like classifier API.\n* Pickle-able classifier objects.\n* Pure python.\n* Supports Python 3.5+.\n* Fully tested.\n\n\nApproach\n========\n\nBuild on top of:\nhttp://lagrange.univ-lyon1.fr/docs/scipy/0.17.1/generated/scipy.stats.power_divergence.html#scipy.stats.power_divergence\n\n\n\nUse\n===\n\nData Format\n-----------\n\nAll anomaly detectors are desgined to receive as fit parameter a ``pandas`` DataFrame with a two-leveled multi-index, the first indexing time and the second indexing category/topic frequency per-window, and a single column of a numeric dtype, giving said frequency.\n\nWhen detecting trends a similarly-indexed dataframe with detection results is returned, giving detected trends per time windows and category.\n\n\nAPI\n---\n\nAll anomaly detector objects in ``fossa`` have an identical API:\n\n- ``fit`` - Recieves a history of time-windowed distributions to train on and fits the detector on it (see the `Data Format`_ section for the exact format). The set of categories may be different across different time windows or between historic and time windoes for detection; detection is done for the union of of categories over all commitee and new time windows.\n- ``partial_fit`` - The same as ``fit``, but can also incrementaly fit an already-fit detector without necessarilly ignoring all past fitted data. Detectors who do not support incremental fitting will raise a ``NotImplementedError`` exception when this method is called.\n- ``detect_trends`` - Recieves a new dataframe (in the correct format) and detects, for each of the time windows in it, trends for each category. In addition to the ``direction`` column - indicating trend direction, with -1 for a downward trend, 0 for no trend and 1 for an upward trend - the returned dataframe might contain additional columns detailing detection confidence or probability, like p-values or commitee vote results.\n- ``predict`` - Like ``detect_trends``, except the returned dataframe always contains only a single column of detected trend directions.\n\n\nAnomaly Detectors\n-----------------\n\nChi-Square-based Detectors\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis family of anomaly detectors all operate similarly: Every detector compares new time windows to a set of committe windows that represent its idea for relevant history and characteristic behaviour of the data; one detector might look at the same hour on the same weekday across several weeks, while another might look at all the same hours in the last 10 or 20 days, or the preciding few hours.\n\nFor each of the time windows given to the ``detect_trends`` or ``predict`` methods, a one-vs-all distribution is generated for each of the categories in the window (and is possibly normalized, depending on the specific detector and its initialization parameters). Then, for each of this distributions chi-squared tests are performed between it and the corresponding distributions in each of the commitee time windows. Each commitee member \"votes\" on whether a trend is detected or not, and a decision is generated by some pre-set voting rule (for example, majority vote).\n\n\nContributing\n============\n\nCurrent package maintainer (and one of the authors) is Shay Palachy (shay.palachy@gmail.com); You are more than welcome to approach him for help. Contributions are very welcomed.\n\nInstalling for development\n----------------------------\n\nClone:\n\n.. code-block:: bash\n\n git clone git@github.com:shaypal5/fossa.git\n\n\nInstall in development mode, including test dependencies:\n\n.. code-block:: bash\n\n cd fossa\n pip install -e '.[test]'\n\n\n\nRunning the tests\n-----------------\n\nTo run the tests use:\n\n.. code-block:: bash\n\n cd fossa\n pytest\n\n\nAdding documentation\n--------------------\n\nThe project is documented using the `numpy docstring conventions`_, which were chosen as they are perhaps the most widely-spread conventions that are both supported by common tools such as Sphinx and result in human-readable docstrings. When documenting code you add to this project, follow `these conventions`_.\n\n.. _`numpy docstring conventions`: https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt\n.. _`these conventions`: https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt\n\nAdditionally, if you update this ``README.rst`` file, use ``python setup.py checkdocs`` to validate it compiles.\n\n\nCredits\n=======\n\nCreated by Shay Palachy (shay.palachy@gmail.com) and Omri Mendels.\n\n\n.. |PyPI-Status| image:: https://img.shields.io/pypi/v/fossa.svg\n :target: https://pypi.org/project/fossa\n\n.. |PyPI-Versions| image:: https://img.shields.io/pypi/pyversions/fossa.svg\n :target: https://pypi.org/project/fossa\n\n.. |Build-Status| image:: https://travis-ci.org/shaypal5/fossa.svg?branch=master\n :target: https://travis-ci.org/shaypal5/fossa\n\n.. |LICENCE| image:: https://img.shields.io/badge/License-MIT-yellow.svg\n :target: https://pypi.python.org/pypi/pdpipe\n\n.. |Codecov| image:: https://codecov.io/github/shaypal5/fossa/coverage.svg?branch=master\n :target: https://codecov.io/github/shaypal5/fossa?branch=master\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/shaypal5/fossa", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "fossa", "package_url": "https://pypi.org/project/fossa/", "platform": "", "project_url": "https://pypi.org/project/fossa/", "project_urls": { "Homepage": "https://github.com/shaypal5/fossa" }, "release_url": "https://pypi.org/project/fossa/0.0.3/", "requires_dist": [ "pandas; extra == 'test'", "numpy", "scipy", "scikit-learn", "pandas", "pytest; extra == 'test'", "coverage; extra == 'test'", "pytest-cov; extra == 'test'", "collective.checkdocs; extra == 'test'", "pygments; extra == 'test'", "numpy; extra == 'test'", "scipy; extra == 'test'", "scikit-learn; extra == 'test'" ], "requires_python": ">=3.5", "summary": "Distribution-based anomaly detection for time series.", "version": "0.0.3" }, "last_serial": 4006861, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "e20edfd654cb5dda8cecfed2335cf938", "sha256": "ea3d51ac54baf3cc909380bf635c1fb89e730420d2feef55d29e65c671ccdb38" }, "downloads": -1, "filename": "fossa-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e20edfd654cb5dda8cecfed2335cf938", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.5", "size": 9501, "upload_time": "2018-06-25T08:49:50", "url": "https://files.pythonhosted.org/packages/bd/29/d7c5090a2d479e4942dfc89ae989c5f9be0df898c326b4c440080bda2975/fossa-0.0.1-py2.py3-none-any.whl" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "e867ac7a2d9ba789d4201c8262e32857", "sha256": "e5795ad168a41432bba501ae2f5a095eed7be52e87dc9bfcf0aa4568a869a671" }, "downloads": -1, "filename": "fossa-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e867ac7a2d9ba789d4201c8262e32857", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.5", "size": 9897, "upload_time": "2018-06-25T12:29:11", "url": "https://files.pythonhosted.org/packages/d0/29/186f3d9a36852a2df9414540df868034f32a5344444222382b36c08d9341/fossa-0.0.2-py2.py3-none-any.whl" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "d5a3783f3d93dbfb0a020deb885091de", "sha256": "4955179abf569c78309eec82b990e1b46356bf905d57416e1630269de715ae7f" }, "downloads": -1, "filename": "fossa-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d5a3783f3d93dbfb0a020deb885091de", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.5", "size": 13419, "upload_time": "2018-06-27T10:58:10", "url": "https://files.pythonhosted.org/packages/8b/36/ea77dc66ea25db7cfad39378ce3b53c0a020d020a5e89645ded569ea27a0/fossa-0.0.3-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d5a3783f3d93dbfb0a020deb885091de", "sha256": "4955179abf569c78309eec82b990e1b46356bf905d57416e1630269de715ae7f" }, "downloads": -1, "filename": "fossa-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d5a3783f3d93dbfb0a020deb885091de", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.5", "size": 13419, "upload_time": "2018-06-27T10:58:10", "url": "https://files.pythonhosted.org/packages/8b/36/ea77dc66ea25db7cfad39378ce3b53c0a020d020a5e89645ded569ea27a0/fossa-0.0.3-py2.py3-none-any.whl" } ] }