Skip to content

Commit

Permalink
fixed MR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sayanchk committed Jan 31, 2024
1 parent 3063b57 commit 75af498
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions luminaire/optimization/hyperparameter_optimization.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from hyperopt import fmin, tpe, hp, STATUS_OK
from luminaire.model import LADStructuralModel, LADStructuralHyperParams, LADFilteringModel, LADFilteringHyperParams
from luminaire.exploration.data_exploration import DataExploration
from luminaire.utils.random_state_validation import check_random_state
import warnings
warnings.filterwarnings('ignore')

from ..utils import check_random_state

class HyperparameterOptimization(object):
"""
Hyperparameter optimization for LAD outlier detection configuration for batch data.
Expand All @@ -21,6 +20,7 @@ class HyperparameterOptimization(object):
:param int min_ts_length: The minimum required length of the time series for training. The input time series will be
truncated if the length is greater than this value.
:param int scoring_length: Number of innovations to be scored after training window with respect to the frequency.
:param int random_state: Turn seed into a np.random.RandomState instance
.. _Pandas offset: https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#dateoffset-objects
"""
Expand Down
2 changes: 1 addition & 1 deletion luminaire/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .validation import check_random_state
from .random_state_validation import check_random_state
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

def check_random_state(seed):
"""Turn seed into a np.random.RandomState instance
Parameters
----------
seed : None, int or instance of RandomState
If seed is None, return the RandomState singleton used by np.random.
If seed is an int, return a new RandomState instance seeded with seed.
If seed is already a RandomState instance, return it.
Otherwise raise ValueError.
:param int seed: seed for the random state
:return: None, int or instance of RandomState
If seed is None, return the RandomState singleton used by np.random.
If seed is an int, return a new RandomState instance seeded with seed.
If seed is already a RandomState instance, return it.
Otherwise raise ValueError.
:rtype: np.random.RandomState or None
"""
if seed is None or seed is np.random:
return np.random.mtrand._rand
Expand Down

0 comments on commit 75af498

Please sign in to comment.