Usage
Installation
To use Py-Hyperpy, first install it using pip:
(.venv) $ pip install py-hyperpy
Create Study
Fisrt of all, you need to import library:
(.venv) $ import hyperpy as hy
The library hyperpy function by study. This study represent several running
of an diferents neural networks, to find the best fit. To run a study, you could
call hy.run(feat_X, Y) function:
- class hyperpy.core.run(feat_X, Y, study_name: str = 'First try', direction: str = 'maximize', n_trials: int = 10)
run class is used to run the experiment.
- objective(trial)
objective function is used to define the objective function.
- Parameters
trial (optuna.trial.Trial) – trial object
- Returns
objective function
- Return type
float
- buildStudy()
buildStudy function is used to build the study.
- Returns
study
- Return type
optuna.study.Study
- hyperpy.core.run.buildStudy(self)
buildStudy function is used to build the study.
- Returns
study
- Return type
optuna.study.Study
The Feat_X parameter should be the feature to train the model. And Y
represents the target in dataset. However, hy.run()
at the moment just run clasification problems and run study with doble cross validation.
For example:
>>> import hyperpy as hy
>>> running=hy.run(feat_X, Y)
>>> study = running.buildStudy()
Then the study return the structure of the neural netowork and the accuracy.