unhashable type: 'list' by plot parallel coordinate
See original GitHub issueI get this weird error that I don’t receive with optuna optimizations that are quite the same and can not explain how this error occurs.
This is how I implemented the optimization:
study = optuna.create_study(storage=optuna.storages.RDBStorage("sqlite:///" + database_name + ".db"),
study_name = database_name + "_study", direction="maximize", load_if_exists=True)
study.optimize(lambda trial: objective(trial, preprocessed_dataset, dataset_val, num_samples, database_name, *shift_numbers), n_trials)
# plots of optuna optimization
fig1 = optuna.visualization.matplotlib.plot_optimization_history(study)
fig2 = optuna.visualization.matplotlib.plot_parallel_coordinate(study)
fig3 = optuna.visualization.matplotlib.plot_contour(study)
fig4 = optuna.visualization.matplotlib.plot_slice(study)
fig5 = optuna.visualization.matplotlib.plot_param_importances(study)
fig6 = optuna.visualization.matplotlib.plot_edf(study)
plt.show()
Environment
- Optuna version: 2.10.0
- Python version: 3.8.10
- OS: Linux-5.4.0-81-generic-x86_64-with-glibc2.29
- (Optional) Other libraries and their versions:
Error messages, stack traces, or logs
This is the error I get:
Traceback (most recent call last):
File "CTGAN_noscale.py", line 286, in <module>
run_CTGAN(num_samples, n_trials, database_name, *shift_numbers)
File "CTGAN_noscale.py", line 243, in run_CTGAN
fig4 = optuna.visualization.matplotlib.plot_parallel_coordinate(study)
File "/usr/local/lib/python3.8/dist-packages/optuna/_experimental.py", line 68, in new_func
return func(*args, **kwargs) # type: ignore
File "/usr/local/lib/python3.8/dist-packages/optuna/visualization/matplotlib/_parallel_coordinate.py", line 90, in plot_parallel_coordinate
return _get_parallel_coordinate_plot(study, params, target, target_name)
File "/usr/local/lib/python3.8/dist-packages/optuna/visualization/matplotlib/_parallel_coordinate.py", line 159, in _get_parallel_coordinate_plot
values = [vocab[v] for v in values]
File "/usr/local/lib/python3.8/dist-packages/optuna/visualization/matplotlib/_parallel_coordinate.py", line 159, in <listcomp>
values = [vocab[v] for v in values]
TypeError: unhashable type: 'list'
Has anyone else already got this problem?
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Unhashable type: 'Point'" while trying to use GeoPandas
I am currently trying to plot a series of ...
Read more >Python: TypeError: unhashable type: 'list' - Net-Informations.Com
This error shows that the my_dict key [1,2,3] is List and List is not a hashable type in Python . Dictionary keys must...
Read more >getting "TypeError: unhashable type: 'list'" when merging
I'm merging 2 datasets in pandas but i get the error "TypeError: unhashable type: 'list'". The command im running is :
Read more >Python TypeError: unhashable type: 'list' Solution
The “TypeError: unhashable type: 'list'” error is raised when you try to assign a list as a key in a dictionary. To solve...
Read more >What's New - Xarray
Fix Dataset.assign_coords() resetting all dimension coordinates to default ... Fixed “unhashable type” error trying to read NetCDF file with variable having ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I suppose that sampling index might not be useful for visualisation that is the main concern in this issue. As a workaround, I suggest that
choices
is converted to str’s list:["16, 16", "32, 32", ...]
and transform sampled value to the tuple of int, eg.,(16, 16)
before passing to your GANs.Okay, thank you for your tips, they’ll be very useful for me in the future.