scikit-learn-contrib / DESlib

A Python library for dynamic classifier and ensemble selection
BSD 3-Clause "New" or "Revised" License
480 stars 106 forks source link

Oracle not working properly for string classes #156

Closed luccaportes closed 5 years ago

luccaportes commented 5 years ago

When calling the Oracle's predict method, if the class is a string such as "class_1", "class_2"... The Oracle does not work properly.

For what I could discover, it is just missing one call to

self._setup_label_encoder(y)

Information about my working environment (I have used google collab so I can only post a link for everyone's access):

Linux-4.14.79+-x86_64-with-Ubuntu-18.04-bionic Python 3.6.8 (default, Jan 14 2019, 11:02:34) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] NumPy 1.16.4 SciPy 1.3.0 Scikit-Learn 0.21.2

Here's the Google Collab link: https://colab.research.google.com/drive/1TRMqjgWHOeiGiVs9jOMo3GhjnXqdtzwC

We can see that the results for the Oracle are worse than almost all other techniques: Classification accuracy Single Best = 0.498 Classification accuracy Static Selection = 0.664 Classification accuracy Stacked = 0.602 Classification accuracy KNORA-U = 0.672 Classification accuracy KNORA-E = 0.596 Classification accuracy OLA = 0.578 Classification accuracy LCA = 0.468 Classification accuracy MCB = 0.552 Classification accuracy META-DES = 0.692 Oracle result: 0.502

I'll create a pull request with my proposed solution.