Skip to content

Algorithms overview

Framework algorithms implement reusable computation. They accept in-memory data and return result DTOs; they do not open datasets or choose workflow policy.

The catalog now covers five neutral kernel families:

  • embedding and blockwise clustering;
  • graph association, filtering, connectivity and community quality;
  • profile distributions and similarity;
  • entropy and information gain;
  • deterministic cross-run stability.
from drtoller.framework.algorithms import embed_rows, cluster_vectors, cluster_with_k

Embedding and clustering dispatch by registered method_id. Dataset metrics and offline artifact evaluation use separate capability registries. Graph, profile, information and stability kernels are imported from their package APIs rather than added to the root facade.

from drtoller.framework.algorithms.graph import pmi_family
from drtoller.framework.algorithms.information import delta_h
from drtoller.framework.algorithms.profiles import cosine_similarity
from drtoller.framework.algorithms.stability import adjusted_rand_index

compute.* defaults/user params compile into ComputePlan. A processor or execution mode prepares inputs and invokes the selected method. DRTML does not execute an arbitrary algorithm automatically.

plan = parse_compute_plan(params)
result = cluster_with_k(
vectors,
row_ids,
chosen_k,
method_id=plan.cluster.method_id,
params=cluster_algorithm_kwargs(plan),
)
rows = [
{"row_id": rid, "cluster_id": int(label)}
for rid, label in zip(result.row_ids, result.labels)
]
return [ProcessResult(ok=True, rows={"assignments": rows})]

Domain code owns chosen_k, probe loops and early stopping. Framework owns the clustering math and, at scale, the streaming fit/assign orchestration (Streaming cluster) — still without choosing K.

algorithms.evaluation is split by data shape and wired through pattern: evaluation:

  • vectorartifact_kind: vector_rows;
  • cluster — inertia, sampled Silhouette, Davies–Bouldin, Calinski–Harabasz, size diagnostics (artifact_kind: cluster_rows);
  • graph — topology, components, degree, modularity, association (artifact_kind: graph_edges);
  • classification, calibration and statistics — focused reusable formulas (Python API; not all DRTML-bound yet);
  • bindings — domain-neutral ratios and distribution drift.

See Offline evaluation.

Framework owns mathematical kernels and streaming orchestration. Domain code still defines graph nodes and edges, profile keys, candidate semantics, constraints, thresholds and interpretation of results — including which probe candidate wins.