OCDocker.Workbench.AblationProtocolSimilarity module¶
Expanded feature-policy similarity for OCScore ablation protocols.
Each executed study uses feature_policy_metadata.json from one replica when
available. Catalog-only policies fall back to bundled YAML policies resolved with
apply_feature_policy against the same workspace candidate discovery path used
by OCDocker.Workbench.AblationDesign.
The read-only payload powers GET /api/ablation-protocol-similarity and the
Protocol similarity zone in the Ablation dashboard tab.
- OCDocker.Workbench.AblationProtocolSimilarity.build_ablation_protocol_similarity_analysis(root, *, reference_policy=None, metric=None, include_catalog_only=False, max_depth=6)[source]¶
Build protocol similarity analysis for one Workbench root.
Each selected policy is expanded with the same candidate feature universe, compared with Jaccard similarity, clustered for visualization, and annotated with optional outcome metrics and reference diffs.
- Parameters:
root (str or pathlib.Path) – Workbench root to scan.
reference_policy (str or None) – Reference policy name for diffs. Defaults to
full_ocscorewhen present.metric (str or None) – Optional comparison metric used for cluster mean overlays.
include_catalog_only (bool) – When
True, always include the full bundled and workspace policy catalog. WhenFalse, restrict to policies with executed workspace folders or ablation result manifests. If none are detected, the full catalog is still returned so feature-level similarity remains usable.max_depth (int) – Maximum scan depth for result manifests when resolving metric overlays.
- Returns:
Similarity analysis payload for API and dashboard consumers.
- Return type:
WorkbenchAblationProtocolSimilarity
Ablation protocol similarity¶
This helper compares OCScore ablation protocols by their expanded
feature sets rather than by raw YAML include/exclude tokens. Each bundled or
workspace policy is resolved with
OCDocker.OCScore.Utils.FeaturePolicy.apply_feature_policy() against a
shared candidate feature universe discovered from replica
feature_policy_metadata.json or, as a fallback, from raw_prepare
tables via OCDocker.Workbench.AblationDesign.
Wildcard patterns such as ligand_* therefore expand to every matching
column before Jaccard similarity, family rollups, reference diffs, and
hierarchical clustering are computed. Clustering uses feature similarity only;
an optional comparison metric overlays mean outcomes per cluster without
changing the cluster assignment.
The read-only payload is exposed by the local API at
GET /api/ablation-protocol-similarity and rendered in the Protocol
similarity zone of the Ablation dashboard tab (heatmap, family grid, cluster
summaries, and reference diffs). Outcome-oriented ablation tables remain in
OCDocker.Workbench.Ablation.
curl 'http://127.0.0.1:8765/api/ablation-protocol-similarity?metric=auc:max&reference=full_ocscore&include_catalog_only=true'
Query parameters:
metric— optional comparison metric for cluster mean overlays (same syntax asOCDocker.Workbench.Ablation.parse_ablation_metric()).reference— reference policy for add/remove diffs (defaults tofull_ocscorewhen available).include_catalog_only— defaults totrue; whenfalse, restrict to executed workspace folders (API/CLI). The dashboard always loads the full catalog and filters client-side.