Optuna

Last updated
Optuna
Developer(s) Preferred Networks
Initial releaseVersion 1.0 (January, 2020)
Stable release
Version 4.4.0 (June 16, 2025)
Repository github.com/optuna/optuna
Written in Python
Available inEnglish
License MIT License
Website optuna.org

Optuna is an open-source Python library for automatic hyperparameter tuning of machine learning models. [1] It was first introduced in 2018 by Preferred Networks, a Japanese startup that works on practical applications of deep learning in various fields. [2] [3] [4] [5] The beta version of Optuna was released at the end of the year, with the subsequent first major stable release announced in January 2020. [1]

Contents

Hyperparameter optimization

Hyperparameter Optimization using Grid Search Hyperparameter Optimization using Grid Search.svg
Hyperparameter Optimization using Grid Search

Hyperparameter optimization involves finding the optimal value of non-trainable parameters, defined by the user. Examples of hyperparameters are learning rate, number of layers or neurons, regularization strength and tree depth. However, they strongly depend on the specific algorithm (e.g., classification, regression, clustering, etc.). [6]

Hyperparameter optimization can be especially relevant when dealing with large-scale problems or limited resources, as it improves model accuracy, reduces overfitting, and decreases training time. [1] However, when the hyperparameter space increases, it may become computationally expensive. Hence, there are methods (e.g., grid search, random search, or bayesian optimization) that considerably simplify this process. [1]

Features

Optuna is designed to optimize the model hyperparameters, by searching large spaces and discarding combinations that show no significant improvements in the model. Moreover, it can parallelize the hyperparameter search over multiple threads or processes. Optuna works with a high degree of modularity, allowing the definition of different configurations for searching hyperparameters. It is possible to choose which hyperparameters to optimize and how to optimize them. Additionally, it permits parameter customization at runtime, meaning that the values to explore for the hyperparameters (i.e., the search space) can be defined while writing the code, rather than being defined in advance. [1]

Hyperparameter Optimization using Tree-Structured Parzen Estimators Hyperparameter Optimization using Tree-Structured Parzen Estimators.svg
Hyperparameter Optimization using Tree-Structured Parzen Estimators

Sampling

Optuna exploits well-established algorithms to perform hyperparameter optimization, progressively reducing the search space, in light of objective values. Examples are gaussian-process-based algorithms (i.e., a gaussian process to model the objective function [7] ), tree-structured parzen estimator (TPE) (i.e., a model-based optimization method that estimates the objective function and selects the best hyperparameters [8] ), and random search (i.e., a basic optimization approach used for benchmarking [9] ).

Early stopping

Bayesian optimization of a function (black) with a gaussian process (purple). Three acquisition functions (blue). GpParBayesAnimationSmall.gif
Bayesian optimization of a function (black) with a gaussian process (purple). Three acquisition functions (blue).

Optuna includes a pruning feature to stop trials early, when the results show no significant improvement in the model. This allows for the prevention of unnecessary computation, and it is used for models with long training times, in order to save time and computational resources. Specifically, Optuna exploits techniques such as median and threshold pruning. [10] [11]

Scalability

Optuna is designed to scale with distributed computing resources, supporting parallel execution. This feature allows users to run optimization trials across multiple processors or machines. [12]

Integration with third-part libraries

Optuna integrates with various ML libraries and frameworks: [1]

Moreover, Optuna offers a real-time dashboard that allows to monitor, through graphs and tables, the optimization history and the hyperparameter importance. [13]

Applications

Optuna was designed to be framework agnostic, so that it can be used with any machine-learning (ML) or deep-learning (DL) framework. [1]

Standard pipeline for the optimization of hyperparameters for the training of a Decision Tree Classfier using Optuna Standard pipeline for the optimization of hyperparameters for the training of a Decision Tree Classfier using Optuna.png
Standard pipeline for the optimization of hyperparameters for the training of a Decision Tree Classfier using Optuna

Machine learning

Optuna can be used to optimize hyperparamenters of ML models. Examples are:

Deep learning

In the context of deep learning, Optuna can be exploited during the training of neural networks (NN), to optimize learning rate, batch size, and the number of hidden layers. For example, it can be used for:

Domains

