Three-stage Birch online clustering: stream the data in chunks to partial-fit a Birch model, finalize it to the target number of clusters, and score against the true labels.
Workflow stages
Stream the feature matrix in chunks and partial-fit a Birch clusterer using the configured threshold and branching factor.
Finalize the Birch model to the target number of clusters with a no-data partial_fit call.
Predict labels for the full input and compute adjusted Rand index and homogeneity against the ground-truth labels.
Inputs and outputs
Each verifier case is a JSON-style dictionary. Drive the original workflow with the provided fields and return a JSON-friendly dictionary whose keys and value types match those produced by the reference workflow in tests/original_snapshot/workflow.py.
Do not hard-code expected outputs. Recompute them from the case parameters using the same library APIs the original workflow uses.
Capability contract
Implement run_case as a local orchestrator: a plain Python function (not itself a Modal Function) that the harness calls directly and that dispatches work to one or more Modal Functions via .remote(...), .map(...), or .starmap(...).
The solution must also use:
Staged helpers.
Notes
The verifier executes the original workflow at runtime and compares your run_case output to it case by case.
Keep behavior deterministic: do not introduce randomness beyond what the original workflow uses.
Install only the dependencies the workflow actually needs into the remote container.
Required solution interface
Write the solution in /app/solution/modal_app.py. Define a Modal application
object named app and expose a callable named run_case that accepts one case
dictionary and returns a JSON-serializable result matching the original
workflow.
Runtime file layout
The finalized task workspace is copied into /app when the sandbox starts.
Source files from environment/workspace are available at paths such as
/app/workflow.py, /app/original_workflow.py, /app/original.py, or other
task-specific filenames.