Comments (2)
Thank you for your bug report! Your suggestion should work for a truncated Gaussian. I'll make a PR.
out = _norm_logpdf(x) - _log_gauss_mass(a, b) - np.log(scale)
In my understanding, this bug luckily does not affect the sampling results.
from optuna.
An easy way to reproduce the problem is by comparing the values to scipy.stats.truncnorm:
import numpy as np
from scipy.stats import truncnorm as scipy_truncnorm
from optuna.samplers._tpe import _truncnorm as optuna_truncnorm
print(f"scipy pdf(0, a=-10, b=10, scale=1): {np.exp(scipy_truncnorm.logpdf(0, a=-10, b=10, scale=1))}")
print(f"optuna pdf(0, a=-10, b=10, scale=1): {np.exp(optuna_truncnorm.logpdf(0, a=-10, b=10, scale=1))}")
print("---")
print(f"scipy pdf(0, a=-10, b=10, scale=2): {np.exp(scipy_truncnorm.logpdf(0, a=-10, b=10, scale=2))}")
print(f"optuna pdf(0, a=-10, b=10, scale=2): {np.exp(optuna_truncnorm.logpdf(0, a=-10, b=10, scale=2))}")
Output:
scipy pdf(0, a=-10, b=10, scale=1): 0.3989422804014327
optuna pdf(0, a=-10, b=10, scale=1): [0.39894228]
---
scipy pdf(0, a=-10, b=10, scale=2): 0.19947114020071632
optuna pdf(0, a=-10, b=10, scale=2): [0.39894228]
(According to the headers optuna's _truncnorm.py seems to originate from scipy. Maybe a bug that was fixed in an earlier version of scipy? I looked through the issues in scipy for truncnorm but could not find an issue which directly seems to relate to this problem.)
from optuna.
Related Issues (20)
- Support for duckdb HOT 3
- Implement Delta Lake as storage backend HOT 1
- GP Sampler throw `ValueError: Fewer non-zero entries in p than size` HOT 4
- optuna create-study --storage $STORAGE_URL raises RuntimeError: The runtime optuna version 3.6.0 is no longer compatible with the table schema (set up by optuna 3.6.0). Please try updating optuna to the latest version by `$ pip install -U optuna`. HOT 7
- Can't retrieve lightgbm model's best_iteration after Optuna optimization HOT 7
- Returning `float("inf")` failed with MOTPE HOT 1
- Support multi-objective CMA-ES (MOCMAES) sampling algorithm HOT 2
- Optuna Hyperband Algorithm Not Following Expected Model Training Scheme.
- Optuna Hyperband Algorithm Not Following Expected Model Training Scheme
- (sqlite3.DatabaseError) database disk image is malformed HOT 7
- Is there any plan for Maximal Update Parametrization support ? HOT 1
- Hyper-parameter optimization of YOLOv7 model
- Hyper-parameter optimization of YOLOv7 model
- Duration of iteration increases as the number of iterations increase, with distributed optimization. HOT 14
- Local Minima Skip HOT 8
- Enhance `plot_parallel_coordinate()` by eliminating redundant for-loops HOT 2
- Use CPU-only PyTorch wheels on GitHub Actions
- from optuna.integration.xgboost import XGBoostPruningCallback error ModuleNotFoundError: No module named 'optuna_integration' HOT 3
- Inconsistent Dynamic Parameter Handling in Optuna Ask-Tell Interface with Conditional Trials
- Suggesting same parameters in several trials with discrete parameter grid HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from optuna.