Skip to content

Commit

Permalink
rename optuna to avoid library clashes
Browse files Browse the repository at this point in the history
  • Loading branch information
vinaysb committed May 15, 2024
1 parent 9e29676 commit c2a86c0
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Callable, cast

import optuna
from optuna import create_study, Trial
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.datasets import load_iris
Expand Down Expand Up @@ -50,8 +50,8 @@ def __call__(self, trial):
objective = OptunaObjective(X, y)

# Create a study object and optimize the hyperparameters for the chosen classifier
study = optuna.create_study(direction='maximize')
study.optimize(cast(Callable[[optuna.Trial], float], objective), n_trials=100)
study = create_study(direction='maximize')
study.optimize(cast(Callable[[Trial], float], objective), n_trials=100)

# Get the best hyperparameters and the best accuracy score
best_params = study.best_params
Expand Down

0 comments on commit c2a86c0

Please sign in to comment.