Created
July 17, 2024 09:53
-
-
Save c-bata/6e6d829aa2062feda761a1d66fe308a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from datetime import datetime | |
import optuna | |
import cProfile | |
import time | |
from optuna.visualization._rank import _get_rank_info | |
def sphere(trial: optuna.Trial) -> float: | |
X = np.asarray([trial.suggest_float(f"x{i}", -5, 5) for i in range(10)]) | |
return np.sum(X ** 2) | |
study = optuna.create_study(sampler=optuna.samplers.RandomSampler(seed=1)) | |
study.optimize(sphere, n_trials=10000) | |
profiler = cProfile.Profile() | |
profiler.runcall(_get_rank_info, study, None, None, "Objective Value") | |
profiler.dump_stats("./get_rank_info.stats") |
Author
c-bata
commented
Jul 17, 2024
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment