Skip to content

Commit

Permalink
upgrade perming
Browse files Browse the repository at this point in the history
  • Loading branch information
linjing-lab committed Oct 25, 2023
1 parent 1aceef4 commit dfeb88f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
Binary file modified released_box/models/bitcoin.ckpt
Binary file not shown.
2 changes: 1 addition & 1 deletion released_box/perming/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
'Multi-outputs': Ranker
}

__version__ = '1.6.1'
__version__ = '1.7.0'
16 changes: 1 addition & 15 deletions released_box/perming/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def train_val(self,
assert patience >= 10 and patience <= 100, 'Value coordinate with tolerance should fit about num_epochs and batch_size.'
assert n_jobs == -1 or n_jobs > 0, 'Take full jobs with setting n_jobs=-1 or manually set nums of jobs.'
total_step: int = len(self.train_loader)
self._set_container(backend, n_jobs)
self.val_container = [*iter(self.val_loader)] # replace previous versions of _set_container
val_length: int = len(self.val_container)
self.stop_iter: bool = False # init state of train_val
for epoch in range(num_epochs):
Expand Down Expand Up @@ -357,20 +357,6 @@ def _pack_info(self, by: str, state: bool) -> Dict[str, Any]:
regress.update(loss_)
return regress

def _set_container(self, backend: str, n_jobs: int) -> None:
'''
Validation Container with `parallel_backend` at `n_jobs`.
:param backend: str, "threading", "multiprocessing, 'loky'.
:param n_jobs: int, set jobs with backend to accelerate process.
'''
with parallel_backend(backend, n_jobs=n_jobs):
val_iter, self.val_container = iter(self.val_loader), []
while 1:
try:
self.val_container.append(next(val_iter))
except StopIteration:
break

def train_test_val_split(features: TabularData, target: TabularData, ratio_set: Dict[str, int], random_seed: Optional[int]) -> Tuple[Dict[str, TabularData]]:
'''
Split TabularData into train, test, val with `ratio_set` and `random_seed`.
Expand Down

0 comments on commit dfeb88f

Please sign in to comment.