Skip to content

Fixing hps remain active & meta hp configuration #1536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 65 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
0a09821
fixing the issue that metalearning tries to use every hp defined in t…
Louquinze Jun 1, 2022
619ccb6
fixing the issue that metalearning tries to use every hp defined in t…
Louquinze Jun 1, 2022
7171534
fixing the issue that metalearning tries to use every hp defined in t…
Louquinze Jun 1, 2022
4631a91
fixing the issue that metalearning tries to use every hp defined in t…
Louquinze Jun 4, 2022
0bad1d4
fixing the issue that metalearning tries to use every hp defined in t…
Louquinze Jun 4, 2022
5d36fa5
fixing ensemble builder
Louquinze Jun 7, 2022
8afbd97
fixing ensemble builder
Louquinze Jun 11, 2022
de09993
fixing ensemble builder
Louquinze Jun 11, 2022
a5c9bad
fixing ensemble builder
Louquinze Jun 11, 2022
7f2f14b
fixing ensemble builder
Louquinze Jun 11, 2022
68b051e
fixing ensemble builder
Louquinze Jun 11, 2022
b940a97
fixing ensemble builder
Louquinze Jun 11, 2022
f124190
fixing ensemble builder
Louquinze Jun 11, 2022
9100749
fixing ensemble builder
Louquinze Jun 11, 2022
3149f8e
fixing ensemble builder
Louquinze Jun 11, 2022
e942807
fixing ensemble builder
Louquinze Jun 11, 2022
a27ca67
fixing ensemble builder
Louquinze Jun 11, 2022
ecb3801
fixing ensemble builder
Louquinze Jun 11, 2022
0f39c36
fixing ensemble builder
Louquinze Jun 14, 2022
cc0ffd2
fixing ensemble builder
Louquinze Jun 15, 2022
561d40e
fixing ensemble builder
Louquinze Jun 15, 2022
f6cc8a5
fixing ensemble builder
Louquinze Jun 15, 2022
37b08b8
fixing ensemble builder
Louquinze Jun 15, 2022
1e536db
Merge branch 'automl:development' into development
Louquinze Jun 15, 2022
ed3da30
fix search space bug
Louquinze Jun 15, 2022
4690854
fix search space bug
Louquinze Jun 15, 2022
aff8c04
fix search space bug
Louquinze Jun 16, 2022
e4e9fe3
fix search space bug
Louquinze Jun 16, 2022
be72171
fix search space bug
Louquinze Jun 16, 2022
34bb58f
fix search space bug
Louquinze Jun 16, 2022
6b0fdb4
fix search space bug
Louquinze Jun 16, 2022
9096ea3
fix search space bug
Louquinze Jun 16, 2022
372d979
fix search space bug
Louquinze Jun 16, 2022
3b1105e
fix search space bug
Louquinze Jun 16, 2022
b090ecf
fix search space bug
Louquinze Jun 16, 2022
280d3d0
fix typing
Louquinze Jul 3, 2022
f8df417
fixing pre-commit
Louquinze Jul 3, 2022
5b8f0d5
fixing pre-commit
Louquinze Jul 3, 2022
4739c7f
fixing pre-commit
Louquinze Jul 4, 2022
a260e39
fixing pre-commit
Louquinze Jul 4, 2022
8341e82
fixing pre-commit
Louquinze Jul 4, 2022
6cf49dd
fixing pre-commit
Louquinze Jul 4, 2022
d0f9d96
fixing pre-commit
Louquinze Jul 4, 2022
adc011e
fixing pre-commit
Louquinze Jul 4, 2022
3402ed9
fixing pre-commit
Louquinze Jul 4, 2022
3bf835e
adding new test. Test if new configuration space is correct.
Louquinze Jul 6, 2022
869db49
add new tests and fixing some issues from PR
Louquinze Jul 8, 2022
e546632
add new tests and fixing some issues from PR
Louquinze Jul 8, 2022
63b9484
add new tests and fixing some issues from PR
Louquinze Jul 8, 2022
4f47450
add new tests and fixing some issues from PR
Louquinze Jul 8, 2022
2764037
fix-1535-Exception-in-the-fit()-call-of-AutoSklearn (#1539)
eddiebergman Jul 8, 2022
519ce4d
add new tests and fixing some issues from PR
Louquinze Jul 8, 2022
05d4ca8
add new tests and fixing some issues from PR
Louquinze Jul 8, 2022
c6dbab3
chancing metalearning test to check whether the configspace adapts to…
Louquinze Jul 8, 2022
65b0378
in `test_data_preprocessing_feat_type.py` check for configuration spa…
Louquinze Jul 8, 2022
f00aa76
in `test_data_preprocessing_feat_type.py` check for configuration spa…
Louquinze Jul 8, 2022
c43627e
in `test_data_preprocessing_feat_type.py` check for configuration spa…
Louquinze Jul 8, 2022
1c26599
include feedback from review
Louquinze Jul 8, 2022
0af7f90
include feedback from review
Louquinze Jul 8, 2022
5057b26
include feedback from review
Louquinze Jul 8, 2022
18ab29e
adapted meta_data_generation search space
Louquinze Jul 10, 2022
12fe449
Bump docker/build-push-action from 1 to 3 (#1515)
dependabot[bot] Jul 11, 2022
af9d469
fix-1532-_ERROR_-asyncio.exceptions.CancelledError (#1540)
eddiebergman Jul 16, 2022
5ee30cf
Merge branch 'dev_test' of github.com:Louquinze/auto-sklearn into Lou…
mfeurer Aug 3, 2022
0d8168c
Update config space in meta-data generation script
mfeurer Aug 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ jobs:
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch

# Updating this to @v2 requires a github auth token
- name: Push to GitHub Packages
uses: docker/build-push-action@v1
uses: docker/build-push-action@v3
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -37,12 +36,11 @@ jobs:
tag_with_ref: true
tags: ${{ steps.extract_branch.outputs.branch }}

# Updating this to @v2 requires a github auth token
- name: Push to Docker Hub
uses: docker/build-push-action@v1
uses: docker/build-push-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
password: ${{ secrets.DOCKER_TOKEN }}
repository: mfeurer/auto-sklearn
tags: ${{ steps.extract_branch.outputs.branch }}

Expand Down
3 changes: 3 additions & 0 deletions autosklearn/askl_typing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from typing import Dict, Union

FEAT_TYPE_TYPE = Dict[Union[str, int], str]
284 changes: 126 additions & 158 deletions autosklearn/automl.py

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions autosklearn/evaluation/abstract_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import autosklearn.pipeline.classification
import autosklearn.pipeline.regression
from autosklearn.askl_typing import FEAT_TYPE_TYPE
from autosklearn.automl_common.common.utils.backend import Backend
from autosklearn.constants import (
CLASSIFICATION_TASKS,
Expand Down Expand Up @@ -45,6 +46,7 @@ def __init__(
self,
config: Configuration,
random_state: Optional[Union[int, np.random.RandomState]],
feat_type: Optional[FEAT_TYPE_TYPE] = None,
init_params: Optional[Dict[str, Any]] = None,
dataset_properties: Dict[str, Any] = {},
include: Optional[List[str]] = None,
Expand All @@ -61,6 +63,7 @@ def __init__(
self.dataset_properties = dataset_properties
self.include = include
self.exclude = exclude
self.feat_type = feat_type

def pre_transform(
self,
Expand Down Expand Up @@ -108,6 +111,7 @@ def __init__(
self,
config: Configuration,
random_state: Optional[Union[int, np.random.RandomState]],
feat_type: Optional[FEAT_TYPE_TYPE] = None,
init_params: Optional[Dict[str, Any]] = None,
dataset_properties: Dict[str, Any] = {},
include: Optional[List[str]] = None,
Expand All @@ -123,6 +127,7 @@ def __init__(
self.dataset_properties = dataset_properties
self.include = include
self.exclude = exclude
self.feat_type = feat_type

def pre_transform(
self,
Expand Down Expand Up @@ -217,6 +222,7 @@ def __init__(
self.queue = queue

self.datamanager = self.backend.load_datamanager()
self.feat_type = self.datamanager.feat_type
self.include = include
self.exclude = exclude

Expand Down Expand Up @@ -294,11 +300,12 @@ def __init__(
_addons[key].add_component(component)

# Please mypy to prevent not defined attr
self.model = self._get_model()
self.model = self._get_model(feat_type=self.feat_type)

def _get_model(self) -> BaseEstimator:
def _get_model(self, feat_type: Optional[FEAT_TYPE_TYPE]) -> BaseEstimator:
if not isinstance(self.configuration, Configuration):
model = self.model_class(
feat_type=feat_type,
config=self.configuration,
random_state=self.seed,
init_params=self._init_params,
Expand All @@ -318,6 +325,7 @@ def _get_model(self) -> BaseEstimator:
"multiclass": self.task_type == MULTICLASS_CLASSIFICATION,
}
model = self.model_class(
feat_type=feat_type,
config=self.configuration,
dataset_properties=dataset_properties,
random_state=self.seed,
Expand Down
2 changes: 1 addition & 1 deletion autosklearn/evaluation/test_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(
self.X_test = self.datamanager.data.get("X_test")
self.Y_test = self.datamanager.data.get("Y_test")

self.model = self._get_model()
self.model = self._get_model(self.feat_type)

def fit_predict_and_loss(self) -> None:
_fit_and_suppress_warnings(self.logger, self.model, self.X_train, self.Y_train)
Expand Down
17 changes: 10 additions & 7 deletions autosklearn/evaluation/train_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ def __init__(
budget_type=budget_type,
)

self.feat_type = self.backend.load_datamanager().feat_type
self.resampling_strategy = resampling_strategy
if resampling_strategy_args is None:
self.resampling_strategy_args = {}
Expand Down Expand Up @@ -305,7 +306,7 @@ def fit_predict_and_loss(self, iterative: bool = False) -> None:

# Test if the model allows for an iterative fit, if not,
# call this method again without the iterative argument
model = self._get_model()
model = self._get_model(self.feat_type)
if not model.estimator_supports_iterative_fit():
self.fit_predict_and_loss(iterative=False)
return
Expand All @@ -319,7 +320,9 @@ def fit_predict_and_loss(self, iterative: bool = False) -> None:
Y_test_pred = [None] * self.num_cv_folds
train_splits = [None] * self.num_cv_folds

self.models = [self._get_model() for i in range(self.num_cv_folds)]
self.models = [
self._get_model(self.feat_type) for i in range(self.num_cv_folds)
]
iterations = [1] * self.num_cv_folds
total_n_iterations = [0] * self.num_cv_folds
# model.estimator_supports_iterative_fit -> true
Expand Down Expand Up @@ -515,7 +518,7 @@ def fit_predict_and_loss(self, iterative: bool = False) -> None:
self.Y_optimization = Y_targets
self.Y_actual_train = Y_train_targets

self.model = self._get_model()
self.model = self._get_model(self.feat_type)
status = StatusType.DONOTADVANCE
if any(
[
Expand Down Expand Up @@ -679,7 +682,7 @@ def fit_predict_and_loss(self, iterative: bool = False) -> None:
self.Y_actual_train = Y_train_targets

if self.num_cv_folds > 1:
self.model = self._get_model()
self.model = self._get_model(self.feat_type)
# Bad style, but necessary for unit testing that self.model is
# actually a new model
self._added_empty_model = True
Expand Down Expand Up @@ -798,7 +801,7 @@ def _partial_fit_and_predict_iterative(
test_indices: List[int],
add_model_to_self: bool,
) -> None:
model = self._get_model()
model = self._get_model(self.feat_type)

self.indices[fold] = (train_indices, test_indices)

Expand Down Expand Up @@ -939,7 +942,7 @@ def _partial_fit_and_predict_standard(
PIPELINE_DATA_DTYPE, # test_pred
TYPE_ADDITIONAL_INFO,
]:
model = self._get_model()
model = self._get_model(self.feat_type)

self.indices[fold] = (train_indices, test_indices)

Expand Down Expand Up @@ -1005,7 +1008,7 @@ def _partial_fit_and_predict_budget(
# Add this statement for mypy
assert self.budget is not None

model = self._get_model()
model = self._get_model(self.feat_type)
self.indices[fold] = (train_indices, test_indices)
self.X_targets[fold] = self.X_train[test_indices]
self.Y_targets[fold] = self.Y_train[test_indices]
Expand Down
8 changes: 6 additions & 2 deletions autosklearn/experimental/askl2.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ def __call__(
initial_configurations = []
for member in self.portfolio.values():
try:
hp_names = scenario.cs.get_hyperparameter_names()
_member = {key: member[key] for key in member if key in hp_names}
initial_configurations.append(
Configuration(configuration_space=scenario.cs, values=member)
Configuration(configuration_space=scenario.cs, values=_member)
)
except ValueError:
pass
Expand Down Expand Up @@ -103,8 +105,10 @@ def __call__(
initial_configurations = []
for member in self.portfolio.values():
try:
hp_names = scenario.cs.get_hyperparameter_names()
_member = {key: member[key] for key in member if key in hp_names}
initial_configurations.append(
Configuration(configuration_space=scenario.cs, values=member)
Configuration(configuration_space=scenario.cs, values=_member)
)
except ValueError:
pass
Expand Down
10 changes: 8 additions & 2 deletions autosklearn/metalearning/input/aslib_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@

import arff
import pandas as pd
from ConfigSpace.configuration_space import ConfigurationSpace


class AlgorithmSelectionProblem(object):
def __init__(self, directory):
def __init__(self, directory: str, cs: ConfigurationSpace):
self.logger = logging.getLogger(__name__)

# Create data structures
self.cs = cs
self.dir_ = directory
self.algorithm_runs = None
self.configurations = None
Expand Down Expand Up @@ -143,13 +145,17 @@ def _read_configurations(self, filename):
csv_reader = csv.DictReader(fh)

configurations = dict()
hp_names = self.cs.get_hyperparameter_names()
for line in csv_reader:
configuration = dict()
algorithm_id = line["idx"]
for hp_name, value in line.items():
if not value or hp_name == "idx":
continue

if hp_name not in hp_names:
# skip hyperparameter
# if it is not existing in the current search space
continue
try:
value = int(value)
except Exception:
Expand Down
4 changes: 3 additions & 1 deletion autosklearn/metalearning/metalearning/meta_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ def __init__(self, configuration_space, aslib_directory, logger):
self.configuration_space = configuration_space
self.aslib_directory = aslib_directory

aslib_reader = aslib_simple.AlgorithmSelectionProblem(self.aslib_directory)
aslib_reader = aslib_simple.AlgorithmSelectionProblem(
self.aslib_directory, self.configuration_space
)
self.metafeatures = aslib_reader.metafeatures
self.algorithm_runs: OrderedDict[
str, pd.DataFrame
Expand Down
Loading