Skip to content

Commit 0b94b9d

Browse files
committed
fix tests
1 parent dd07bcc commit 0b94b9d

File tree

6 files changed

+32
-30
lines changed

6 files changed

+32
-30
lines changed

autoPyTorch/api/base_task.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ def __init__(
256256
self.input_validator: Optional[BaseInputValidator] = None
257257

258258
self.search_space_updates = search_space_updates
259+
259260
if search_space_updates is not None:
260261
if not isinstance(self.search_space_updates,
261262
HyperparameterSearchSpaceUpdates):

autoPyTorch/evaluation/train_evaluator.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -196,24 +196,24 @@ def fit_predict_and_loss(self) -> None:
196196
additional_run_info = pipeline.get_additional_run_info() if hasattr(
197197
pipeline, 'get_additional_run_info') else {}
198198

199-
# add learning curve of configurations to additional_run_info
200-
if isinstance(pipeline, TabularClassificationPipeline):
201-
if hasattr(pipeline.named_steps['trainer'], 'run_summary'):
202-
run_summary = pipeline.named_steps['trainer'].run_summary
203-
split_types = ['train', 'val', 'test']
204-
run_summary_dict = dict(
205-
run_summary={},
206-
budget=self.budget,
207-
seed=self.seed,
208-
config_id=self.configuration.config_id,
209-
num_run=self.num_run
210-
)
211-
for split_type in split_types:
212-
run_summary_dict['run_summary'][f'{split_type}_loss'] = run_summary.performance_tracker.get(f'{split_type}_loss', None)
213-
run_summary_dict['run_summary'][f'{split_type}_metrics'] = run_summary.performance_tracker.get(f'{split_type}_metrics', None)
214-
self.logger.debug(f"run_summary_dict {json.dumps(run_summary_dict)}")
215-
with open(os.path.join(self.backend.temporary_directory, 'run_summary.txt'), 'a') as file:
216-
file.write(f"{json.dumps(run_summary_dict)}\n")
199+
# # add learning curve of configurations to additional_run_info
200+
# if isinstance(pipeline, TabularClassificationPipeline):
201+
# if hasattr(pipeline.named_steps['trainer'], 'run_summary'):
202+
# run_summary = pipeline.named_steps['trainer'].run_summary
203+
# split_types = ['train', 'val', 'test']
204+
# run_summary_dict = dict(
205+
# run_summary={},
206+
# budget=self.budget,
207+
# seed=self.seed,
208+
# config_id=self.configuration.config_id,
209+
# num_run=self.num_run
210+
# )
211+
# for split_type in split_types:
212+
# run_summary_dict['run_summary'][f'{split_type}_loss'] = run_summary.performance_tracker.get(f'{split_type}_loss', None)
213+
# run_summary_dict['run_summary'][f'{split_type}_metrics'] = run_summary.performance_tracker.get(f'{split_type}_metrics', None)
214+
# self.logger.debug(f"run_summary_dict {json.dumps(run_summary_dict)}")
215+
# with open(os.path.join(self.backend.temporary_directory, 'run_summary.txt'), 'a') as file:
216+
# file.write(f"{json.dumps(run_summary_dict)}\n")
217217

218218
status = StatusType.SUCCESS
219219

autoPyTorch/pipeline/components/preprocessing/tabular_preprocessing/coalescer/base_coalescer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ def __init__(self) -> None:
1212
self._processing = True
1313
self.add_fit_requirements([
1414
FitRequirement('categorical_columns', (List,), user_defined=True, dataset_property=True),
15-
FitRequirement('categories', (List,), user_defined=True, dataset_property=True)
1615
])
1716

1817
def transform(self, X: Dict[str, Any]) -> Dict[str, Any]:

autoPyTorch/pipeline/components/preprocessing/tabular_preprocessing/feature_preprocessing/utils.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,15 @@ def percentage_value_range_to_integer_range(
8282
else:
8383
log = hyperparameter_search_space.log
8484

85-
min_hyperparameter_value = hyperparameter_search_space.value_range[0]
86-
if len(hyperparameter_search_space.value_range) > 1:
87-
max_hyperparameter_value = hyperparameter_search_space.value_range[1]
88-
else:
89-
max_hyperparameter_value = hyperparameter_search_space.value_range[0]
85+
value_range = (
86+
floor(float(hyperparameter_search_space.value_range[0]) * n_features),
87+
floor(float(hyperparameter_search_space.value_range[-1]) * n_features)) \
88+
if len(hyperparameter_search_space.value_range) == 2 else \
89+
(floor(float(hyperparameter_search_space.value_range[0]) * n_features),)
9090

9191
hyperparameter_search_space = HyperparameterSearchSpace(
9292
hyperparameter=hyperparameter_name,
93-
value_range=(
94-
floor(float(min_hyperparameter_value) * n_features),
95-
floor(float(max_hyperparameter_value) * n_features)),
93+
value_range=value_range,
9694
default_value=ceil(float(hyperparameter_search_space.default_value) * n_features),
9795
log=log)
9896
else:

autoPyTorch/pipeline/components/training/trainer/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ def _fit(self, X: Dict[str, Any], y: Any = None, **kwargs: Any) -> 'TrainerChoic
453453

454454
# change model
455455
update_model_state_dict_from_swa(X['network'], self.choice.swa_model.state_dict())
456-
if self.choice.use_snapshot_ensemble:
456+
if self.choice.use_snapshot_ensemble and len(self.choice.model_snapshots) > 0:
457457
# we update only the last network which pertains to the stochastic weight averaging model
458458
swa_utils.update_bn(X['train_data_loader'], self.choice.model_snapshots[-1].double())
459459

autoPyTorch/pipeline/tabular_regression.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
from autoPyTorch.pipeline.components.preprocessing.tabular_preprocessing.TabularColumnTransformer import (
1818
TabularColumnTransformer
1919
)
20+
from autoPyTorch.pipeline.components.preprocessing.tabular_preprocessing.column_splitting.ColumnSplitter import (
21+
ColumnSplitter
22+
)
2023
from autoPyTorch.pipeline.components.preprocessing.tabular_preprocessing.coalescer import (
2124
CoalescerChoice
2225
)
@@ -234,8 +237,9 @@ def _get_pipeline_steps(
234237

235238
steps.extend([
236239
("imputer", SimpleImputer(random_state=self.random_state)),
237-
("variance_threshold", VarianceThreshold(random_state=self.random_state)),
238-
("coalescer", CoalescerChoice(default_dataset_properties, random_state=self.random_state)),
240+
# ("variance_threshold", VarianceThreshold(random_state=self.random_state)),
241+
# ("coalescer", CoalescerChoice(default_dataset_properties, random_state=self.random_state)),
242+
("column_splitter", ColumnSplitter(random_state=self.random_state)),
239243
("encoder", EncoderChoice(default_dataset_properties, random_state=self.random_state)),
240244
("scaler", ScalerChoice(default_dataset_properties, random_state=self.random_state)),
241245
("feature_preprocessor", FeatureProprocessorChoice(default_dataset_properties,

0 commit comments

Comments
 (0)