causalexplain.gui package#

Subpackages#

Submodules#

NiceGUI app for local causalexplain workflows.

has_active_model(active_model_state)[source]#

Return whether the GUI currently has a trained or loaded model.

run_gui(host='127.0.0.1', port=8080)[source]#

Start the NiceGUI application.

Cytoscape helpers for NiceGUI graph rendering.

ensure_cytoscape_assets()[source]#

Expose Cytoscape asset registration for GUI apps.

Helpers for shaping ReX diagnostics for GUI consumption.

ordered_regressors(regressors)[source]#

Return regressors in preferred GUI order.

normalize_rex_diagnostics(diagnostics_by_regressor)[source]#

Stack per-regressor diagnostics into GUI-ready dataframes.

regression_errors_for_all_targets(errors_long)[source]#

Return regression errors for all target variables.

shap_values_for_target(shap_long, target)[source]#

Filter and sort SHAP mean values for a selected target variable.

bootstrap_details_for_regressor(bootstrap_matrices, bootstrap_edges_long, regressor)[source]#

Return the matrix and edge table for the selected regressor.

Graph helper utilities for the GUI.

clean_node_name(name)[source]#

Normalize a node name by stripping whitespace and quotes.

normalize_graph(graph)[source]#

Return a cleaned directed graph with normalized node names.

dag_is_valid(graph, min_edges, max_edges)[source]#

Check that the graph is a DAG within the edge constraints.

graph_from_dot(path)[source]#

Load a DOT file into a normalized directed graph.

File and path utilities for the GUI.

ensure_file(path, suffixes)[source]#

Ensure the file exists and matches the expected suffixes.

ensure_output_dir(path)[source]#

Create the output directory for the given file path when needed.

normalize_output_value(raw_value, required_ext)[source]#

Normalize an output path by enforcing the required extension.

sanitize_output_name(name)[source]#

Strip extensions and whitespace from a dataset base name.

Rendering helpers for graphs, metrics, and diagnostics in the GUI.

update_metrics_log(log_el, metrics)[source]#

Render metrics into a NiceGUI log element.

overlay_status_message(classes)[source]#

Return the overlay status message based on edge classes.

render_cytoscape_overlay(container, status_label, discoverer, ref_graph, *, persist_positions, height='420px')[source]#

Render an interactive overlay chart for predicted vs. reference DAGs.

render_cytoscape_graph(container, graph, *, height='420px')[source]#

Render a DAG in a NiceGUI container using Cytoscape.

render_regression_error_chart(errors_frame)[source]#

Return EChart options for grouped regression errors across targets.

render_shap_mean_chart(shap_for_target, target)[source]#

Return EChart options for grouped SHAP mean values.

render_bootstrap_heatmap(bootstrap_matrix, regressor)[source]#

Return EChart options for a regressor-specific bootstrap heatmap.

Default settings and persistence helpers for the GUI.

default_train_settings()[source]#

Return default training settings for the GUI.

default_load_settings()[source]#

Return default load/evaluation settings for the GUI.

default_generate_settings()[source]#

Return default dataset generation settings for the GUI.

default_diagnostics_settings()[source]#

Return default settings for the diagnostics tab.

merge_settings(stored, defaults)[source]#

Merge persisted settings into the provided defaults.

Style helpers for the causalexplain GUI.

app_styles_path()[source]#

Return the absolute path to the GUI CSS file.

read_app_styles()[source]#

Read the GUI CSS content from disk.

register_app_styles()[source]#

Inject the GUI CSS into the NiceGUI head.

UI helper utilities for NiceGUI widgets.

update_settings(storage, settings_key, target, key, value)[source]#

Update a settings dict and persist it to NiceGUI storage.

bind_setting(element, storage, settings_key, settings_ref, field)[source]#

Bind UI change events to a settings dictionary.

set_input_value(input_el, value)[source]#

Update a NiceGUI input value and refresh the widget.

async save_upload(upload_event, upload_dir, suffix=None)[source]#

Persist an uploaded file to the GUI upload folder.

make_upload_handler(input_el, storage, settings_key, settings_ref, field, upload_dir, suffix=None, status_label=None)[source]#

Create an async upload handler that updates UI state.

normalize_output_path(input_el, storage, settings_key, settings_ref, field, required_ext)[source]#

Normalize a UI output path and persist the setting.

Module contents#

GUI entry points for causalexplain.

run_gui(*args, **kwargs)[source]#

Lazy import to avoid circular dependencies when loading GUI helpers.