Skip to content

Fix leaderboard in estimators.py#1784

Open
lamauamal wants to merge 1 commit into
automl:developmentfrom
lamauamal:fix-leaderboard
Open

Fix leaderboard in estimators.py#1784
lamauamal wants to merge 1 commit into
automl:developmentfrom
lamauamal:fix-leaderboard

Conversation

@lamauamal

Copy link
Copy Markdown

Fixed an issue in the leaderboard functionality in autosklearn/estimators.py.

Issue

When setting the details to be displayed on the leaderboard, the "data_preprocessor" field remains empty. Upon checking the code, it’s clear that the actual key used is "data_preprocessing", which doesn’t match the "data_preprocessor" key used in runhistory.json. And this issue cannot be resolved by directly modifying "data_preprocessing" to "data_preprocessor", because there’s another entry in runhistory.json, "data_preprocessor:feature_type:numerical_transformer:rescaling:__choice__", which also meets the filtering criteria of if “data_preprocessor” in key and “__choice__” in key.

  • example:
import sklearn.metrics
import autosklearn.classification
from sklearn.datasets import load_iris
import autosklearn.classification

X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = sklearn.model_selection.train_test_split(
    X, y, random_state=1
)

automl = autosklearn.classification.AutoSklearnClassifier(
    time_left_for_this_task=120,
    per_run_time_limit=30,
    include={
            "classifier": ["decision_tree", "mlp"]
        },
)
automl.fit(X_train, y_train)
print(automl.leaderboard(detailed=True).head(2).to_string())

# Before:
#           rank  ensemble_weight           type  cost  duration  config_id  train_loss  seed    start_time      end_time  budget              status data_preprocessors    feature_preprocessors balancing_strategy           config_origin
# model_id
# 22           4             0.02            mlp   0.0  2.240190         21    0.026667     0  1.779353e+09  1.779353e+09     0.0  StatusType.SUCCESS                 []  [feature_agglomeration]          weighting  Random Search (sorted)
# 29           1             0.04  decision_tree   0.0  0.604004         28    0.026667     0  1.779353e+09  1.779353e+09     0.0  StatusType.SUCCESS                 []             [polynomial]               none           Random Search

# After:
#           rank  ensemble_weight           type  cost  duration  config_id  train_loss  seed    start_time      end_time  budget              status data_preprocessors    feature_preprocessors balancing_strategy           config_origin
# model_id
# 22           5             0.02            mlp   0.0  0.839216         21    0.026667     0  1.779353e+09  1.779353e+09     0.0  StatusType.SUCCESS     [feature_type]  [feature_agglomeration]          weighting  Random Search (sorted)
# 29           3             0.08  decision_tree   0.0  0.576417         28    0.026667     0  1.779353e+09  1.779353e+09     0.0  StatusType.SUCCESS     [feature_type]             [polynomial]               none           Random Search

Changes line 1154 in estimators.py

  • Before:
"data_preprocessors": [
                        value
                        for key, value in run_config.items()
                        if "data_preprocessing" in key and "__choice__" in key
                    ]
  • After:
    "data_preprocessors": [run_config.get("data_preprocessor:__choice__")]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant