{ "info": { "author": "Yohann Lereclus", "author_email": "lereclus84L@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "plot_metric\n===========\n\n|PyPI-Versions| |doc_badge|\n\nLibrairie to simplify plotting of metric like ROC curve, confusion matrix etc..\n\nInstallation\n------------\nUsing pip :\n\n.. code:: sh\n\n pip install plot-metric\n\n\nExample BinaryClassification\n-------\n\nSimple binary classification\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nLet's load a simple dataset and make a train & test set :\n\n.. code:: python\n\n from sklearn.datasets import make_classification\n from sklearn.model_selection import train_test_split\n\n X, y = make_classification(n_samples=1000, n_classes=2, weights=[1,1], random_state=1)\n X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=2)\n\n\nTrain our classifier and predict our test set :\n\n.. code:: python\n\n from sklearn.ensemble import RandomForestClassifier\n\n clf = RandomForestClassifier(n_estimators=50, random_state=23)\n model = clf.fit(X_train, y_train)\n\n # Use predict_proba to predict probability of the class\n y_pred = clf.predict_proba(X_test)[:,1]\n\n\nWe can now use ``plot_metric`` to plot ROC Curve, distribution class and classification matrix :\n\n.. code:: python\n\n # Visualisation with plot_metric\n bc = BinaryClassification(y_test, y_pred, labels=[\"Class 1\", \"Class 2\"])\n\n # Figures\n plt.figure(figsize=(15,10))\n plt.subplot2grid(shape=(2,6), loc=(0,0), colspan=2)\n bc.plot_roc_curve()\n plt.subplot2grid((2,6), (0,2), colspan=2)\n bc.plot_precision_recall_curve()\n plt.subplot2grid((2,6), (0,4), colspan=2)\n bc.plot_class_distribution()\n plt.subplot2grid((2,6), (1,1), colspan=2)\n bc.plot_confusion_matrix()\n plt.subplot2grid((2,6), (1,3), colspan=2)\n bc.plot_confusion_matrix(normalize=True)\n plt.show()\n bc.print_report()\n\n >>> ________________________\n >>> | Classification Report |\n >>> \u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\u203e\n >>> precision recall f1-score support\n >>> 0 1.00 0.93 0.96 43\n >>> 1 0.96 1.00 0.98 71\n >>> micro avg 0.97 0.97 0.97 114\n >>> macro avg 0.98 0.97 0.97 114\n >>> weighted avg 0.97 0.97 0.97 114\n\n\n.. image:: example/images/example_binary_classification.png\n\nCustom parameters\n~~~~~~~~~~~~~~~~~\n\nIt is possible to customize a lot of figures parameters. You can find all parameters with documentation on the official package documentation : https://plot-metric.readthedocs.io/en/latest/\nOr you can retrieve a python dictionnary with all available parameters with the following :\n\n.. code:: python\n\n # Use the function get_function_parameters(function) to get parameters\n bc.get_function_parameters(bc.plot_roc_curve)\n\n >>> {'threshold': None,\n 'plot_threshold': True,\n 'beta': 1,\n 'linewidth': 2,\n 'fscore_iso': [0.2, 0.4, 0.6, 0.8],\n 'iso_alpha': 0.7,\n 'y_text_margin': 0.03,\n 'x_text_margin': 0.2,\n 'c_pr_curve': 'black',\n 'c_mean_prec': 'red',\n 'c_thresh': 'black',\n 'c_f1_iso': 'grey',\n 'c_thresh_point': 'red',\n 'ls_pr_curve': '-',\n 'ls_mean_prec': '--',\n 'ls_thresh': ':',\n 'ls_fscore_iso': ':',\n 'marker_pr_curve': None}\n\nFrom a custom dictionnary you can set all parameters you want and plot a figures :\n\n.. code:: python\n\n # Example custom param using dictionnary\n param_pr_plot = {\n 'c_pr_curve':'blue',\n 'c_mean_prec':'cyan',\n 'c_thresh_lines':'red',\n 'c_f1_iso':'green',\n 'beta': 2,\n }\n\n plt.figure(figsize=(6,6))\n bc.plot_precision_recall_curve(**param_pr_plot)\n plt.show()\n\n.. image:: example/images/example_binary_class_PRCurve_custom.png\n\n.. |PyPI-Versions| image:: https://img.shields.io/badge/plot__metric-v0.0.4-blue.svg\n :target: https://pypi.org/project/plot-metric/\n\n.. |doc_badge| image:: https://readthedocs.org/projects/plot-metric/badge/?version=latest\n :target: https://plot-metric.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\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://github.com/yohann84L/plot_metric/", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "plot-metric", "package_url": "https://pypi.org/project/plot-metric/", "platform": "", "project_url": "https://pypi.org/project/plot-metric/", "project_urls": { "Homepage": "https://github.com/yohann84L/plot_metric/" }, "release_url": "https://pypi.org/project/plot-metric/0.0.6/", "requires_dist": [ "scipy (>=1.1.0)", "matplotlib (>=3.0.2)", "colorlover (>=0.3.0)", "pandas (>=0.23.4)", "seaborn (>=0.9.0)", "numpy (>=1.15.4)", "scikit-learn (>=0.21.2)" ], "requires_python": "", "summary": "A package with tools for plotting metrics", "version": "0.0.6" }, "last_serial": 5736760, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "3330b70fd862872b82d31b21b8be36bb", "sha256": "fab073f7c6fdc5a2e38c83241f6175c9723d9945b453e4a597c3209b149bed9c" }, "downloads": -1, "filename": "plot_metric-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "3330b70fd862872b82d31b21b8be36bb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2318, "upload_time": "2019-07-04T13:39:30", "url": "https://files.pythonhosted.org/packages/e8/19/e7d14e32522f15cb61fee76758ed2f6be2dbfc8b4cc3956ecb769e388ecb/plot_metric-0.0.1-py3-none-any.whl" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "e13feb8abc5c0a35326c6c70cd2ada27", "sha256": "157d82aac7c6db2f581ef3006871e7efd3feda1ded5ffb1e1036cd296d75e703" }, "downloads": -1, "filename": "plot_metric-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "e13feb8abc5c0a35326c6c70cd2ada27", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4997, "upload_time": "2019-07-05T09:50:57", "url": "https://files.pythonhosted.org/packages/52/55/e306c91a8952364515c4010dd9e9969b6b3528d383e5186b1d76eacdcf05/plot_metric-0.0.2-py3-none-any.whl" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "36568fff377fdec1b7a5bb124ab7e75c", "sha256": "97f9d9ade5a016ecabaeb5cb12e6c2315260260b0f74c1747d8a3fd3085defcc" }, "downloads": -1, "filename": "plot_metric-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "36568fff377fdec1b7a5bb124ab7e75c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5986, "upload_time": "2019-07-08T09:02:45", "url": "https://files.pythonhosted.org/packages/49/1a/4a799d52b77a12f1cc6265a7ec635339eda3312cb211cdc6d974a74ebb94/plot_metric-0.0.3-py3-none-any.whl" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "409580884864f66cb45485461bfc9495", "sha256": "b3507c12b704ea9b229e6afcab87e5073da47c5b28762ec3d051ae94e3113911" }, "downloads": -1, "filename": "plot_metric-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "409580884864f66cb45485461bfc9495", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10749, "upload_time": "2019-07-24T15:30:55", "url": "https://files.pythonhosted.org/packages/3f/69/a0f2b48fd4aec52f72110d17986b55080a43a673821a60640dd198d2f0b6/plot_metric-0.0.4-py3-none-any.whl" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "bd3f89fdeb2a93fa1e8df0cc2e42fc9c", "sha256": "5549d4d9384d0cf7c9770fe35e2238d6663298c568ef928b1896d29016bb4f71" }, "downloads": -1, "filename": "plot_metric-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "bd3f89fdeb2a93fa1e8df0cc2e42fc9c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13903, "upload_time": "2019-08-27T13:17:27", "url": "https://files.pythonhosted.org/packages/ce/37/9b25baddbff3842db4042fdb4db78aa2471c4307a0ed0e82d0469049401e/plot_metric-0.0.5-py3-none-any.whl" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "5873379da2f67a568352996decf996e5", "sha256": "a4441e0990fbbb77889930640250b5a25991c086acf4f594208b0e0f84b5de4d" }, "downloads": -1, "filename": "plot_metric-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "5873379da2f67a568352996decf996e5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13911, "upload_time": "2019-08-27T13:32:20", "url": "https://files.pythonhosted.org/packages/95/2a/dae5d81116c8226c7fdbd711460ea568ac87420cd447cf219524695646c2/plot_metric-0.0.6-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5873379da2f67a568352996decf996e5", "sha256": "a4441e0990fbbb77889930640250b5a25991c086acf4f594208b0e0f84b5de4d" }, "downloads": -1, "filename": "plot_metric-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "5873379da2f67a568352996decf996e5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13911, "upload_time": "2019-08-27T13:32:20", "url": "https://files.pythonhosted.org/packages/95/2a/dae5d81116c8226c7fdbd711460ea568ac87420cd447cf219524695646c2/plot_metric-0.0.6-py3-none-any.whl" } ] }