smac.epm.utils¶
Functions
|
Check which points are placed inside a given subspace |
|
Initialize random number generator and set run_id. |
|
Return the types of the hyperparameters and the bounds of the hyperparameters and instance features. |
- smac.epm.utils.check_subspace_points(X, cont_dims=[], cat_dims=[], bounds_cont=None, bounds_cat=None, expand_bound=False)[source]¶
Check which points are placed inside a given subspace
- Parameters
X (Optional[np.ndarray(N,D)],) – points to be checked, where D = D_cont + D_cat
cont_dims (Union[np.ndarray(D_cont), List]) – which dimensions represent continuous hyperparameters
cat_dims (Union[np.ndarray(D_cat), List]) – which dimensions represent categorical hyperparameters
bounds_cont (optional[List[Tuple]]) – subspaces bounds of categorical hyperparameters, its length is the number of continuous hyperparameters
bounds_cat (Optional[List[Tuple]]) – subspaces bounds of continuous hyperparameters, its length is the number of categorical hyperparameters
expand_bound (bool) – if the bound needs to be expanded to contain more points rather than the points inside the subregion
- Returns
indices_in_ss – indices of data that included in subspaces
- Return type
np.ndarray(N)
- smac.epm.utils.get_rng(rng=None, run_id=None, logger=None)[source]¶
Initialize random number generator and set run_id.
If rng and run_id are None, initialize a new generator and sample a run_id
If rng is None and a run_id is given, use the run_id to initialize the rng
If rng is an int, a RandomState object is created from that.
If rng is RandomState, return it
If only run_id is None, a run_id is sampled from the random state.
- Parameters
rng (np.random.RandomState|int|None) –
run_id (int, optional) –
logger (logging.Logger, optional) –
- Return type
Tuple
[int
,RandomState
]- Returns
int
np.random.RandomState