{"id":25360875,"url":"https://github.com/ielis/ddplt","last_synced_at":"2025-04-09T03:33:29.868Z","repository":{"id":62567234,"uuid":"205922916","full_name":"ielis/ddplt","owner":"ielis","description":"A package with code from my ML projects that has a potential of being reusable","archived":false,"fork":false,"pushed_at":"2020-10-12T07:49:53.000Z","size":156,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-19T19:15:58.631Z","etag":null,"topics":["evaluation","machine-learning","plotting"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ielis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-02T19:25:12.000Z","updated_at":"2020-10-13T07:16:23.000Z","dependencies_parsed_at":"2022-11-03T16:30:29.810Z","dependency_job_id":null,"html_url":"https://github.com/ielis/ddplt","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ielis%2Fddplt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ielis%2Fddplt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ielis%2Fddplt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ielis%2Fddplt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ielis","download_url":"https://codeload.github.com/ielis/ddplt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247974201,"owners_count":21026739,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["evaluation","machine-learning","plotting"],"created_at":"2025-02-14T21:55:56.687Z","updated_at":"2025-04-09T03:33:29.852Z","avatar_url":"https://github.com/ielis.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ddplt\n\n[![PyPI version](https://badge.fury.io/py/ddplt.svg)](https://badge.fury.io/py/ddplt)\n\nA package with code from my ML projects that has a potential of being reusable.\n\n## Installation\n\nThe package installation is simple, since the repo is available on PyPi:\n```bash\npip install ddplt\n```\n\n## Confusion matrix\n\nDraw a confusion matrix for classification results:\n```python\nimport numpy as np\nfrom ddplt.heatmaps import draw_confusion_heatmap\n\n# generate some data \ny_test = np.array([0, 0, 1, 1, 2, 0])\ny_pred = np.array([0, 1, 1, 2, 2, 0])\nclass_names = np.array(['hip', 'hop', 'pop'])\nax, cm = draw_confusion_heatmap(y_test, y_pred, class_names)\n```\n![conf_matrix](img/cm_hip_hop_pop.png)\n\n## Cross-validated *receiver operating characteristic* and *precision-recall* curves\n\nDraw *receiver operating characteristic* (ROC) and *precision-recall* (PR) curves using *k*-fold cross-validation:\n```python\nfrom ddplt.classification import draw_roc_prc_cv\n\nfrom sklearn.datasets import make_moons\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.model_selection import KFold\n\nX, y = make_moons(500, noise=.2, random_state=123)\nestimator = LogisticRegression()\ncv = KFold(n_splits=5, shuffle=True, random_state=123)\n\ndraw_roc_prc_cv(estimator, X, y, cv)\n```\n![roc_prc_cv](img/roc_prc_cv.png)\n\n\nThe function `draw_roc_prc_cv` accepts the following parameters:\n- `estimator` - Scikit-learn's estimator with set hyperparameters. The estimator does not have to be fitted.\n- `X` - array-like with shape `(n_instances,n_features)`\n- `y` - array-like with shape `(n_instances,)` with instance labels\n- `cv` - cross-validation generator responsible for creating *k*-fold splitting of `X` and `y`\n\u003e see the docs for info regarding the optional parameters\n\nIn each CV iteration, the estimator is fitted on training fold and class probabilities are predicted for instances \nwithin the test fold. Then, ROC and PR curves are generated from the probabilities.\n\nThe figure consists of:\n- individual ROC/PR curves\n- mean ROC/PR curve\n- shaded region denoting +-1 std. dev.\n\nAreas under ROC and PR curves are reported in the legend.\n\n*Note:* Use the functions `draw_roc_cv` or `draw_prc_cv` to draw ROC or PR curves only \n\n## Learning curve\n\nTODO - not yet implemented\n\nCreate plot showing performance evaluation for different sizes of training data. The method should accept: \n- existing `Axes`\n- performance measure (e.g. accuracy, MSE, precision, recall, etc.)\n- ...\n\n## Correlation heatmap\n\nTODO - not yet implemented\n\nGrid where each square has a color denoting strength of a correlation between predictors. You can choose between Pearson and Spearman correlation coefficient, the result is shown inside the square. \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fielis%2Fddplt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fielis%2Fddplt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fielis%2Fddplt/lists"}