automl/auto-sklearn

Can Autosklearn handle Multi-Class/Multi-Label Classification and which classifiers will it use?

Open

#1 429 ouverte le 25 mars 2022

Voir sur GitHub
 (8 commentaires) (0 réactions) (1 assigné)Python (1 265 forks)batch import
Good first issuedocumentationquestion

Métriques du dépôt

Stars
 (7 270 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

I have been trying to use AutoSklearn with Multi-class classification

so my labels are like this

0 1 2 3 4 ... 200 1 0 1 1 1 ... 1 0 1 0 0 1 ... 0 1 0 0 1 0 ... 0 1 1 0 1 0 ... 1 0 1 1 0 1 ... 0 1 1 1 0 0 ... 1 1 0 1 0 1 ... 0

I used this code

y = y[:, (65,67,54,133,122,63,102,105,39)]
X = df.drop(Code, axis=1, errors='ignore')
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)


automl = autosklearn.classification.AutoSklearnClassifier(
include={'feature_preprocessor': ["no_preprocessing"], 
 },
exclude={ 'classifier': ['random_forest']},
time_left_for_this_task=60*5,
per_run_time_limit=60*1,
memory_limit = 1024 * 10,
n_jobs=-1,
metric=autosklearn.metrics.f1_macro,
        )

but now I want to train Autosklearn on Multi-class Multi-label classification

Which method of these shall i use?

1-

clf = OneVsRestClassifier(automl, n_jobs=-1)
clf.fit(X_train, y_train)

2-


clf = automl
clf.fit(X_train, y_train)

3-

I have to loop one class at a time and use

clf = automl
clf.fit(X_train, y_train)

so it will be like

for i in (65,67,54,133,122,63,102,105,39):
       y = z[:, i]
       X = df.drop(Code, axis=1, errors='ignore')
       X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
      automl = autosklearn.classification.AutoSklearnClassifier(
      include={'feature_preprocessor': ["no_preprocessing"], 
       },
      exclude={ 'classifier': ['random_forest']},
      time_left_for_this_task=60*5,
      per_run_time_limit=60*1,
      memory_limit = 1024 * 10,
      n_jobs=1,
      metric=autosklearn.metrics.f1_macro,
              )


      clf = automl
      clf.fit(X_train, y_train)

so I get a different model for each label?

Guide contributeur