Menelau / DESlib

A Python library for dynamic classifier and ensemble selection. Note that this repository is just a fork. The original repository is hosted on scikit-learn-contrib: https://github.com/scikit-learn-contrib/DESlib
BSD 3-Clause "New" or "Revised" License
72 stars 25 forks source link

A problem with the prediction of continuous variables (regression tasks ) using deslib library #1

Open maryam3066 opened 4 years ago

maryam3066 commented 4 years ago

### Hi, I try to predict continuous variables (regression task not classification tasks). for example, I want to predict software effort estimation with dynamic ensemble algorithms like knorae . I use deslib library for this estimation. When I use knorae, it runs without any error and predicts some values. Like these codes:

train and prediction on knorae algorithm

data=arff.loadarff('maxwell.arff') df=pd.DataFrame(data[0]) from sklearn.model_selection import train_test_split from deslib.des import KNORAE X=df.drop('Effort',axis=1) y=df['Effort'] X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.33,random_state=rng) kne=KNORAE(random_state=rng) kne.fit(X_train,y_train) out:BaggingRegressor(base_estimator=None, bootstrap=True, bootstrap_features=False, max_features=1.0, max_samples=1.0, n_estimators=10, n_jobs=None, oob_score=False, random_state=None, verbose=0, warm_start=False) kne.predict(X_test) out:array([1520., 1450., 1520., 3600., 2330., 4150., 2330., 1100., 4557., 1060., 1450., 1060., 1745., 900., 4150., 3600., 1450., 4557., 1233., 1651., 4150.]) ### But when I use bagging regressor with knorae this error arises: from sklearn.ensemble import BaggingRegressor pool_regressor=BaggingRegressor() pool_regressor.fit(X_train,y_train) out:BaggingRegressor(base_estimator=None, bootstrap=True, bootstrap_features=False, max_features=1.0, max_samples=1.0, n_estimators=10, n_jobs=None, oob_score=False, random_state=None, verbose=0, warm_start=False) kne=KNORAE(pool_regressor,random_state=rng) kne.fit(X_train,y_train) OUT:KNORAE(DFP=False, DSEL_perc=0.5, IH_rate=0.3, k=7, knn_classifier='knn', pool_classifiers=BaggingRegressor(base_estimator=None, bootstrap=True, bootstrap_features=False, max_features=1.0, max_samples=1.0, n_estimators=10, n_jobs=None, oob_score=False, random_state=None, verbose=0, warm_start=False), random_state=RandomState(MT19937) at 0x238D368A360, safe_k=None, kne.predict(X_test) **OUT:IndexError Traceback (most recent call last)

in ----> 1 kne.predict(X_test) ~\Anaconda3\lib\site-packages\deslib\base.py in predict(self, X) 520 predicted_labels[ind_ds_original_matrix] = pred_ds 521 --> 522 return self.classes_.take(predicted_labels) 523 524 def predict_proba(self, X): IndexError: index 1981 is out of bounds for size 41** ### **Do deslib library protect regression tasks? How can I fix it? Please help me.**
Menelau commented 4 years ago

@maryam3066 Hello,

The library currently only supports classification problems. Regression support will be added in future versions.

This repository is just a fork of the original one hosted on scikit-learn-contrib: So if you have any other questions or request, please open an issue in the main repository.