-
Notifications
You must be signed in to change notification settings - Fork 94
Visual Analysis Example throws an error #277
Description
Running the example code for "Visual Analysis" provided in the extended tutorial for "Open Exploration" produces the following error:
File ".../python3.11/site-packages/ema_workbench/analysis/plotting_util.py", line 646, in make_continuous_grouping_specifiers
step = (maximum - minimum) / nr_of_groups
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for /: 'int' and 'NoneType'
Following the call-stack, it seems like if ever pairs_plotting.pairs_scatter is called with a group_by but not a grouping_specifiers, then grouping_specifiers defaults to None, and you will get the above TypeError. The error won't occur when the policy (or whatever column is provided) has dtype=category, but it seems that is not the dtype of policy. I might be wrong on this and there might be some cases where it works, but it doesn't seem like it to me.
INFO: I am running this code after loading saved results using load_results(). It could be that the real issue is that the dtype is lost in this process.
Suggestion: Add grouping_specifiers = range(policies) to the pairs_scatter call in the example for robustness.
EDIT: removed suggestion because I think that would cause errors when the dtype is correct. See discussion below; issue is in the dtype changing when save/load_results are used.