Package: meco
The MECO (Multi-objective Evolutionary
COmpression) algorithm is a tool to perform:dataset compression,feature selection, andcoreset discovery.This python package provides a sklearn-like transformer
implementation of the MECO algorithm.Quick startYou can install themecopackage along with all its dependencies fromPyPI:$pipinstallmecoExampleFor this simple experiment, let’s use thedigitsdataset from sklearn. We first need to import the dataset,
a simple sklearn classifier (e.g. Ridge) and theMECOtransformer.
We can then load the dataset, create aMECOmodel, and
fit the model on thedigitsdataset:fromsklearn.datasetsimportload_digitsfromsklearn.linear_modelimportRidgeClassifierfrommecoimportMECOX,y=load_digits(return_X_y=True)model=MECO(RidgeClassifier(random_state=42))model.fit(X,y)Once training is over, we get a view of thecompressedinput dataXcontaining the most relevant samples
(i.e. a subset of the rows inX, a.k.a. thecoreset),
and the most relevant features (i.e. a subset of the columns inX):x_reduced=model.transform(X)Once trained, themodel.best_set_dictionary contains:the indices of the most relevant samples,the indices of the most relevant features, andthe validation accuracy of the compressed datasetx_reduced, e.g.:>>>model.best_set_{'samples':[0,2,4,...],'features':[3,7,8,...],'accuracy':0.9219,}The compressed dataset(x_reduced, y_reduced)can be used
instead of the original dataset(X, y)to train machine
learning models more efficiently:fromsklearn.ensembleimportRandomForestClassifiery_reduced=y[model.best_set_['samples']]classifier=RandomForestClassifier(random_state=42)classifier.fit(x_reduced,y_reduced)TasksDataset compressionShould you need to compress thewholedatasetX(i.e. for dataset compression), you can set the parametercompressionto'both'(this is thedefaultbehaviour anyway):model=MECO(RidgeClassifier(),compression='both')Coreset discoveryShould you need to compress therowsofXonly
(i.e. for coreset discovery), you can set the parametercompressionto'samples':model=MECO(RidgeClassifier(),compression='samples')Feature selectionShould you need to compress thecolumnsofXonly
(i.e. for feature selection), you can set the parametercompressionto'features':model=MECO(RidgeClassifier(),compression='features')CitingIf you find MECO useful in your research, please consider citing the following papers:@inproceedings{barbiero2019novel,
  title={A Novel Outlook on Feature Selection as a Multi-objective Problem},
  author={Barbiero, Pietro and Lutton, Evelyne and Squillero, Giovanni and Tonda, Alberto},
  booktitle={International Conference on Artificial Evolution (Evolution Artificielle)},
  pages={68--81},
  year={2019},
  organization={Springer}
}

@article{barbiero2020uncovering,
  title={Uncovering Coresets for Classification With Multi-Objective Evolutionary Algorithms},
  author={Barbiero, Pietro and Squillero, Giovanni and Tonda, Alberto},
  journal={arXiv preprint arXiv:2002.08645},
  year={2020}
}SourceThe source code and minimal working examples can be found onGitHub.AuthorsPietro Barbiero,Giovanni Squillero,
andAlberto Tonda.LicenceCopyright 2020 Pietro Barbiero, Giovanni Squillero, and Alberto Tonda.Licensed under the Apache License, Version 2.0 (the “License”); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0.Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions and
limitations under the License.