Skip to content

Visual Analysis Example throws an error #277

@ghsher

Description

@ghsher

https://github.com/quaquel/EMAworkbench/blob/b8748d9db912b80a25cd3f25b0f309187fb13dc5/docs/source/indepth_tutorial/open-exploration.ipynb

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions