File size: 989 Bytes
f586f77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { createPython } from "@elvis/pyodide";

import type { ModelResults, Projection } from "@elvis/ui";

import type { DecisionBoundaryResult, DecisionBoundarySettings, ModelSettings } from "./types";

// The methods of backend/src/manager.py's Manager
export type DecisionBoundaryApi = {
  // projection maps plot coordinates back to inputs; omitted when the inputs are the plot coordinates
  handle_set_dataset: { args: { inputs: number[][]; outputs: string[]; input_names?: string[]; projection?: Projection }; result: null };
  handle_set_model_config: { args: ModelSettings; result: null };
  // Metrics and learned parameters; null when there is no data to fit
  handle_build_model: { args: undefined; result: ModelResults | null };
  handle_get_decision_boundary: { args: DecisionBoundarySettings; result: DecisionBoundaryResult };
};

export const python = createPython<DecisionBoundaryApi>(
  new Worker(new URL("./pyodide.worker.ts", import.meta.url), { type: "module" }),
);