Questions tagged [optuna]

Optuna is Hyper-parameter Optimization Framework for Python (versions 2.7 and 3.*) that helps to find the best parameters for Machine Learning models via checking various combinations of parameters' values. Site: https://optuna.org

Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

Is there a way to specify the initial population in optuna's NSGA-II?

I created a neural network model that predicts certain properties from coordinates. Using that model, I want to find the coordinates that minimize the properties in optuna's NSGA-II sampler. Normally, ...
vis's user avatar
  • 1
0 votes
0 answers
16 views

How can I retry FAIL trials in Optuna in a second run?

I am doing grid search with Optuna but FAIL trials are not repeated in a second run. Instead, already COMPLETE trials are uselessly repeated. Here I describe the two problems separately: when a trial ...
Flavio's user avatar
  • 121
0 votes
0 answers
23 views

CUDA out of memory when using Optuna

Half month ago, I can use Optuna without a problem to do a 48-Hour study, with around 150+ trials. Yesterday I tried Optuna again on the same model, same dataset, same batch size and same device (A100 ...
Tianjian Qin's user avatar
1 vote
1 answer
43 views

Getting AttributeError when running optuna study

I am trying to run optimization using optuna: study = optuna.create_study(direction='minimize', sampler=optuna.samplers.GridSampler(search_space)) study.optimize(objective, n_trials=20) For which I ...
Karthik S's user avatar
  • 11.4k
1 vote
0 answers
25 views

Human-in-loop optimization Optuna in Google Colaboratory

I am working on a project where I need to run Human-in-loop optimization using Optuna library in Google Colaboratory environment. I would like to use the Optuna Dashboard to monitor the progress of ...
Xixao's user avatar
  • 13
0 votes
0 answers
21 views

Connection Time in Google Colab Pro+

I am making experiences with mlflow and dagshub, with a public time serie dataset, 3W(https://github.com/petrobras/3W). I must execute 100 trial with grid search to assess the best set of parameters, ...
Antonio Alberto Azevedo's user avatar
0 votes
0 answers
23 views

How to add cross validation to Optuna function to tune hyperparameters for LSTM?

I have code to tune hyperparameters in LSTM. How can I: add cross validation based on 5 folds on training dataset print avg AUC from each iteration from training dataset divided on 5 folds print AUC ...
dingaro's user avatar
  • 2,292
-1 votes
1 answer
63 views

Can't import Optuna

I am trying to import Optuna on Jupyter Notebook. I have previously installed pytorch-2.0.1. I have tried to downgrade pytorch as well as uninstalling and reinstalling Optuna as well as sqlalchemy. ...
disag's user avatar
  • 1
0 votes
1 answer
136 views

optuna: Different Results Even With Same random_state

I am trying to understand why running the below code for hypterparameter tuning using optuna gives me different best parameter values even if I am running the exact same code with the same ...
shsh's user avatar
  • 696
0 votes
1 answer
30 views

Greenlet installation fails with `OSError`

I try to install the optuna package into a TensorFlow tensorflow:2.11.1-gpu image. However, it failed with ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/...
emil's user avatar
  • 300
1 vote
1 answer
82 views

{ "n_estimators" } are not used during Optuna Study

While performing optima study, I tried to tune n_estimators for xgboost in a binary classification problem, but I get: WARNING: ../src/learner.cc:767: Parameters: { "n_estimators" } are not ...
jerrycalebj's user avatar
0 votes
0 answers
103 views

Cannot import Optuna after installing Pytorch

Optuna is clashing with some other module and can't import - I think pytorch is to blame. The error when importing optuna is: TypeError: dataclass_transform() got an unexpected keyword argument '...
Thoughtful_Jeffrie's user avatar
0 votes
0 answers
24 views

suggest_int or suggest_categorical for binary variables?

I'm trying to suggest a binary variable in my Optuna trial. I haven't found a direct trial.suggest_binary, but I guess I could use both trial.suggest_int('var', 0, 1) or trial.suggest_categorical('var'...
Aurelie Navir's user avatar
-1 votes
1 answer
40 views

Problems with MLP Regressor with small data and overfitting [closed]

I would like to utilize the best among various Design of Experiments (DOEs) for predicting my data. For this purpose, I have used an Optuna hyperparameter optimizer and programmed it as described in ...
Parabelritter5264's user avatar
0 votes
0 answers
46 views

How can I cross-validate pretrained BERT model using Pytorch and Optuna?

I am using a pre-trained BERT model to classify ASR-generated transcript segments and am currently using Optuna to identify the optimal hyperparameters. I wish to modify this code to use cross-...
csStudent2102's user avatar
0 votes
0 answers
68 views

Error while using optuna for hyper parameter optimization with huggingface trainer

Information The problem arises in chapter: Making Transformers Efficient in Production Describe the bug while training I am getting proper F1 score of 0.755940 image while finding best fit value of ...
Venkatesh R's user avatar
-1 votes
1 answer
37 views

Optuna Coding in Python

I'm trying to code optuna hyperparameter tunning as a method and then I will use it for different machine learning algorithms like decision tree, random forest, xgboost, logistic etc. However, code ...
Emin's user avatar
  • 11
0 votes
0 answers
27 views

Why Optuna can't reproduce my LGBM result in the for loop?

I have a simple training task that required me to rolling training my model, which means that I need to use previous 12 months data to predict the next month label, and I will rerun the model every ...
Leoix's user avatar
  • 1
0 votes
1 answer
112 views

Error in search space while performing optuna hyperparameter optimization

the code most likely containing the bug-> import optuna def objective(trial): criterion = trial.suggest_categorical("criterion", ["gini", "entropy"]), ...
YuvrajSingh's user avatar
0 votes
0 answers
64 views

When trying to reproduce optuna optimization results the precision score is different than optimization with XGBoost

After hyperparameter optimization yields best parameters when i try and reproduce the result there is a significant difference in results based on the same dataset and seed value: My optimization code ...
azuric's user avatar
  • 2,709
0 votes
0 answers
168 views

Discrepancy between Optuna's AUC ROC and scikit-learn's AUC ROC for binary classification problem

I'm working on a binary classification problem where I have ~30 features of enzyme substrates to predict EC1 and EC2. I'm using xgboost with optuna for hyperparameter tuning. However, I'm observing a ...
Tanmay Gejapati's user avatar
0 votes
0 answers
52 views

How OPTUNA optimize a list hyperparameter

I'm trying to optimize my hyperparameters with Optuna, but I can't figure out how to tell Optuna thath the ENCODER NEURONS must be a list where length is not fixed (it's also an hyperparameter) and ...
Miorri's user avatar
  • 1
0 votes
0 answers
82 views

Save the model with the best optuna trial

I have trained a model using optuna (PyTorch) where number of trials was 5. This is what my output looks like : Now, the 4th trial is the best trial. I dont just want the best parameter values, I ...
Nitya Rakhe's user avatar
0 votes
1 answer
170 views

Optuna - Epoch vs Trial

I am trying to train a model using optuna for hyperparameter optimization. Now in my train function, I am passing all all the train images in the dataset to that model in batches of 4. Say I have 20 ...
Nitya Rakhe's user avatar
0 votes
1 answer
176 views

ValueError when tuning LGBM Regressor with Optuna based on MAE and RMSE

I am trying to tune the LGBM regressor based on RMSE and MAE. From what I understand this should be done by returning the metrics from the objective function for the optuna study. I read this and this ...
hbxbgrw7913's user avatar
0 votes
1 answer
148 views

Optuna 3.2 + Optuna Dashboard 0.10.3 - study page going blank (content dissappears)

I had an issue with Optuna 3.2 + Optuna Dashboard 0.10.3 (using Firefox as my browser - the issue would probably be the same in other browsers). While I opened the study page, something appeared ...
eXPRESS's user avatar
  • 435
0 votes
0 answers
154 views

Memory leak for Optuna trial with multiprocessing

The Background I have a machine learning pipeline that consists of N boosted models (LGBMRegressor), each with identical hyperparameters. Each of the N LGBMRegressors is trained on a separate chunk ...
Ottpocket's user avatar
  • 109
0 votes
0 answers
164 views

Pruning trials in Optuna using both threshold and PatientMedianPruner

I am using MedianPruner (with patience) in Optuna. Sometimes a trial begins to diverge, and I want to stop it before it continues. I would use ThresholdPruner, but I can't as I am already using ...
user3128's user avatar
  • 1,930
0 votes
0 answers
27 views

How do I speed up an R module in python?

I'm using optuna for hyperparameter-tuning and the detrended cross-correlation coefficient (rhodccc) as metric that should be optimized. Its an R module that I imported to Python using rpy2. As I've ...
Good Question's user avatar
0 votes
0 answers
218 views

Using Optuna XGBoostPruningCallback with mglogloss function

I'm trying to use Optuna for a XGBoostClassifier from an example from this article and i simplyfied it cause it got's lots of steps I don't care about, but I keep on receiving a KeyError: '...
juanmac's user avatar
  • 139
0 votes
0 answers
51 views

ConvNeXT hyperparameter tuning error (Optuna)

I am running a model to classify a binary image dataset. Where ResNet50v2 or InceptionV3 works fine but with ConVnextTiny I run into some issues. It runs the first trail with Optuna but after that I ...
Hugo's user avatar
  • 1
0 votes
0 answers
28 views

Problem with negative dimensions in CNN hyperparameter optimization

When optimizing CNN hyperparameters in Optuna, they are sometimes set so that an error occurs when building the resulting model: ValueError: Exception encountered when calling layer "...
Xixao's user avatar
  • 13
0 votes
0 answers
891 views

Optuna: ValueError: No trials are completed yet. Trial 0 failed with value None

I want to optimize with optuna the hyperparameters for my convolutional autoencoder but i keep getting this error that no trials are completed. Any ideas? [W 2023-04-22 17:57:07,202] Trial 0 failed ...
Leoni's user avatar
  • 1
0 votes
1 answer
408 views

Launching optuna-dashboard in Google Colaboratory

Is there a way to start optuna-dashboard in Google Colaboratory? When running !optuna-dashboard --port 1234 sqlite:////content/drive/MyDrive/optimization.db the link is invalid
Xixao's user avatar
  • 13
0 votes
1 answer
397 views

Custom metric for a CatBoost classifier using GPU & optuna

I have the following objective function to run in an Optuna hyper parameter optimization: def objective(trial, data=data): num_train_pool = data["num_train_pool"] num_test_pool = ...
Luis Miguel's user avatar
  • 5,077
0 votes
1 answer
285 views

How can I solve the error regarding the storages in Optuna?

I am using optuna library for hyperparameter optimization. I am trying to create a study and a storage but i am getting the following error Traceback (most recent call last): File "/home/...
Rishidhar Kasam's user avatar
0 votes
1 answer
279 views

Can optuna trials be purged / deleted? (dealing with regime changes over time)

Context: The ML problem I'm modelling changes over time with different regimes - such that the model weights and best model hyper params change over time. Issue: For a given optuna.study, when I call ...
Mark's user avatar
  • 49
0 votes
0 answers
202 views

Optuna set trial params from dict where key is param_name and value is optuna.distibution of param

I am using optuna for function optimization. I have params_dict, specifying names of all parameters that could be tuned, as well as their optuna.distribution objects, as example: params_dict = { &...
GooseIt's user avatar
  • 69
0 votes
1 answer
337 views

Optuna & Wandb - how to enable logging of each trial separately?

Within my optuna study, I want that each trial is separately logged by wandb. Currently, the study is run and the end result is tracked in my wandb dashboard. Instead of showing each trial run ...
resei09's user avatar
  • 23
0 votes
0 answers
107 views

Optuna Pruning with MultiOutputClassifier

I am trying to do early round stopping pruning with a MultiOutputClassifier model, however there's an error ValueError: y should be a 1d array, got an array of shape (5342, 2) instead. def ...
Cheang Wai Bin's user avatar
0 votes
0 answers
65 views

Optuna save pruned trials

I am using OPTUNA to optimize a neural network and I am plotting the optimization history at the end using: plot_slice plot_optimization_history plot_contour plot_parallel_coordinate ...
Robert's user avatar
  • 1
2 votes
0 answers
220 views

Optuna sample fixed parameter depending on another parameter

In my setting I have an abstract situation like this the following, just note this is not about power calculation but a simple example to explain my point. base = trial.suggest_int(1, 3) power = trial....
Daraan's user avatar
  • 1,831
0 votes
0 answers
117 views

Ray-Tune with Optuna and tune.sample_from

I'm trying to run OptunaSearch with a config that looks like this config = {"algorithm": tune.choice(list(search_space.keys())), "params": tune.sample_from(lambda spec: ...
Rodrigo A's user avatar
  • 677
0 votes
0 answers
29 views

Does Optuna makes use of Catboost Logging information?

I am training a Catboost model while keeping the logging information as silent, which means that it won't save any information regarding model metric. I want to make sure that does Optuna uses this ...
Lopez's user avatar
  • 461
1 vote
1 answer
156 views

Reset pruned trials in Optuna study?

If I have a study where all the pruned trials needs to be reset for some reason, is there a way to do this? Maybe something that might work: Creating a copy of the current study where pruned trials ...
gameveloster's user avatar
  • 1,021
1 vote
1 answer
392 views

How to record each fold`s validation loss during cross-validation in Optuna?

I am using Toshihiko Yanase`s code for doing cross validation on my hyperparameter optimizer with Optuna. Here is the code that I am using: def objective(trial, train_loader, valid_loader): # ...
Gabi Gubu's user avatar
0 votes
1 answer
341 views

Optuna Light GBM classifier : All estimators failed to fit

I am currently working on the "Bank Scoring Case" Kaggle competition (https://www.kaggle.com/competitions/bank-scoring-case). And I try to hoptimize the hyperparameter of my Light GBM ...
Jacqueline Alexandre's user avatar
0 votes
1 answer
148 views

Key 'optuna_config' not in 'OptunaSweeperConf' full_key: hydra.sweeper.optuna_config object_type=OptunaSweeperConf

I tried this tutorial but gives me this error Key 'optuna_config' not in 'OptunaSweeperConf' full_key: hydra.sweeper.optuna_config object_type=OptunaSweeperConf why is this error? this is my config....
Jorge Armando Navarro Flores's user avatar
5 votes
1 answer
1k views

Resume Optuna study from most recent checkpoints

Is there a way to be able to pause/kill the optuna study, then resume it either by running the incomplete trials from the beginning, or resuming the incomplete trials from the latest checkpoint? study ...
gameveloster's user avatar
  • 1,021
0 votes
1 answer
192 views

Optuna HyperbandPruner not pruning?

My study is setup to use the Hyperband pruner with 60 trials, 10M max resource and reduction factor of 2. def optimize_agent(trial): # ... model = PPO("MlpPolicy", env, **params) ...
gameveloster's user avatar
  • 1,021