Optuna has found applications in various research studies and industry implementations across different applicative domains. [2] [3] [4] [5]

Healthcare

In healthcare, Optuna is currently exploited for medical image analysis to optimize DL models for tumor detection, [23] [24] disease identification, [25] multi-organ semantic segmentation, [26] and radiological image analysis. It can be also exploited for disease prediction, in particular for the improvement in the accuracy of predictive models for disease diagnosis and treatment outcomes. [27] Its application can be also found in genomics, to predict genetic diseases and to identify genetic variations. [28]

Finance

In finance, Optuna is used to optimize models for algorithmic trading. It allows for predicting market movements, given the ability in handling wide parameter ranges and complex model structures. [29] [30] In particular, it is exploited for financial risk analysis and forecasting. Topics addressed are credit, market, and operational risks. [30]

Autonomous systems

Optuna is used for real-time applications in autonomous systems for robotics, [5] supporting decision making in dynamic environments. It is also exploited in the context of self-driving cars, to optimize the model to navigate safely in complex environments. For example, Optuna can be used in scenarios where there is the need to evaluate the rate and the severity of accidents [31] or to address the issue of network intrusion attacks due to possible vulnerabilities that might occur. [32] [33]

Natural language processing (NLP)

Optuna has also been applied in NLP, for example, for text classification to classify a piece of written text into categories (e.g., spam vs. not spam, topic modeling). [34] Another task is sentiment analysis, namely the detection of feelings expressed in text, particularly exploited for the analysis of content from social media and customer reviews. [35]

Reinforcement learning (RL)

For what concerns RL, Optuna is exploited in the gaming field, to improve the model performance in games and virtual environments, in robotics to optimize decision-making processes in robotic systems for tasks like manipulation and navigation, and in the field of autonomous vehicles, to optimize RL models to obtain enhanced safety, and a more efficient navigation strategy. [36]

See also

