{"id":23478227,"url":"https://github.com/mrapp-ke/examplewisef1maximizer","last_synced_at":"2026-04-27T11:31:55.981Z","repository":{"id":174986455,"uuid":"653117452","full_name":"mrapp-ke/ExampleWiseF1Maximizer","owner":"mrapp-ke","description":"A scikit-learn meta-estimator for multi-label classification that aims to maximize the example-wise F1 measure","archived":false,"fork":false,"pushed_at":"2023-06-16T11:15:19.000Z","size":31,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-18T08:54:23.400Z","etag":null,"topics":["machine-learning","multilabel-classification","scikit-learn"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrapp-ke.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2023-06-13T12:44:26.000Z","updated_at":"2023-07-27T11:50:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"c313f15f-02bd-4db9-ad17-abaa0fc0db22","html_url":"https://github.com/mrapp-ke/ExampleWiseF1Maximizer","commit_stats":{"total_commits":35,"total_committers":1,"mean_commits":35.0,"dds":0.0,"last_synced_commit":"6e00909081ca8dcced830aaccff9510ef8a7eb9c"},"previous_names":["mrapp-ke/examplewisef1maximizer"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/mrapp-ke/ExampleWiseF1Maximizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrapp-ke%2FExampleWiseF1Maximizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrapp-ke%2FExampleWiseF1Maximizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrapp-ke%2FExampleWiseF1Maximizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrapp-ke%2FExampleWiseF1Maximizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrapp-ke","download_url":"https://codeload.github.com/mrapp-ke/ExampleWiseF1Maximizer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrapp-ke%2FExampleWiseF1Maximizer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32335296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","multilabel-classification","scikit-learn"],"created_at":"2024-12-24T19:17:18.862Z","updated_at":"2026-04-27T11:31:55.967Z","avatar_url":"https://github.com/mrapp-ke.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Example-wise F1 Maximizer\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![PyPI version](https://badge.fury.io/py/example-wise-f1-maximizer.svg)](https://badge.fury.io/py/example-wise-f1-maximizer)\n\n**Important links:** [Issue Tracker](https://github.com/mrapp-ke/ExampleWiseF1Maximizer/issues) | [Changelog](CHANGELOG.md) | [Code of Conduct](CODE_OF_CONDUCT.md)\n\nThis software package provides an implementation of a meta-learning algorithm for multi-label classification that aims to maximize the example-wise F1-measure. It integrates with the popular [scikit-learn](https://scikit-learn.org) machine learning framework and can also be used with frameworks for multi-label classification like [scikit-multilearn](http://scikit.ml).\n\nThe goal of [multi-label classification](https://en.wikipedia.org/wiki/Multi-label_classification) is the automatic assignment of sets of labels to individual data points, for example, the annotation of text documents with topics. The example-wise [F1-measure](https://en.wikipedia.org/wiki/F-score) is a particularly relevant evaluation measure for this kind of predictions, as it requires a classifier to achieve a good balance between labels predicted as relevant or irrelevant for an example, i.e., it must neither be to conservative nor to aggressive when it comes to predicting labels as relevant.\n\n## Methodology\n\nThe algorithm implemented by this project transforms an original multi-label problem with `n` labels into a series of `n * n + 1` binary classification problems. A probabilistic base estimator is then fit to each of these independent sub-problems as described in the following [paper](http://proceedings.mlr.press/v119/zhang20w/zhang20w.pdf):\n\n*Mingyuan Zhan, Harish G. Ramaswamy, and Shivani Agarwal. Convex Calibrated Surrogates for the Multi-Label F-Measure. In: Proceedings of the International Conference on Machine Learning (ICML), 2020.*\n    \nThe probabilities predicted by the individual base estimators for unseen examples consitute a `n x n` probability matrix `p`, as well as an additional probability `p_0`. Whereas `p_0` corresponds to the prior probability of the null vector, i.e., a label vector that does not contain any relevant labels, each probability `p_ik` at the `i`-th row and `k`-th column of `p` corresponds to the conditional probability of a label vector with `k` relevant labels, where the `i`-th label is relevant. In order to identify the label vector that maximizes the F1-measure in expectation, these probabilities are used as inputs to the \"General F-Measure maximizer\" (GFM), as proposed in the following [paper](https://proceedings.neurips.cc/paper/2011/file/71ad16ad2c4d81f348082ff6c4b20768-Paper.pdf):\n\n*Krzysztof Dembczyński, Willem Waegeman, Weiwei Cheng, and Eyke Hüllermeier. An Exact Algorithm for F-Measure Maximization. In: Advances in Neural Information Processing Systems, 2011.*\n\n**Please note that this implementation has not been written by any of the authors shown above.**\n\n## Documentation\n\n### Installation\n\nThe software package is available at [PiPy](https://pypi.org/project/example-wise-f1-maximizer/) and can easily be installed via PIP using the following command:\n\n```\npip install example-wise-f1-maximizer\n```\n\n### Usage\n\nTo use the classifier in your own Python code, you need to import the class `ExampleWiseF1Maximizer`. It can be instantiated and used as shown below:\n\n```python\nfrom example_wise_f1_maximizer import ExampleWiseF1Maximizer\nfrom sklearn.linear_model import LogisticRegression\n\nclf = ExampleWiseF1Maximizer(estimator=LogisticRegression())\nx = [[  1,  2,  3],  # Two training examples with three features\n     [ 11, 12, 13]]\ny = [[1, 0],  # Ground truth labels of each training example\n     [0, 1]]\nclf.fit(x, y)\npred = clf.predict(x)\n```\n\nThe fit method accepts two inputs, `x` and `y`:\n\n* A two-dimensional feature matrix `x`, where each row corresponds to a training example and each column corresponds to a particular feature.\n* A two-dimensional binary label matrix `y`, where each row corresponds to a training examples and each column corresponds to a label. If an element in the matrix is unlike zero, it indicates that respective label is relevant to an example. Elements that are equal to zero denote irrevant labels.\n\nBoth, `x` and `y`, are expected to be [numpy arrays](https://numpy.org/doc/stable/reference/generated/numpy.array.html) or equivalent [array-like](https://scikit-learn.org/stable/glossary.html#term-array-like) data types. In particular, the use of [scipy sparse matrices](https://docs.scipy.org/doc/scipy/reference/sparse.html) is supported.\n\nIn the previous example, logistic regression as implemented by the class `LogisticRegression` from the scikit-learn framework is used as a base estimator. Alternatively, you can use any probabilistic estimator for binary classification that is compatible with the scikit-learn framework and implements the `predict_proba` function.\n\n## License\n\nThis project is open source software licensed under the terms of the [MIT license](LICENSE.md). We welcome contributions to the project to enhance its functionality and make it more accessible to a broader audience.\n\nAll contributions to the project and discussions on the [issue tracker](https://github.com/mrapp-ke/ExampleWiseF1Maximizer/issues) are expected to follow the [code of conduct](CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrapp-ke%2Fexamplewisef1maximizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrapp-ke%2Fexamplewisef1maximizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrapp-ke%2Fexamplewisef1maximizer/lists"}