{"id":15288164,"url":"https://github.com/pietrobarbiero/meco","last_synced_at":"2026-01-05T13:34:05.226Z","repository":{"id":57440539,"uuid":"406013110","full_name":"pietrobarbiero/meco","owner":"pietrobarbiero","description":"MECO: Multi-objective Evolutionary Compression","archived":false,"fork":false,"pushed_at":"2022-06-18T10:51:30.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-04T06:36:05.045Z","etag":null,"topics":["compression-algorithm","coresets","evolutionary-algorithms","feature-selection","lossy-compression","machine-learning","multi-objective-optimization","nsga-ii","optimization-algorithms","sklearn"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pietrobarbiero.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-13T14:46:59.000Z","updated_at":"2022-11-25T23:36:24.000Z","dependencies_parsed_at":"2022-09-19T10:22:33.932Z","dependency_job_id":null,"html_url":"https://github.com/pietrobarbiero/meco","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietrobarbiero%2Fmeco","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietrobarbiero%2Fmeco/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietrobarbiero%2Fmeco/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietrobarbiero%2Fmeco/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pietrobarbiero","download_url":"https://codeload.github.com/pietrobarbiero/meco/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245212304,"owners_count":20578443,"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":["compression-algorithm","coresets","evolutionary-algorithms","feature-selection","lossy-compression","machine-learning","multi-objective-optimization","nsga-ii","optimization-algorithms","sklearn"],"created_at":"2024-09-30T15:44:30.803Z","updated_at":"2026-01-05T13:34:00.189Z","avatar_url":"https://github.com/pietrobarbiero.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"MECO: Multi-objective Evolutionary Compression\n======================================================\n\n|Build|\n|Coverage|\n|Dependendencies|\n|PyPI license|\n|PyPI-version|\n\n\n\n.. |Build| image:: https://img.shields.io/travis/pietrobarbiero/meco?label=Master%20Build\u0026style=for-the-badge\n    :alt: Travis (.org)\n    :target: https://travis-ci.com/pietrobarbiero/meco\n\n.. |Coverage| image:: https://img.shields.io/codecov/c/gh/pietrobarbiero/meco?label=Test%20Coverage\u0026style=for-the-badge\n    :alt: Codecov\n    :target: https://codecov.io/gh/pietrobarbiero/meco\n\n.. |Dependendencies| image:: https://img.shields.io/requires/github/pietrobarbiero/meco?style=for-the-badge\n    :alt: Requires.io\n    :target: https://requires.io/github/pietrobarbiero/meco/requirements/?branch=master\n\n.. |PyPI license| image:: https://img.shields.io/pypi/l/meco.svg?style=for-the-badge\n   :target: https://pypi.python.org/pypi/meco/\n\n.. |PyPI-version| image:: https://img.shields.io/pypi/v/meco?style=for-the-badge\n    :alt: PyPI\n    :target: https://pypi.python.org/pypi/meco/\n\nThe MECO (Multi-objective Evolutionary\nCOmpression) algorithm is a tool to perform:\n\n* dataset compression,\n* feature selection, and\n* coreset discovery.\n\n\nThis python package provides a sklearn-like transformer\nimplementation of the MECO algorithm.\n\nQuick start\n-----------\n\nYou can install the ``meco`` package along with all its dependencies from\n`PyPI \u003chttps://pypi.org/project/meco/\u003e`__:\n\n.. code:: bash\n\n    $ pip install meco\n\n\nExample\n------------\n\nFor this simple experiment, let's use the `digits \u003chttps://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_digits.html\u003e`__\ndataset from sklearn. We first need to import the dataset,\na simple sklearn classifier (e.g. Ridge) and the ``MECO`` transformer.\nWe can then load the dataset, create a ``MECO`` model, and\nfit the model on the ``digits`` dataset:\n\n.. code:: python\n\n    from sklearn.datasets import load_digits\n    from sklearn.linear_model import RidgeClassifier\n\n    from meco import MECO\n\n    X, y = load_digits(return_X_y=True)\n\n    model = MECO(RidgeClassifier(random_state=42))\n    model.fit(X, y)\n\nOnce training is over, we get a view of the `compressed`\ninput data ``X`` containing the most relevant samples\n(i.e. a subset of the rows in ``X``, a.k.a. the `coreset`),\nand the most relevant features (i.e. a subset of the columns in ``X``):\n\n.. code:: python\n\n    x_reduced = model.transform(X)\n\nOnce trained, the ``model.best_set_`` dictionary contains:\n\n* the indices of the most relevant samples,\n* the indices of the most relevant features, and\n* the validation accuracy of the compressed dataset ``x_reduced``, e.g.:\n\n.. code:: python\n\n    \u003e\u003e\u003e model.best_set_\n    {\n        'samples': [0, 2, 4, ...],\n        'features': [3, 7, 8, ...],\n        'accuracy': 0.9219,\n    }\n\nThe compressed dataset ``(x_reduced, y_reduced)`` can be used\ninstead of the original dataset ``(X, y)`` to train machine\nlearning models more efficiently:\n\n.. code:: python\n\n    from sklearn.ensemble import RandomForestClassifier\n\n    y_reduced = y[model.best_set_['samples']]\n\n    classifier = RandomForestClassifier(random_state=42)\n    classifier.fit(x_reduced, y_reduced)\n\nTasks\n-----\n\nDataset compression\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nShould you need to compress the **whole** dataset ``X``\n(i.e. for dataset compression), you can set the parameter ``compression``\nto ``'both'`` (this is the **default** behaviour anyway):\n\n.. code:: python\n\n    model = MECO(RidgeClassifier(), compression='both')\n\n\nCoreset discovery\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nShould you need to compress the **rows** of ``X`` only\n(i.e. for coreset discovery), you can set the parameter ``compression``\nto ``'samples'``:\n\n.. code:: python\n\n    model = MECO(RidgeClassifier(), compression='samples')\n\n\nFeature selection\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nShould you need to compress the **columns** of ``X`` only\n(i.e. for feature selection), you can set the parameter ``compression``\nto ``'features'``:\n\n.. code:: python\n\n    model = MECO(RidgeClassifier(), compression='features')\n\n\n\nCiting\n----------\n\nIf you find MECO useful in your research, please consider citing the following papers::\n\n    @inproceedings{barbiero2019novel,\n      title={A Novel Outlook on Feature Selection as a Multi-objective Problem},\n      author={Barbiero, Pietro and Lutton, Evelyne and Squillero, Giovanni and Tonda, Alberto},\n      booktitle={International Conference on Artificial Evolution (Evolution Artificielle)},\n      pages={68--81},\n      year={2019},\n      organization={Springer}\n    }\n\n    @article{barbiero2020uncovering,\n      title={Uncovering Coresets for Classification With Multi-Objective Evolutionary Algorithms},\n      author={Barbiero, Pietro and Squillero, Giovanni and Tonda, Alberto},\n      journal={arXiv preprint arXiv:2002.08645},\n      year={2020}\n    }\n\n\nSource\n------\n\nThe source code and minimal working examples can be found on\n`GitHub \u003chttps://github.com/pietrobarbiero/meco\u003e`__.\n\n\nAuthors\n-------\n\n`Pietro Barbiero \u003chttp://www.pietrobarbiero.eu/\u003e`__,\n`Giovanni Squillero \u003chttps://staff.polito.it/giovanni.squillero/\u003e`__,\nand\n`Alberto Tonda \u003chttps://www.researchgate.net/profile/Alberto_Tonda\u003e`__.\n\nLicence\n-------\n\nCopyright 2020 Pietro Barbiero, Giovanni Squillero, and Alberto Tonda.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may\nnot use this file except in compliance with the License. You may obtain\na copy of the License at: http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\nSee the License for the specific language governing permissions and\nlimitations under the License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpietrobarbiero%2Fmeco","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpietrobarbiero%2Fmeco","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpietrobarbiero%2Fmeco/lists"}