References

  1. 1 2 3 4 5 6 7 Akiba, Takuya; Sano, Shotaro; Yanase, Toshihiko; Ohta, Takeru; Koyama, Masanori (2019-07-25). "Optuna: A Next-generation Hyperparameter Optimization Framework". Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. KDD '19. New York, NY, USA: Association for Computing Machinery. pp. 2623–2631. doi:10.1145/3292500.3330701. ISBN   978-1-4503-6201-6.
  2. 1 2 Wang, Zhaofei; Li, Hao; Wang, Qiuping (2025). "An Approach to Truck Driving Risk Identification: A Machine Learning Method Based on Optuna Optimization". IEEE Access. 13: 42723–42732. Bibcode:2025IEEEA..1342723W. doi:10.1109/ACCESS.2025.3547445. ISSN   2169-3536.
  3. 1 2 Li, Yifan; Cao, Yanpeng; Yang, Jintang; Wu, Mingyu; Yang, Aimin; Li, Jie (2024-06-01). "Optuna-DFNN: An Optuna framework driven deep fuzzy neural network for predicting sintering performance in big data". Alexandria Engineering Journal. 97: 100–113. doi:10.1016/j.aej.2024.04.026. ISSN   1110-0168.
  4. 1 2 Pinichka, Chayut; Chotpantarat, Srilert; Cho, Kyung Hwa; Siriwong, Wattasit (2025-07-01). "Comparative analysis of SWAT and SWAT coupled with XGBoost model using Optuna hyperparameter optimization for nutrient simulation: A case study in the Upper Nan River basin, Thailand". Journal of Environmental Management. 388 126053. Bibcode:2025JEnvM.38826053P. doi:10.1016/j.jenvman.2025.126053. ISSN   0301-4797. PMID   40460531.
  5. 1 2 3 Huang, Jiancong; Rojas, Juan; Zimmer, Matthieu; Wu, Hongmin; Guan, Yisheng; Weng, Paul (2021-03-08). "Hyperparameter Auto-Tuning in Self-Supervised Robotic Learning". IEEE Robotics and Automation Letters. 6 (2): 3537–3544. arXiv: 2010.08252 . Bibcode:2021IRAL....6.3537H. doi:10.1109/LRA.2021.3064509. ISSN   2377-3766.
  6. Yang, Li; Shami, Abdallah (2020-11-20). "On hyperparameter optimization of machine learning algorithms: Theory and practice". Neurocomputing. 415: 295–316. arXiv: 2007.15745 . doi:10.1016/j.neucom.2020.07.061. ISSN   0925-2312.
  7. Tanim, Ahad Hasan; Smith-Lewis, Corinne; Downey, Austin R. J.; Imran, Jasim; Goharian, Erfan (2024-08-01). "Bayes_Opt-SWMM: A Gaussian process-based Bayesian optimization tool for real-time flood modeling with SWMM". Environmental Modelling & Software. 179 106122. Bibcode:2024EnvMS.17906122T. doi:10.1016/j.envsoft.2024.106122. ISSN   1364-8152.
  8. Ozaki, Yoshihiko; Tanigaki, Yuki; Watanabe, Shuhei; Nomura, Masahiro; Onishi, Masaki (2022-04-08). "Multiobjective Tree-Structured Parzen Estimator". Journal of Artificial Intelligence Research. 73: 1209–1250. doi:10.1613/jair.1.13188. ISSN   1076-9757.
  9. Bergstra, James; Bengio, Yoshua (2012-02-01). "Random search for hyper-parameter optimization". J. Mach. Learn. Res. 13: 281–305. ISSN   1532-4435.
  10. Wistuba, Martin; Schilling, Nicolas; Schmidt-Thieme, Lars (2015). "Hyperparameter Search Space Pruning – A New Component for Sequential Model-Based Hyperparameter Optimization". In Appice, Annalisa; Rodrigues, Pedro Pereira; Santos Costa, Vítor; Gama, João; Jorge, Alípio; Soares, Carlos (eds.). Machine Learning and Knowledge Discovery in Databases. Lecture Notes in Computer Science. Vol. 9285. Cham: Springer International Publishing. pp. 104–119. doi:10.1007/978-3-319-23525-7_7. ISBN   978-3-319-23525-7.
  11. Akiba, Takuya; Sano, Shotaro; Yanase, Toshihiko; Ohta, Takeru; Koyama, Masanori (2019-07-25). "Optuna: A Next-generation Hyperparameter Optimization Framework". Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. KDD '19. New York, NY, USA: Association for Computing Machinery. pp. 2623–2631. doi:10.1145/3292500.3330701. ISBN   978-1-4503-6201-6.
  12. Parra-Ullauri, Juan; Zhang, Xunzheng; Bravalheri, Anderson; Nejabati, Reza; Simeonidou, Dimitra (2023-06-07). "Federated Hyperparameter Optimisation with Flower and Optuna". Proceedings of the 38th ACM/SIGAPP Symposium on Applied Computing. SAC '23. New York, NY, USA: Association for Computing Machinery. pp. 1209–1216. doi:10.1145/3555776.3577847. ISBN   978-1-4503-9517-5.
  13. Almarzooq, Hussain; Waheed, Umair bin (2024-05-21). "Automating hyperparameter optimization in geophysics with Optuna: A comparative study". Geophysical Prospecting. 72 (5): 1778–1788. Bibcode:2024GeopP..72.1778A. doi:10.1111/1365-2478.13484. ISSN   1365-2478.
  14. Rokach, Lior; Maimon, Oded (2005), Maimon, Oded; Rokach, Lior (eds.), "Decision Trees", Data Mining and Knowledge Discovery Handbook, Boston, MA: Springer US, pp. 165–192, doi:10.1007/0-387-25465-x_9, ISBN   978-0-387-25465-4 , retrieved 2025-07-08
  15. R, Shyam; Ayachit, Sai Sanjay; Patil, Vinayak; Singh, Anubhav (2020-12-18). "Competitive Analysis of the Top Gradient Boosting Machine Learning Algorithms". 2020 2nd International Conference on Advances in Computing, Communication Control and Networking (ICACCCN). pp. 191–196. doi:10.1109/ICACCCN51052.2020.9362840. ISBN   978-1-7281-8337-4.
  16. Pisner, Derek A.; Schnyer, David M. (2020-01-01), Mechelli, Andrea; Vieira, Sandra (eds.), "Chapter 6 - Support vector machine", Machine Learning, Academic Press, pp. 101–121, ISBN   978-0-12-815739-8 , retrieved 2025-07-08
  17. Zhang, Zhongheng (2016-06-14). "Introduction to machine learning: k-nearest neighbors". Annals of Translational Medicine. 4 (11): 218. doi: 10.21037/atm.2016.03.37 . ISSN   2305-5839. PMC   4916348 . PMID   27386492.
  18. Tripepi, G.; Jager, K. J.; Dekker, F. W.; Zoccali, C. (2008-04-01). "Linear and logistic regression analysis". Kidney International. 73 (7): 806–810. doi:10.1038/sj.ki.5002787. ISSN   0085-2538. PMID   18200004.
  19. Yang, Feng-Jen (2018-12-12). "An Implementation of Naive Bayes Classifier". 2018 International Conference on Computational Science and Computational Intelligence (CSCI). pp. 301–306. doi:10.1109/CSCI46756.2018.00065. ISBN   978-1-7281-1360-9.
  20. Li, Zewen; Liu, Fan; Yang, Wenjie; Peng, Shouheng; Zhou, Jun (2021-06-10). "A Survey of Convolutional Neural Networks: Analysis, Applications, and Prospects". IEEE Transactions on Neural Networks and Learning Systems. 33 (12): 6999–7019. doi:10.1109/TNNLS.2021.3084827. hdl:10072/405164. ISSN   2162-2388. PMID   34111009.
  21. Caterini, Anthony L.; Chang, Dong Eui (2018-03-23), Caterini, Anthony L.; Chang, Dong Eui (eds.), "Recurrent Neural Networks", Deep Neural Networks in a Mathematical Framework, Cham: Springer International Publishing, pp. 59–79, doi:10.1007/978-3-319-75304-1_5, ISBN   978-3-319-75304-1 , retrieved 2025-07-08
  22. Gillioz, Anthony; Casas, Jacky; Mugellini, Elena; Khaled, Omar Abou (2020-09-06). "Overview of the Transformer-based Models for NLP Tasks". 2020 15th Conference on Computer Science and Information Systems (FedCSIS). Proceedings of the 2020 Federated Conference on Computer Science and Information Systems. 21: 179–183. doi:10.15439/2020F20. ISBN   978-83-955416-7-4.
  23. Bhuvanya, R.; T.Kujani; Kumaran, S.Manoj; Lokesh Kumar, N. (2024-11-22). "OptNet: Innovative Model for Early Lung Cancer Diagnosis integrating TabNet and Optuna". 2024 International Conference on Electronic Systems and Intelligent Computing (ICESIC). pp. 174–179. doi:10.1109/ICESIC61777.2024.10846378. ISBN   979-8-3315-2298-8.
  24. Kumar Sahu, Prabhat; Fatma, Taiyaba (2025-02-07). "Optimized Breast Cancer Classification Using PCA-LASSO Feature Selection and Ensemble Learning Strategies With Optuna Optimization". IEEE Access. 13: 35645–35661. Bibcode:2025IEEEA..1335645K. doi:10.1109/ACCESS.2025.3539746. ISSN   2169-3536.
  25. Deepan, P.; Prabhakar Reddy, G.; Arsha Reddy, M.; Vidya, R.; Dhiravidaselvi, S. (2024), Bhattacharya, Pronaya; Liu, Haipeng; Dutta, Pushan Kumar; Rodrigues, Joel J. P. C. (eds.), "Maximizing Accuracy in Alzheimer's Disease Prediction: A Optuna Hyper Parameter Optimization Strategy Using MRI Images", Revolutionizing Healthcare 5.0: The Power of Generative AI: Advancements in Patient Care Through Generative AI Algorithms, Cham: Springer Nature Switzerland, pp. 77–91, doi:10.1007/978-3-031-75771-6_5, ISBN   978-3-031-75771-6 , retrieved 2025-07-08
  26. Vaiyapuri, Thavavel (2025-08-01). "An Optuna-Based Metaheuristic Optimization Framework for Biomedical Image Analysis". Engineering, Technology & Applied Science Research. 15 (4): 24382–24389. doi:10.48084/etasr.11234 (inactive 10 July 2025). ISSN   1792-8036.{{cite journal}}: CS1 maint: DOI inactive as of July 2025 (link)
  27. Srinivas, Polipireddy; Katarya, Rahul (2022-03-01). "hyOPTXg: OPTUNA hyper-parameter optimization framework for predicting cardiovascular disease using XGBoost". Biomedical Signal Processing and Control. 73 103456. doi:10.1016/j.bspc.2021.103456. ISSN   1746-8094.
  28. Shen, Zijie; Shen, Enhui; Zhu, Qian-Hao; Fan, Longjiang; Zou, Quan; Ye, Chu-Yu (2023). "GSCtool: A Novel Descriptor that Characterizes the Genome for Applying Machine Learning in Genomics". Advanced Intelligent Systems. 5 (12): 2300426. doi:10.1002/aisy.202300426. ISSN   2640-4567.
  29. Shui, Hongyi; Sha, Xinye; Chen, Baizheng; Wu, Jiajie (2024-08-26). "Stock weighted average price prediction based on feature engineering and Lightgbm model". Proceedings of the 2024 International Conference on Digital Society and Artificial Intelligence. DSAI '24. New York, NY, USA: Association for Computing Machinery. pp. 336–340. doi:10.1145/3677892.3677945. ISBN   979-8-4007-0983-8.
  30. 1 2 Garg, Deepak; Shelke, Nitin Arvind; Kitukale, Gauri; Mehlawat, Nishka (2024-04-05). "Leveraging Financial Data and Risk Management in Banking sector using Machine Learning". 2024 IEEE 9th International Conference for Convergence in Technology (I2CT). pp. 1–6. doi:10.1109/I2CT61223.2024.10544336. ISBN   979-8-3503-9445-0.
  31. Rezashoar, Soheil; Kashi, Ehsan; Saeidi, Soheila (2024-07-26). "A hybrid algorithm based on machine learning (LightGBM-Optuna) for road accident severity classification (case study: United States from 2016 to 2020)". Innovative Infrastructure Solutions. 9 (8): 319. Bibcode:2024InnIS...9..319R. doi:10.1007/s41062-024-01626-y. ISSN   2364-4184.
  32. Jha, Jayesh; Yadav, Jatin; Naqvi, Haider (2025). "MILCCDE: A Metaheuristic Improved Decision-Based Ensemble Framework for Intrusion Detection in Autonomous Vehicles". In Bansal, Jagdish Chand; Jamwal, Prashant K.; Hussain, Shahid (eds.). Sustainable Computing and Intelligent Systems. Lecture Notes in Networks and Systems. Vol. 1295. Singapore: Springer Nature. pp. 255–267. doi:10.1007/978-981-96-3311-1_21. ISBN   978-981-96-3311-1.
  33. Parekh, Nishank; Sen, Arzob; Rajasekaran, P.; Jayaseeli, J. D. Dorathi; Robert, P. (2024-12-17). "Network Intrusion Detection System Using Optuna". 2024 International Conference on IoT Based Control Networks and Intelligent Systems (ICICNIS). pp. 312–318. doi:10.1109/ICICNIS64247.2024.10823298. ISBN   979-8-3315-1809-7.
  34. Rahmi, Nadya Alinda; Defit, Sarjon; Okfalisa (2024-12-31). "The Use of Hyperparameter Tuning in Model Classification: A Scientific Work Area Identification". International Journal on Informatics Visualization. 8 (4): 2181. doi:10.62527/joiv.8.4.3092. ISSN   2549-9904.
  35. Efendi, Akmar; Fitri, Iskandar; Nurcahyo, Gunadi Widi (2024-08-07). "Improvement of Machine Learning Algorithms with Hyperparameter Tuning on Various Datasets". 2024 International Conference on Future Technologies for Smart Society (ICFTSS). pp. 75–79. doi:10.1109/ICFTSS61109.2024.10691354. ISBN   979-8-3503-7384-4.
  36. Kiran, B Ravi; Sobh, Ibrahim; Talpaert, Victor; Mannion, Patrick; Sallab, Ahmad A. Al; Yogamani, Senthil; Pérez, Patrick (2021-02-09). "Deep Reinforcement Learning for Autonomous Driving: A Survey". IEEE Transactions on Intelligent Transportation Systems. 23 (6): 4909–4926. arXiv: 2002.00444 . doi:10.1109/TITS.2021.3054625. ISSN   1558-0016.

Further reading