Skip to content

Commit

Permalink
update time constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
PanyiDong committed Nov 25, 2023
1 parent 6dc5249 commit 968a3bb
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 45 deletions.
10 changes: 9 additions & 1 deletion InsurAutoML/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Author: Panyi Dong (panyid2@illinois.edu)
-----
Last Modified: Monday, 5th June 2023 10:34:19 pm
Last Modified: Friday, 24th November 2023 12:37:26 am
Modified By: Panyi Dong (panyid2@illinois.edu)
-----
Expand Down Expand Up @@ -45,6 +45,14 @@ class TimeoutException(Exception):
pass


class TimeoutWarning(Warning):
def __init__(self, message):
self.message = message

def __str__(self):
return repr(self.message)


MAX_ERROR_TRIALOUT = 8

LOGGINGLEVEL = [logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG]
Expand Down
2 changes: 1 addition & 1 deletion InsurAutoML/hpo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Author: Panyi Dong (panyid2@illinois.edu)
-----
Last Modified: Thursday, 20th July 2023 5:45:39 pm
Last Modified: Friday, 24th November 2023 2:45:29 pm
Modified By: Panyi Dong (panyid2@illinois.edu)
-----
Expand Down
14 changes: 9 additions & 5 deletions InsurAutoML/hpo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Author: Panyi Dong (panyid2@illinois.edu)
-----
Last Modified: Wednesday, 22nd November 2023 3:34:53 pm
Last Modified: Friday, 24th November 2023 2:48:15 pm
Modified By: Panyi Dong (panyid2@illinois.edu)
-----
Expand Down Expand Up @@ -44,8 +44,8 @@
import os
import time
import scipy
import warnings
import logging
import func_timeout
from sklearn.exceptions import ConvergenceWarning
from sklearn.utils._testing import ignore_warnings
from sklearn.model_selection import KFold
Expand Down Expand Up @@ -553,9 +553,13 @@ def setup(

def step(self) -> Dict[str, Any]:
try:
with time_limit(self.timeout):
self.status_dict = self._objective()
except TimeoutError:
# Update: Nov. 24, 2023
# Signal/Multiprocessing timeout methods can be ignored by ctypes callback
# Use func_timeout instead
# self.status_dict = time_limit(self.timeout)(self._objective)()
self.status_dict = func_timeout.func_timeout(self.timeout, self._objective)
# except TimeoutError:
except func_timeout.FunctionTimedOut:
self._logger.warning(
"Objective not finished due to timeout after {} seconds.".format(
self.timeout
Expand Down
7 changes: 5 additions & 2 deletions InsurAutoML/model/lightgbm.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Author: Panyi Dong (panyid2@illinois.edu)
-----
Last Modified: Thursday, 1st June 2023 9:41:03 am
Last Modified: Friday, 24th November 2023 12:21:51 am
Modified By: Panyi Dong (panyid2@illinois.edu)
-----
Expand Down Expand Up @@ -207,7 +207,10 @@ def fit(
num_iterations=self.num_iterations,
)

self.model.fit(X, y)
try:
self.model.fit(X, y)
except Exception as e:
raise e

self._fitted = True

Expand Down
2 changes: 1 addition & 1 deletion InsurAutoML/utils/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Author: Panyi Dong (panyid2@illinois.edu)
-----
Last Modified: Wednesday, 22nd November 2023 3:34:32 pm
Last Modified: Friday, 24th November 2023 2:16:13 pm
Modified By: Panyi Dong (panyid2@illinois.edu)
-----
Expand Down
41 changes: 21 additions & 20 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
pyarrow
setuptools
pygam
ray[tune]
scikit-learn>=1.2.0
nevergrad
lightgbm
pandas
numpy<1.24.0
matplotlib
ray<2.0.0
flaml
tensorboardX
fastparquet
func-timeout
gensim
redis
optuna
cython
seaborn>=0.11.0
matplotlib
tqdm
lightgbm
colorama==0.4.4
bayesian_optimization==1.4.0
pyarrow
hyperopt
rpy2
cython
ray<2.0.0
mlflow
setuptools
ray[tune]
pygam
xgboost
threadpoolctl>2.2.0
hyperopt
bayesian_optimization==1.4.0
flaml
numpy<1.24.0
scikit-learn>=1.2.0
scipy
nevergrad
gensim
rpy2
redis
seaborn>=0.11.0
fastparquet
colorama==0.4.4
29 changes: 15 additions & 14 deletions requirements_nn.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
pyarrow
setuptools
ray[tune]
torch
scikit-learn>=1.2.0
pandas
numpy<1.24.0
matplotlib
ray<2.0.0
tensorboardX
cython
tqdm
threadpoolctl>2.2.0
scipy
fastparquet
func-timeout
gensim
rpy2
redis
seaborn>=0.11.0
fastparquet
matplotlib
tqdm
pyarrow
rpy2
cython
ray<2.0.0
setuptools
torch
ray[tune]
threadpoolctl>2.2.0
numpy<1.24.0
scikit-learn>=1.2.0
scipy
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Author: Panyi Dong (panyid2@illinois.edu)
-----
Last Modified: Wednesday, 22nd November 2023 11:20:07 pm
Last Modified: Friday, 24th November 2023 2:46:28 pm
Modified By: Panyi Dong (panyid2@illinois.edu)
-----
Expand Down Expand Up @@ -99,6 +99,7 @@ def cythonize(*args, **kwargs):
"scipy",
"pyarrow",
"fastparquet",
"func-timeout",
"matplotlib",
"seaborn>=0.11.0",
"ray<2.0.0",
Expand Down

0 comments on commit 968a3bb

Please sign in to comment.