question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changing a `suggest_uniform` call trigger an error in plot_param_importances when `params` argument given.

See original GitHub issue

If the database (I use the potgresql backend for storing trials) contains entries:

598|61|x|51.0|{"name": "IntUniformDistribution", "attributes": {"low": 20, "high": 100, "step": 1}}
608|62|x|63.0|{"name": "IntUniformDistribution", "attributes": {"low": 30, "high": 120, "step": 1}}

then using suggest_uniform(study, params=['x']) raise a ValueError: Parameters importances cannot be assessed with dynamic search spaces if parameters are specified. Specified parameters: ['x']..

I have to manually edit the entries in the database to low:20, high:120 to fix the issue. 😦

It would be nice if the plotting function could do this kumfu by itself 😃

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
hvycommented, Aug 2, 2021

I’m wondering if this previous discussion doesn’t address the topic here https://github.com/optuna/optuna/issues/1856#issuecomment-703935388. A PR was worked on but unfortunately got stale.

1reaction
nzw0301commented, Jul 29, 2021

Thank you for creating the issue! According to the error message, I suppose that the behaviour is intended, so let me change the label to feature from bug.

At least, it would be great to give a note to explain the dynamical range is not supported by plot_param_importances.


Let me put a minimal example to see the error message.

import optuna


def objective(trial):
    x = trial.suggest_int("x", 0, trial.number)
    y = trial.suggest_float("y", -1.0, 1.0)
    z = trial.suggest_float("z", 0.0, 1.5)
    return x ** 2 + y ** 3 - z ** 4


sampler = optuna.samplers.RandomSampler(seed=10)
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=10)

optuna.visualization.plot_param_importances(study, params=["x"])
Read more comments on GitHub >

github_iconTop Results From Across the Web

Raise custom Exception with arguments - Stack Overflow
In case 1, raise just calls StandardError.new('argh') , so these are the same. But what if you pass an exception instance and a...
Read more >
TypeError: params argument given to the optimizer should be ...
I'm trying to run the official RAdam implementation using a similar style to the excel sheet that Jeremy put together. I've been able...
Read more >
Params argument given to the optimizer should be an iterable
I tried to create a simple optimization example in Pytorch , but I get a weird error saying that weights are not iterable,...
Read more >
Solved: 'replace' expects its first parameter 'string' to
This failed with the error in the error. 'replace' expects its first parameter 'string' to be a string. The provided value is of...
Read more >
Error() constructor - JavaScript - MDN Web Docs
Both create a new Error instance. Parameters. message Optional. A human-readable description of the error.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found