stemflow.utils.validation
Validation module. Most of these functions are plain checking and easy to understand.
check_mem_string(mem_str)
Check if a string is a valid memory specification like '8GB', '512MB', '1.5GB', etc.
Source code in stemflow/utils/validation.py
check_random_state(seed)
Turn seed into a np.random.RandomState instance.
Parameters:
-
seed(Union[None, int, Generator]) –If seed is None, return a random generator. If seed is an int, return a random generator with that seed. If seed is already a random generator instance, return it. Otherwise raise ValueError.
Returns:
-
Generator–The random generator object based on
seedparameter.
Source code in stemflow/utils/validation.py
transform_y(X_train, y_train)
If y_train is not str, but also not a dataframe, transform it into a dataframe