seismometer icon indicating copy to clipboard operation
seismometer copied to clipboard

Several Functions Don't Work W/out a Target Event

Open rgleaton opened this issue 1 year ago • 1 comments

Several pieces of seismometer functionality depend on the target column(s). However, if a target event isn't defined in the usage config, these functions will crash. This is true even if a primary target is defined the usage config.

Problem Summary

According to the seismometer documentation you shouldn't need to define a target event (or any events) in the usage config file. However, the ConfigProvider class defines "targets" as a event group with a usage of "target": https://github.com/epic-open-source/seismometer/blob/083979985a3eef195da4386953cf123bc778b262/src/seismometer/configuration/config.py#L323-L329 If you don't define any target events this will return an empty dictionary {}.

Further downstream, the Seismogram class defines the target_cols using the configs targets property: https://github.com/epic-open-source/seismometer/blob/083979985a3eef195da4386953cf123bc778b262/src/seismometer/seismogram.py#L197-L200 This results in an empty list in this case.

This can cause crashes for all downstream functions that assume target_cols will be populated such as ExploreModelEvaluation: image

Impact

Crash

Possible Solution

Add fallbacks for when target event(s) aren't defined to use primary_target

Steps to Reproduce

  1. Have a dataset which has the target column in the 'base' dataframe (so not an event) and make sure it's defined as the primary_target in usage config.
  2. Run startup and try to use some of the exploration widgets such as ExploreModelEvaluation
  3. Crash

Suggested fix

Add fallbacks for when target event(s) aren't defined to use primary_target

rgleaton avatar Sep 12 '24 15:09 rgleaton

Minor update: this appears to only be unworkable when a predictions_frame is passed into run_startup. If that arg is left as none the loader will handle creating a "_Value" column for the primary target automatically after reading in the data files. In this case you can just define a fake target event in usage config with the same display name as primary target and things will run.

rgleaton avatar Sep 12 '24 18:09 rgleaton