{"id":13576340,"url":"https://github.com/HLT-ISTI/QuaPy","last_synced_at":"2025-04-05T05:31:34.593Z","repository":{"id":40757409,"uuid":"321645678","full_name":"HLT-ISTI/QuaPy","owner":"HLT-ISTI","description":"A framework for Quantification written in Python","archived":false,"fork":false,"pushed_at":"2024-12-04T09:14:31.000Z","size":9553,"stargazers_count":61,"open_issues_count":1,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-05T14:06:10.412Z","etag":null,"topics":["machine-learning","quantification","supervised-prevalence-estimation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HLT-ISTI.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGE_LOG.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-15T11:22:30.000Z","updated_at":"2025-01-25T23:05:50.000Z","dependencies_parsed_at":"2023-02-16T20:01:01.697Z","dependency_job_id":"b716896f-46d6-49c9-8674-f737a3dd7e4e","html_url":"https://github.com/HLT-ISTI/QuaPy","commit_stats":{"total_commits":228,"total_committers":5,"mean_commits":45.6,"dds":"0.13157894736842102","last_synced_commit":"1826d8a8dcad1095851d2a439310b9cc6ec15d36"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HLT-ISTI%2FQuaPy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HLT-ISTI%2FQuaPy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HLT-ISTI%2FQuaPy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HLT-ISTI%2FQuaPy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HLT-ISTI","download_url":"https://codeload.github.com/HLT-ISTI/QuaPy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294424,"owners_count":20915333,"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":["machine-learning","quantification","supervised-prevalence-estimation"],"created_at":"2024-08-01T15:01:09.374Z","updated_at":"2025-04-05T05:31:29.580Z","avatar_url":"https://github.com/HLT-ISTI.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# QuaPy\n\nQuaPy is an open source framework for quantification (a.k.a. supervised prevalence estimation, or learning to quantify)\nwritten in Python.\n\nQuaPy is based on the concept of \"data sample\", and provides implementations of the\nmost important aspects of the quantification workflow, such as (baseline and advanced)\nquantification methods, \nquantification-oriented model selection mechanisms, evaluation measures, and evaluations protocols\nused for evaluating quantification methods.\nQuaPy also makes available commonly used datasets, and offers visualization tools \nfor facilitating the analysis and interpretation of the experimental results.\n\n### Last updates:\n\n* Version 0.1.9 is released! major changes can be consulted [here](CHANGE_LOG.txt).\n* The developer API documentation is available [here](https://hlt-isti.github.io/QuaPy/index.html)\n\n### Installation\n\n```commandline\npip install quapy\n```\n\n### Cite QuaPy\n\nIf you find QuaPy useful (and we hope you will), please consider citing the original paper in your research:\n\n```\n@inproceedings{moreo2021quapy,\n  title={QuaPy: a python-based framework for quantification},\n  author={Moreo, Alejandro and Esuli, Andrea and Sebastiani, Fabrizio},\n  booktitle={Proceedings of the 30th ACM International Conference on Information \\\u0026 Knowledge Management},\n  pages={4534--4543},\n  year={2021}\n}\n```\n\n## A quick example:\n\nThe following script fetches a dataset of tweets, trains, applies, and evaluates a quantifier based on the \n_Adjusted Classify \u0026 Count_ quantification method, using, as the evaluation measure, the _Mean Absolute Error_ (MAE)\nbetween the predicted and the true class prevalence values\nof the test set.\n\n```python\nimport quapy as qp\n\ndataset = qp.datasets.fetch_UCIBinaryDataset(\"yeast\")\ntraining, test = dataset.train_test\n\n# create an \"Adjusted Classify \u0026 Count\" quantifier\nmodel = qp.method.aggregative.ACC()\nmodel.fit(training)\n\nestim_prevalence = model.quantify(test.X)\ntrue_prevalence  = test.prevalence()\n\nerror = qp.error.mae(true_prevalence, estim_prevalence)\nprint(f'Mean Absolute Error (MAE)={error:.3f}')\n```\n\nQuantification is useful in scenarios characterized by prior probability shift. In other\nwords, we would be little interested in estimating the class prevalence values of the test set if \nwe could assume the IID assumption to hold, as this prevalence would be roughly equivalent to the \nclass prevalence of the training set. For this reason, any quantification model \nshould be tested across many samples, even ones characterized by class prevalence \nvalues different or very different from those found in the training set.\nQuaPy implements sampling procedures and evaluation protocols that automate this workflow.\nSee the [documentation](https://hlt-isti.github.io/QuaPy/manuals/protocols.html) \nand the [examples directory](https://github.com/HLT-ISTI/QuaPy/tree/master/examples) for detailed examples.\n\n## Features\n\n* Implementation of many popular quantification methods (Classify-\u0026-Count and its variants, Expectation Maximization,\nquantification methods based on structured output learning, HDy, QuaNet, quantification ensembles, among others).\n* Versatile functionality for performing evaluation based on sampling generation protocols (e.g., APP, NPP, etc.).\n* Implementation of most commonly used evaluation metrics (e.g., AE, RAE, NAE, NRAE, SE, KLD, NKLD, etc.).\n* Datasets frequently used in quantification (textual and numeric), including:\n    * 32 UCI Machine Learning datasets.\n    * 11 Twitter quantification-by-sentiment datasets.\n    * 3 product reviews quantification-by-sentiment datasets. \n    * 4 tasks from LeQua 2022 competition\n    * 4 tasks from LeQua 2024 competition (_new in v0.1.9!_)\n* Native support for binary and single-label multiclass quantification scenarios.\n* Model selection functionality that minimizes quantification-oriented loss functions.\n* Visualization tools for analysing the experimental results.\n\n## Requirements\n\n* scikit-learn, numpy, scipy\n* pytorch (for QuaNet)\n* svmperf patched for quantification (see below)\n* joblib\n* tqdm\n* pandas, xlrd\n* matplotlib\n\n## Contributing\n\nIn case you want to contribute improvements to quapy, please generate pull request to the \"devel\" branch.\n  \n## Documentation\n\nThe developer API documentation is available [here](https://hlt-isti.github.io/QuaPy/). \n\nCheck out our [Wiki](https://hlt-isti.github.io/QuaPy/manuals.html), in which many examples\nare provided:\n\n* [Datasets](https://hlt-isti.github.io/QuaPy/manuals/datasets.html)\n* [Evaluation](https://hlt-isti.github.io/QuaPy/manuals/evaluation.html)\n* [Explicit loss minimization](https://hlt-isti.github.io/QuaPy/manuals/explicit-loss-minimization.html)\n* [Methods](https://hlt-isti.github.io/QuaPy/manuals/methods.html)\n* [Model Selection](https://hlt-isti.github.io/QuaPy/manuals/datasets.html)\n* [Plotting](https://hlt-isti.github.io/QuaPy/manuals/plotting.html)\n* [Protocols](https://hlt-isti.github.io/QuaPy/manuals/protocols.html)\n\n## Acknowledgments:\n\nThis work has been founded by the QuaDaSh project (P2022TB5JF) ``Finanziato dall’Unione europea- Next Generation EU, Missione 4 Componente 2 CUP B53D23026250001\".\n\n\u003cimg src=\"docs/source/EUfooter.png\" alt=\"EUcommission\" width=\"1000\"/\u003e\n\u003cimg src=\"docs/source/SoBigData.png\" alt=\"SoBigData++\" width=\"250\"/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHLT-ISTI%2FQuaPy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHLT-ISTI%2FQuaPy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHLT-ISTI%2FQuaPy/lists"}