pelinker.grid_export¶
Per-sample clustering grid CSV schema and selection at the consensus hyperparameter.
apply_chosen_min_cluster_size_to_grid(df_grid, chosen_by_combo)
¶
Overwrite chosen_min_cluster_size per (model, layer) (e.g. after re-solving the grid).
Source code in pelinker/grid_export.py
grid_chosen_hyperparameters_to_jsonable(solved_by_combo, optimization_config)
¶
Build a JSON-serializable document of pooled grid solver results per (model, layer).
Source code in pelinker/grid_export.py
grid_export_column_order()
¶
Canonical column order for results_grid_per_sample.csv.
Source code in pelinker/grid_export.py
grid_export_rows_from_report(report, *, model, layer, sample_idx, chosen_min_cluster_size)
¶
Expand one sample's grid metrics_df into rows for results_grid_per_sample.csv.
chosen_min_cluster_size is the pooled consensus hyperparameter for the
(model, layer) combination; it is duplicated on every grid row for that sample.
Source code in pelinker/grid_export.py
has_grid_points_for_dbcv_ari_scatter(df_grid)
¶
True if df_grid has the columns needed for the DBCV vs ARI scatter.
per_combo_metrics_from_grid(df_grid)
¶
Per (model, layer), list of per-sample grid metric tables for re-solving min_cluster_size.
Each DataFrame has columns among min_cluster_size, dbcv, ari, n_clusters, icm.
Source code in pelinker/grid_export.py
select_grid_points_at_chosen_min_cluster_size(df_grid, *, require_n_clusters_gt_one=True)
¶
One row per (model, layer, sample_idx): (dbcv, ari) at chosen_min_cluster_size.
Rows are taken from the grid sweep where min_cluster_size equals the consensus
chosen_min_cluster_size for that (model, layer). This matches the vertical marker
on per-combination error-bar plots.
Source code in pelinker/grid_export.py
write_grid_chosen_hyperparameters(path, solved_by_combo, optimization_config)
¶
Write grid_chosen_hyperparameters.json for downstream final fit.