Skip to content
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

[Refactor] Made CrossValTypes, HoldoutValTypes to have split functions directly #108

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
[fix] Fix mypy issues
nabenabe0928 committed May 19, 2021
commit b7d35314a8a8af2973188021c39c8c70aac18a00
7 changes: 5 additions & 2 deletions autoPyTorch/datasets/base_dataset.py
Original file line number Diff line number Diff line change
@@ -108,7 +108,10 @@ def __init__(
self.train_tensors, self.val_tensors, self.test_tensors = train_tensors, val_tensors, test_tensors
self.random_state = np.random.RandomState(seed=seed)
self.resampling_strategy = resampling_strategy
self.resampling_strategy_args = resampling_strategy_args if resampling_strategy is not None else {}
self.resampling_strategy_args: Dict[str, Any] = {}
if resampling_strategy_args is not None:
self.resampling_strategy_args = resampling_strategy_args

self.shuffle = self.resampling_strategy_args.get('shuffle', False)
self.is_stratify = self.resampling_strategy_args.get('stratify', False)

@@ -242,7 +245,7 @@ def get_splits_from_resampling_strategy(self) -> List[Tuple[List[int], List[int]
elif isinstance(self.resampling_strategy, CrossValTypes):
num_splits = self.resampling_strategy_args['num_splits']

return self.create_cross_val_splits(
return self.resampling_strategy(
random_state=self.random_state,
num_splits=int(num_splits),
shuffle=self.shuffle,
4 changes: 2 additions & 2 deletions autoPyTorch/datasets/time_series_dataset.py
Original file line number Diff line number Diff line change
@@ -107,8 +107,8 @@ def _prepare_time_series_forecasting_tensor(tensor: TIME_SERIES_FORECASTING_INPU
population_size, time_series_length, num_features = tensor[0].shape
num_targets = len(target_variables)
num_datapoints = time_series_length - sequence_length - n_steps + 1
x_tensor = np.zeros((num_datapoints, population_size, sequence_length, num_features), dtype=np.float)
y_tensor = np.zeros((num_datapoints, population_size, num_targets), dtype=np.float)
x_tensor = np.zeros((num_datapoints, population_size, sequence_length, num_features), dtype=np.float64)
y_tensor = np.zeros((num_datapoints, population_size, num_targets), dtype=np.float64)

for p in range(population_size):
for i in range(num_datapoints):