Visualization
The fourth (and last) step in the EDS-TeVa usage workflow is setting the thresholds associated with the coefficients and the metrics of the Model fitted on the Probes.
Definition
The EDS-TeVa library provides dashboards and plots to visualize the temporal evolution of Probes along with fitted Models. Visualization functionalities can be used to explore the database and set thresholds relative to selection criteria.
Dashboard
A Dashboard is an interactive Altair chart that lets you visualize variables aggregated by any combination of columns included in the Probe. In the library, the dashboards are divided into two parts:
- On the top, there is the plot of the aggregated variable of interest.
- On the bottom, there are interactive filters to set. Only the selected data is aggregated to produce the plot on the top.
Plot
A Plot is exportable in png or svg format and easy to integrate into a report. However, as it is less interactive it is preferred to specify the filters in the inputs of the functions.
Available Visualizations
The library provides interactive dashboards that let you set any combination of care sites, stay types and other columns if included in the Probe. You can only export a dashboard in HTML format.
The probe_dashboard()
returns:
- On the top, the aggregated variable is the average completeness predictor \(c(t)\) over time \(t\) with the prediction \(\hat{c}(t)\) if the fitted Model is specified.
- On the bottom, the interactive filters are all the columns included in the Probe (such as time, care site, number of visits...etc.).
from edsteva.viz.dashboards import probe_dashboard
probe_dashboard(
probe=probe,
fitted_model=step_function_model,
care_site_level=care_site_level,
)
The normalized_probe_dashboard()
returns a representation of the overall deviation from the Model:
- On the top, the aggregated variable is a normalized completeness predictor \(\frac{c(t)}{c_0}\) over normalized time \(t - t_0\).
- On the bottom, the interactive filters are all the columns included in the Probe (such as time, care site, number of visits...etc.) with all the Model coefficients and metrics included in the Model.
from edsteva.viz.dashboards import normalized_probe_dashboard
normalized_probe_dashboard(
probe=probe,
fitted_model=step_function_model,
care_site_level=care_site_level,
)
An example is available here.
The library provides static plots that you can export in png or svg. As it is less interactive, you may specify the filters in the inputs of the functions.
The probe_plot()
returns the top plot of the probe_dashboard()
: the normalized completeness predictor \(\frac{c(t)}{c_0}\) over normalized time \(t - t_0\).
from edsteva.viz.plots import probe_plot
probe_plot(
probe=probe,
fitted_model=step_function_model,
care_site_level=care_site_level,
stay_type=stay_type,
save_path=plot_path,
)
The normalized_probe_plot()
returns the top plot of the normalized_probe_dashboard()
. Consequently, you have to specify the filters in the inputs of the function.
from edsteva.viz.plots import normalized_probe_plot
normalized_probe_plot(
probe=probe,
fitted_model=step_function_model,
t_min=-15,
t_max=15,
save_path=plot_path,
)
The estimates_densities_plot()
returns the density plot and the median of each estimate. It can help you to set the thresholds.
from edsteva.viz.plots import estimates_densities_plot
estimates_densities_plot(
fitted_model=step_function_model,
)