@memberjunction/predictive-studio 0.0.1 → 5.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -28
- package/dist/actions/base-predictive-studio.action.d.ts +63 -0
- package/dist/actions/base-predictive-studio.action.d.ts.map +1 -0
- package/dist/actions/base-predictive-studio.action.js +125 -0
- package/dist/actions/base-predictive-studio.action.js.map +1 -0
- package/dist/actions/index.d.ts +38 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +49 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/model-scoring-action-generator.d.ts +108 -0
- package/dist/actions/model-scoring-action-generator.d.ts.map +1 -0
- package/dist/actions/model-scoring-action-generator.js +316 -0
- package/dist/actions/model-scoring-action-generator.js.map +1 -0
- package/dist/actions/promote-model.action.d.ts +102 -0
- package/dist/actions/promote-model.action.d.ts.map +1 -0
- package/dist/actions/promote-model.action.js +132 -0
- package/dist/actions/promote-model.action.js.map +1 -0
- package/dist/actions/promote-model.gate.d.ts +77 -0
- package/dist/actions/promote-model.gate.d.ts.map +1 -0
- package/dist/actions/promote-model.gate.js +205 -0
- package/dist/actions/promote-model.gate.js.map +1 -0
- package/dist/actions/run-experiment.action.d.ts +60 -0
- package/dist/actions/run-experiment.action.d.ts.map +1 -0
- package/dist/actions/run-experiment.action.js +134 -0
- package/dist/actions/run-experiment.action.js.map +1 -0
- package/dist/actions/run-experiment.deps.d.ts +47 -0
- package/dist/actions/run-experiment.deps.d.ts.map +1 -0
- package/dist/actions/run-experiment.deps.js +71 -0
- package/dist/actions/run-experiment.deps.js.map +1 -0
- package/dist/actions/schedule-model-scoring.action.d.ts +71 -0
- package/dist/actions/schedule-model-scoring.action.d.ts.map +1 -0
- package/dist/actions/schedule-model-scoring.action.js +148 -0
- package/dist/actions/schedule-model-scoring.action.js.map +1 -0
- package/dist/actions/score-record-set.action.d.ts +133 -0
- package/dist/actions/score-record-set.action.d.ts.map +1 -0
- package/dist/actions/score-record-set.action.js +136 -0
- package/dist/actions/score-record-set.action.js.map +1 -0
- package/dist/actions/score-record-set.runner.d.ts +192 -0
- package/dist/actions/score-record-set.runner.d.ts.map +1 -0
- package/dist/actions/score-record-set.runner.js +416 -0
- package/dist/actions/score-record-set.runner.js.map +1 -0
- package/dist/actions/train-model.action.d.ts +57 -0
- package/dist/actions/train-model.action.d.ts.map +1 -0
- package/dist/actions/train-model.action.js +111 -0
- package/dist/actions/train-model.action.js.map +1 -0
- package/dist/agent/index.d.ts +14 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +14 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/model-dev-orchestrator-agent.d.ts +42 -0
- package/dist/agent/model-dev-orchestrator-agent.d.ts.map +1 -0
- package/dist/agent/model-dev-orchestrator-agent.js +76 -0
- package/dist/agent/model-dev-orchestrator-agent.js.map +1 -0
- package/dist/agent/modeling-plan-to-pipeline.d.ts +49 -0
- package/dist/agent/modeling-plan-to-pipeline.d.ts.map +1 -0
- package/dist/agent/modeling-plan-to-pipeline.js +101 -0
- package/dist/agent/modeling-plan-to-pipeline.js.map +1 -0
- package/dist/agent/pipeline-builder-agent.d.ts +58 -0
- package/dist/agent/pipeline-builder-agent.d.ts.map +1 -0
- package/dist/agent/pipeline-builder-agent.js +101 -0
- package/dist/agent/pipeline-builder-agent.js.map +1 -0
- package/dist/agent/pipeline-builder.d.ts +67 -0
- package/dist/agent/pipeline-builder.d.ts.map +1 -0
- package/dist/agent/pipeline-builder.js +114 -0
- package/dist/agent/pipeline-builder.js.map +1 -0
- package/dist/experiment/concurrency.d.ts +41 -0
- package/dist/experiment/concurrency.d.ts.map +1 -0
- package/dist/experiment/concurrency.js +54 -0
- package/dist/experiment/concurrency.js.map +1 -0
- package/dist/experiment/experiment-orchestrator.d.ts +136 -0
- package/dist/experiment/experiment-orchestrator.d.ts.map +1 -0
- package/dist/experiment/experiment-orchestrator.js +408 -0
- package/dist/experiment/experiment-orchestrator.js.map +1 -0
- package/dist/experiment/index.d.ts +17 -0
- package/dist/experiment/index.d.ts.map +1 -0
- package/dist/experiment/index.js +17 -0
- package/dist/experiment/index.js.map +1 -0
- package/dist/experiment/leaderboard.d.ts +50 -0
- package/dist/experiment/leaderboard.d.ts.map +1 -0
- package/dist/experiment/leaderboard.js +91 -0
- package/dist/experiment/leaderboard.js.map +1 -0
- package/dist/experiment/seams.d.ts +95 -0
- package/dist/experiment/seams.d.ts.map +1 -0
- package/dist/experiment/seams.js +126 -0
- package/dist/experiment/seams.js.map +1 -0
- package/dist/experiment/types.d.ts +228 -0
- package/dist/experiment/types.d.ts.map +1 -0
- package/dist/experiment/types.js +19 -0
- package/dist/experiment/types.js.map +1 -0
- package/dist/experiment/wave-strategist.d.ts +31 -0
- package/dist/experiment/wave-strategist.d.ts.map +1 -0
- package/dist/experiment/wave-strategist.js +50 -0
- package/dist/experiment/wave-strategist.js.map +1 -0
- package/dist/feature-assembly/as-of.d.ts +74 -0
- package/dist/feature-assembly/as-of.d.ts.map +1 -0
- package/dist/feature-assembly/as-of.js +136 -0
- package/dist/feature-assembly/as-of.js.map +1 -0
- package/dist/feature-assembly/data-access.d.ts +114 -0
- package/dist/feature-assembly/data-access.d.ts.map +1 -0
- package/dist/feature-assembly/data-access.js +68 -0
- package/dist/feature-assembly/data-access.js.map +1 -0
- package/dist/feature-assembly/feature-assembly-executor.d.ts +273 -0
- package/dist/feature-assembly/feature-assembly-executor.d.ts.map +1 -0
- package/dist/feature-assembly/feature-assembly-executor.js +521 -0
- package/dist/feature-assembly/feature-assembly-executor.js.map +1 -0
- package/dist/feature-assembly/index.d.ts +13 -0
- package/dist/feature-assembly/index.d.ts.map +1 -0
- package/dist/feature-assembly/index.js +13 -0
- package/dist/feature-assembly/index.js.map +1 -0
- package/dist/feature-assembly/leakage-guard.d.ts +86 -0
- package/dist/feature-assembly/leakage-guard.d.ts.map +1 -0
- package/dist/feature-assembly/leakage-guard.js +111 -0
- package/dist/feature-assembly/leakage-guard.js.map +1 -0
- package/dist/feature-assembly/vision-llm.d.ts +125 -0
- package/dist/feature-assembly/vision-llm.d.ts.map +1 -0
- package/dist/feature-assembly/vision-llm.js +211 -0
- package/dist/feature-assembly/vision-llm.js.map +1 -0
- package/dist/feature-pipelines/feature-pipeline-engine.d.ts +159 -0
- package/dist/feature-pipelines/feature-pipeline-engine.d.ts.map +1 -0
- package/dist/feature-pipelines/feature-pipeline-engine.js +298 -0
- package/dist/feature-pipelines/feature-pipeline-engine.js.map +1 -0
- package/dist/feature-pipelines/index.d.ts +13 -0
- package/dist/feature-pipelines/index.d.ts.map +1 -0
- package/dist/feature-pipelines/index.js +13 -0
- package/dist/feature-pipelines/index.js.map +1 -0
- package/dist/feature-pipelines/types.d.ts +72 -0
- package/dist/feature-pipelines/types.d.ts.map +1 -0
- package/dist/feature-pipelines/types.js +17 -0
- package/dist/feature-pipelines/types.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +80 -0
- package/dist/index.js.map +1 -0
- package/dist/maintenance/index.d.ts +19 -0
- package/dist/maintenance/index.d.ts.map +1 -0
- package/dist/maintenance/index.js +19 -0
- package/dist/maintenance/index.js.map +1 -0
- package/dist/maintenance/maintenance-engine.d.ts +152 -0
- package/dist/maintenance/maintenance-engine.d.ts.map +1 -0
- package/dist/maintenance/maintenance-engine.js +412 -0
- package/dist/maintenance/maintenance-engine.js.map +1 -0
- package/dist/maintenance/metrics.d.ts +37 -0
- package/dist/maintenance/metrics.d.ts.map +1 -0
- package/dist/maintenance/metrics.js +85 -0
- package/dist/maintenance/metrics.js.map +1 -0
- package/dist/maintenance/seams.d.ts +85 -0
- package/dist/maintenance/seams.d.ts.map +1 -0
- package/dist/maintenance/seams.js +166 -0
- package/dist/maintenance/seams.js.map +1 -0
- package/dist/maintenance/types.d.ts +318 -0
- package/dist/maintenance/types.d.ts.map +1 -0
- package/dist/maintenance/types.js +27 -0
- package/dist/maintenance/types.js.map +1 -0
- package/dist/operations/__tests__/helpers.d.ts +30 -0
- package/dist/operations/__tests__/helpers.d.ts.map +1 -0
- package/dist/operations/__tests__/helpers.js +44 -0
- package/dist/operations/__tests__/helpers.js.map +1 -0
- package/dist/operations/control-experiment-session.operation.d.ts +33 -0
- package/dist/operations/control-experiment-session.operation.d.ts.map +1 -0
- package/dist/operations/control-experiment-session.operation.js +71 -0
- package/dist/operations/control-experiment-session.operation.js.map +1 -0
- package/dist/operations/create-scoring-process.operation.d.ts +30 -0
- package/dist/operations/create-scoring-process.operation.d.ts.map +1 -0
- package/dist/operations/create-scoring-process.operation.js +65 -0
- package/dist/operations/create-scoring-process.operation.js.map +1 -0
- package/dist/operations/delegation.d.ts +113 -0
- package/dist/operations/delegation.d.ts.map +1 -0
- package/dist/operations/delegation.js +139 -0
- package/dist/operations/delegation.js.map +1 -0
- package/dist/operations/index.d.ts +40 -0
- package/dist/operations/index.d.ts.map +1 -0
- package/dist/operations/index.js +55 -0
- package/dist/operations/index.js.map +1 -0
- package/dist/operations/promote-model.operation.d.ts +57 -0
- package/dist/operations/promote-model.operation.d.ts.map +1 -0
- package/dist/operations/promote-model.operation.js +113 -0
- package/dist/operations/promote-model.operation.js.map +1 -0
- package/dist/operations/run-feature-pipeline.operation.d.ts +56 -0
- package/dist/operations/run-feature-pipeline.operation.d.ts.map +1 -0
- package/dist/operations/run-feature-pipeline.operation.js +94 -0
- package/dist/operations/run-feature-pipeline.operation.js.map +1 -0
- package/dist/operations/score-record-set.operation.d.ts +47 -0
- package/dist/operations/score-record-set.operation.d.ts.map +1 -0
- package/dist/operations/score-record-set.operation.js +113 -0
- package/dist/operations/score-record-set.operation.js.map +1 -0
- package/dist/operations/start-experiment-session.operation.d.ts +66 -0
- package/dist/operations/start-experiment-session.operation.d.ts.map +1 -0
- package/dist/operations/start-experiment-session.operation.js +132 -0
- package/dist/operations/start-experiment-session.operation.js.map +1 -0
- package/dist/operations/train-model.operation.d.ts +50 -0
- package/dist/operations/train-model.operation.d.ts.map +1 -0
- package/dist/operations/train-model.operation.js +114 -0
- package/dist/operations/train-model.operation.js.map +1 -0
- package/dist/scheduling/index.d.ts +13 -0
- package/dist/scheduling/index.d.ts.map +1 -0
- package/dist/scheduling/index.js +13 -0
- package/dist/scheduling/index.js.map +1 -0
- package/dist/scheduling/scheduled-model-scoring.d.ts +169 -0
- package/dist/scheduling/scheduled-model-scoring.d.ts.map +1 -0
- package/dist/scheduling/scheduled-model-scoring.js +189 -0
- package/dist/scheduling/scheduled-model-scoring.js.map +1 -0
- package/dist/scoring/artifact-loader.d.ts +65 -0
- package/dist/scoring/artifact-loader.d.ts.map +1 -0
- package/dist/scoring/artifact-loader.js +97 -0
- package/dist/scoring/artifact-loader.js.map +1 -0
- package/dist/scoring/index.d.ts +26 -0
- package/dist/scoring/index.d.ts.map +1 -0
- package/dist/scoring/index.js +26 -0
- package/dist/scoring/index.js.map +1 -0
- package/dist/scoring/ml-model-inference-processor.d.ts +154 -0
- package/dist/scoring/ml-model-inference-processor.d.ts.map +1 -0
- package/dist/scoring/ml-model-inference-processor.js +320 -0
- package/dist/scoring/ml-model-inference-processor.js.map +1 -0
- package/dist/scoring/ml-model-score-enricher.d.ts +80 -0
- package/dist/scoring/ml-model-score-enricher.d.ts.map +1 -0
- package/dist/scoring/ml-model-score-enricher.js +139 -0
- package/dist/scoring/ml-model-score-enricher.js.map +1 -0
- package/dist/scoring/register.d.ts +81 -0
- package/dist/scoring/register.d.ts.map +1 -0
- package/dist/scoring/register.js +105 -0
- package/dist/scoring/register.js.map +1 -0
- package/dist/scoring/scoring-binding.d.ts +72 -0
- package/dist/scoring/scoring-binding.d.ts.map +1 -0
- package/dist/scoring/scoring-binding.js +76 -0
- package/dist/scoring/scoring-binding.js.map +1 -0
- package/dist/scoring/scoring-process-shared.d.ts +105 -0
- package/dist/scoring/scoring-process-shared.d.ts.map +1 -0
- package/dist/scoring/scoring-process-shared.js +141 -0
- package/dist/scoring/scoring-process-shared.js.map +1 -0
- package/dist/scoring/scoring-process.d.ts +128 -0
- package/dist/scoring/scoring-process.d.ts.map +1 -0
- package/dist/scoring/scoring-process.js +146 -0
- package/dist/scoring/scoring-process.js.map +1 -0
- package/dist/scoring/seams.d.ts +40 -0
- package/dist/scoring/seams.d.ts.map +1 -0
- package/dist/scoring/seams.js +66 -0
- package/dist/scoring/seams.js.map +1 -0
- package/dist/scoring/startup-register.d.ts +49 -0
- package/dist/scoring/startup-register.d.ts.map +1 -0
- package/dist/scoring/startup-register.js +72 -0
- package/dist/scoring/startup-register.js.map +1 -0
- package/dist/scoring/types.d.ts +134 -0
- package/dist/scoring/types.d.ts.map +1 -0
- package/dist/scoring/types.js +26 -0
- package/dist/scoring/types.js.map +1 -0
- package/dist/training/artifact-store.d.ts +124 -0
- package/dist/training/artifact-store.d.ts.map +1 -0
- package/dist/training/artifact-store.js +163 -0
- package/dist/training/artifact-store.js.map +1 -0
- package/dist/training/index.d.ts +13 -0
- package/dist/training/index.d.ts.map +1 -0
- package/dist/training/index.js +13 -0
- package/dist/training/index.js.map +1 -0
- package/dist/training/seams.d.ts +57 -0
- package/dist/training/seams.d.ts.map +1 -0
- package/dist/training/seams.js +103 -0
- package/dist/training/seams.js.map +1 -0
- package/dist/training/training-engine.d.ts +96 -0
- package/dist/training/training-engine.d.ts.map +1 -0
- package/dist/training/training-engine.js +300 -0
- package/dist/training/training-engine.js.map +1 -0
- package/dist/training/types.d.ts +159 -0
- package/dist/training/types.d.ts.map +1 -0
- package/dist/training/types.js +16 -0
- package/dist/training/types.js.map +1 -0
- package/package.json +44 -7
package/dist/index.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @memberjunction/predictive-studio
|
|
3
|
+
*
|
|
4
|
+
* Server-side engine for MemberJunction Predictive Studio. This is a scaffold —
|
|
5
|
+
* the real components land in later phases. The engine composes onto existing MJ
|
|
6
|
+
* substrates (Record Set Processing, Remote Operations, Agents, Vectors) and the
|
|
7
|
+
* Python sidecar, per `plans/predictive-studio.md`.
|
|
8
|
+
*
|
|
9
|
+
* This package depends on `@memberjunction/predictive-studio-core` for its type
|
|
10
|
+
* contracts and on the MJ core/global packages for entity + class-factory access.
|
|
11
|
+
*/
|
|
12
|
+
// The self-managing Python-sidecar client `MLSidecar` lives in its own package,
|
|
13
|
+
// `@memberjunction/predictive-studio-sidecar` — import it directly from there.
|
|
14
|
+
// It is intentionally NOT re-exported here (CLAUDE.md rule 5: no cross-package re-exports).
|
|
15
|
+
// FeatureAssembly executor + as-of / leakage-guard correctness primitives (§5/§6).
|
|
16
|
+
export * from './feature-assembly/index.js';
|
|
17
|
+
// Feature Pipeline discovery + monitoring — FeaturePipelineEngine (BaseEngine cache
|
|
18
|
+
// over the categorized MJ: Record Processes rows) + its projection types (§5.4 / SP6).
|
|
19
|
+
export * from './feature-pipelines/index.js';
|
|
20
|
+
// Training orchestration — TrainingEngine + its injected seams (§3/§4.3/§4.4/§8.2/§11).
|
|
21
|
+
export * from './training/index.js';
|
|
22
|
+
// Scoring — MLModelInferenceProcessor (Record Set Processing work type) + write-back (§10).
|
|
23
|
+
export * from './scoring/index.js';
|
|
24
|
+
// Scheduling — createScheduledModelScoring: bind a trained model to write its
|
|
25
|
+
// prediction into a target entity column on a recurring schedule, by assembling a
|
|
26
|
+
// single scheduled MJ: Record Processes row (the north-star enabler, PS2-6).
|
|
27
|
+
export * from './scheduling/index.js';
|
|
28
|
+
// Experiment orchestration — deterministic, wave-based ExperimentOrchestrator that
|
|
29
|
+
// executes an approved ModelingPlanSpec with a leaderboard, pruning, and a budget gate (§8.3/§8.4/§9.1).
|
|
30
|
+
export * from './experiment/index.js';
|
|
31
|
+
// Action boundaries — thin MJ Actions over the engine service classes (train /
|
|
32
|
+
// score / experiment / promote), so agents / UI / workflows can invoke them (§12).
|
|
33
|
+
export * from './actions/index.js';
|
|
34
|
+
// Remote Operations — the six Manual-mode server bodies for the CodeGen-emitted
|
|
35
|
+
// `PredictiveStudio.*` operation bases. The typed peers of the Actions (same engine
|
|
36
|
+
// delegation path), invocable by stable key from client or server (§12).
|
|
37
|
+
export * from './operations/index.js';
|
|
38
|
+
// Maintenance — MaintenanceEngine (staleness detection / scheduled re-scoring /
|
|
39
|
+
// retraining triggers + challenger-vs-incumbent promotion recommendation), the
|
|
40
|
+
// RetrainingPolicy model, its DI seams, and the default honest drift detector (§12 / SP10).
|
|
41
|
+
export * from './maintenance/index.js';
|
|
42
|
+
// Agent builder — the Predictive Studio Agent's DETERMINISTIC builder: the pure
|
|
43
|
+
// ModelingPlanSpec→pipeline-config mapper + PredictiveStudioPipelineBuilder (create
|
|
44
|
+
// pipeline → train → publish gated on the trust verdict). Code, never LLM.
|
|
45
|
+
export * from './agent/index.js';
|
|
46
|
+
/**
|
|
47
|
+
* Version marker for the Predictive Studio engine package. Kept in sync with the
|
|
48
|
+
* package version so consumers can assert compatibility at runtime.
|
|
49
|
+
*/
|
|
50
|
+
export const PredictiveStudioEngineVersion = '5.43.0';
|
|
51
|
+
// region: Components added in later phases (scaffold placeholders)
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
// FeatureAssembly executor — turns (record set, frozen FeatureSteps) → matrix,
|
|
54
|
+
// identical across train / scheduled / on-demand (§6).
|
|
55
|
+
// [Implemented — see ./feature-assembly]
|
|
56
|
+
// TrainingEngine — orchestrates /train against the Python sidecar,
|
|
57
|
+
// persists immutable, versioned MJ: ML Models (§3/§4.3).
|
|
58
|
+
// [Implemented — see ./training]
|
|
59
|
+
// MLModelInferenceProcessor — Record Set Processing work type for batch + single
|
|
60
|
+
// -record scoring with optional write-back (§10).
|
|
61
|
+
// ExperimentOrchestrator — deterministic plan executor running iterations in
|
|
62
|
+
// waves through Record Set Processing (§8.3/§9.1).
|
|
63
|
+
// MLSidecar — self-managing client for the /train + /predict
|
|
64
|
+
// sidecar contract (§3.2), spawning the bundled Python
|
|
65
|
+
// microservice. [Implemented in package
|
|
66
|
+
// @memberjunction/predictive-studio-sidecar — import directly]
|
|
67
|
+
// ---------------------------------------------------------------------------
|
|
68
|
+
// endregion
|
|
69
|
+
/**
|
|
70
|
+
* Internal scaffold guard proving the core dependency is wired and a
|
|
71
|
+
* `ModelingPlanSpec` is consumable here. Replaced by real orchestration in a
|
|
72
|
+
* later phase.
|
|
73
|
+
*
|
|
74
|
+
* @param plan a (possibly partial) modeling plan
|
|
75
|
+
* @returns whether the plan has passed the user approval gate
|
|
76
|
+
*/
|
|
77
|
+
export function isModelingPlanApproved(plan) {
|
|
78
|
+
return plan.Approved === true;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,gFAAgF;AAChF,+EAA+E;AAC/E,4FAA4F;AAE5F,mFAAmF;AACnF,cAAc,oBAAoB,CAAC;AAEnC,oFAAoF;AACpF,uFAAuF;AACvF,cAAc,qBAAqB,CAAC;AAEpC,wFAAwF;AACxF,cAAc,YAAY,CAAC;AAE3B,4FAA4F;AAC5F,cAAc,WAAW,CAAC;AAE1B,8EAA8E;AAC9E,kFAAkF;AAClF,6EAA6E;AAC7E,cAAc,cAAc,CAAC;AAE7B,mFAAmF;AACnF,yGAAyG;AACzG,cAAc,cAAc,CAAC;AAE7B,+EAA+E;AAC/E,mFAAmF;AACnF,cAAc,WAAW,CAAC;AAE1B,gFAAgF;AAChF,oFAAoF;AACpF,yEAAyE;AACzE,cAAc,cAAc,CAAC;AAE7B,gFAAgF;AAChF,+EAA+E;AAC/E,4FAA4F;AAC5F,cAAc,eAAe,CAAC;AAE9B,gFAAgF;AAChF,oFAAoF;AACpF,2EAA2E;AAC3E,cAAc,SAAS,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,QAAQ,CAAC;AAEtD,mEAAmE;AACnE,8EAA8E;AAC9E,iFAAiF;AACjF,oFAAoF;AACpF,sEAAsE;AACtE,+EAA+E;AAC/E,sFAAsF;AACtF,8DAA8D;AAC9D,kFAAkF;AAClF,+EAA+E;AAC/E,iFAAiF;AACjF,gFAAgF;AAChF,8EAA8E;AAC9E,oFAAoF;AACpF,qEAAqE;AACrE,4FAA4F;AAC5F,8EAA8E;AAC9E,YAAY;AAEZ;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAsB;IAC3D,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module maintenance
|
|
3
|
+
*
|
|
4
|
+
* Barrel for the Predictive Studio **maintenance** pillar (plan §12 / SP10) — the
|
|
5
|
+
* {@link MaintenanceEngine} (staleness detection / scheduled re-scoring /
|
|
6
|
+
* retraining triggers + challenger-vs-incumbent promotion recommendation), the
|
|
7
|
+
* {@link RetrainingPolicy} model + defaults, the dependency-injection seams, and
|
|
8
|
+
* their production + default implementations.
|
|
9
|
+
*
|
|
10
|
+
* See `./maintenance-engine` for the flow overview and `./types` for the policy +
|
|
11
|
+
* seam contracts. The default, honest {@link RowCountProxyDriftDetector} and the
|
|
12
|
+
* production loader / row-counter / re-score runner live in `./seams`; the holdout
|
|
13
|
+
* -metric comparison helpers live in `./metrics`.
|
|
14
|
+
*/
|
|
15
|
+
export * from './types.js';
|
|
16
|
+
export * from './metrics.js';
|
|
17
|
+
export * from './maintenance-engine.js';
|
|
18
|
+
export * from './seams.js';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/maintenance/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module maintenance
|
|
3
|
+
*
|
|
4
|
+
* Barrel for the Predictive Studio **maintenance** pillar (plan §12 / SP10) — the
|
|
5
|
+
* {@link MaintenanceEngine} (staleness detection / scheduled re-scoring /
|
|
6
|
+
* retraining triggers + challenger-vs-incumbent promotion recommendation), the
|
|
7
|
+
* {@link RetrainingPolicy} model + defaults, the dependency-injection seams, and
|
|
8
|
+
* their production + default implementations.
|
|
9
|
+
*
|
|
10
|
+
* See `./maintenance-engine` for the flow overview and `./types` for the policy +
|
|
11
|
+
* seam contracts. The default, honest {@link RowCountProxyDriftDetector} and the
|
|
12
|
+
* production loader / row-counter / re-score runner live in `./seams`; the holdout
|
|
13
|
+
* -metric comparison helpers live in `./metrics`.
|
|
14
|
+
*/
|
|
15
|
+
export * from './types.js';
|
|
16
|
+
export * from './metrics.js';
|
|
17
|
+
export * from './maintenance-engine.js';
|
|
18
|
+
export * from './seams.js';
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/maintenance/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module maintenance/maintenance-engine
|
|
3
|
+
*
|
|
4
|
+
* The **MaintenanceEngine** — Predictive Studio's maintenance pillar (plan §12 /
|
|
5
|
+
* SP10). It composes the existing pieces (the {@link TrainingEngine}, the
|
|
6
|
+
* scoring inference path via an injected re-score runner, the
|
|
7
|
+
* `MJ: ML Model Scoring Bindings` lineage) into one auditable maintenance flow:
|
|
8
|
+
*
|
|
9
|
+
* 1. **Staleness detection** ({@link MaintenanceEngine.detectStaleness}) — given a
|
|
10
|
+
* binding + its model, decide stale-or-fresh by a configurable
|
|
11
|
+
* {@link RetrainingPolicy}: **cadence** (last-scored / last-trained older than N
|
|
12
|
+
* days), **data-volume** (target row count grew > X% since training), and a
|
|
13
|
+
* **drift** seam ({@link IDriftDetector}).
|
|
14
|
+
* 2. **Scheduled re-scoring** ({@link MaintenanceEngine.rescoreScheduledBinding}) —
|
|
15
|
+
* for a `Mode='Scheduled'` binding, re-run scoring via the injected runner and
|
|
16
|
+
* stamp `LastScoredAt` / `LastRowCount` on the binding.
|
|
17
|
+
* 3. **Retraining trigger** ({@link MaintenanceEngine.triggerRetrainIfStale}) — when
|
|
18
|
+
* a model is stale, retrain via `TrainingEngine.trainModel` against the same
|
|
19
|
+
* pipeline → a NEW immutable version; compare the challenger's `HoldoutMetrics`
|
|
20
|
+
* vs the incumbent's; return a **promotion recommendation** (`promote` when the
|
|
21
|
+
* challenger wins by the configured margin, else `hold`). It NEVER auto-promotes
|
|
22
|
+
* — promotion is a separate signed-off Action (§6.4 / PS-AGENT-7).
|
|
23
|
+
* 4. A **single pass** ({@link MaintenanceEngine.runMaintenancePass}) the scheduler
|
|
24
|
+
* / an Action calls to do all of the above over a set of bindings, isolated
|
|
25
|
+
* per-binding so one failure never aborts the batch.
|
|
26
|
+
*
|
|
27
|
+
* Every external dependency is injected (see {@link MaintenanceDeps}) so the engine
|
|
28
|
+
* is unit-testable with no live database and no live sidecar.
|
|
29
|
+
*/
|
|
30
|
+
import { type UserInfo } from '@memberjunction/core';
|
|
31
|
+
import type { MJMLModelEntity, MJMLModelScoringBindingEntity } from '@memberjunction/core-entities';
|
|
32
|
+
import type { TrainModelInput } from '../training/index.js';
|
|
33
|
+
import type { RetrainingPolicy, MaintenanceDeps, StalenessResult, RescoreResult, RetrainOutcome, ChallengerComparison, MaintenancePassOptions, MaintenancePassResult } from './types.js';
|
|
34
|
+
/**
|
|
35
|
+
* Maintenance orchestrator. Stateless across calls; construct once and reuse. The
|
|
36
|
+
* dependency bundle ({@link MaintenanceDeps}) and {@link RetrainingPolicy} are
|
|
37
|
+
* supplied per call.
|
|
38
|
+
*/
|
|
39
|
+
export declare class MaintenanceEngine {
|
|
40
|
+
/**
|
|
41
|
+
* Decide whether a binding's model is stale per policy. Pure with respect to the
|
|
42
|
+
* injected seams: reads counts/drift via deps and the clock, mutates nothing.
|
|
43
|
+
*
|
|
44
|
+
* @param binding the `MJ: ML Model Scoring Bindings` row
|
|
45
|
+
* @param model the `MJ: ML Models` row the binding scores with
|
|
46
|
+
* @param policy the staleness/retraining policy (partial → merged with defaults)
|
|
47
|
+
* @param deps the injected dependency bundle
|
|
48
|
+
*/
|
|
49
|
+
detectStaleness(binding: MJMLModelScoringBindingEntity, model: MJMLModelEntity, policy: Partial<RetrainingPolicy>, deps: MaintenanceDeps): Promise<StalenessResult>;
|
|
50
|
+
/** Append a cadence reason when the anchor timestamp is older than `cadenceDays`. */
|
|
51
|
+
private pushCadenceReason;
|
|
52
|
+
/** Append a data-volume reason when the target population grew past the threshold. */
|
|
53
|
+
private pushDataVolumeReason;
|
|
54
|
+
/** Append a drift reason when drift detection is enabled and the detector flags it. */
|
|
55
|
+
private pushDriftReason;
|
|
56
|
+
/** Count the model's target population now (via the injected counter); undefined on read failure. */
|
|
57
|
+
private currentRowCount;
|
|
58
|
+
/**
|
|
59
|
+
* Re-score a `Mode='Scheduled'` binding and stamp its monitoring fields
|
|
60
|
+
* (`LastScoredAt = now`, `LastRowCount = scoredCount`). Bindings that are not
|
|
61
|
+
* `Scheduled` are skipped (returns `null`).
|
|
62
|
+
*
|
|
63
|
+
* @param binding the binding to re-score
|
|
64
|
+
* @param model the model it scores with
|
|
65
|
+
* @param deps the injected dependency bundle
|
|
66
|
+
* @returns the re-score result, or `null` when the binding is not `Scheduled`
|
|
67
|
+
*/
|
|
68
|
+
rescoreScheduledBinding(binding: MJMLModelScoringBindingEntity, model: MJMLModelEntity, deps: MaintenanceDeps): Promise<RescoreResult | null>;
|
|
69
|
+
/** Stamp `LastScoredAt` / `LastRowCount` on a binding after a re-score (clock-driven). */
|
|
70
|
+
private stampScoringRun;
|
|
71
|
+
/**
|
|
72
|
+
* Retrain when stale: if `staleness.stale`, retrain the binding's model against
|
|
73
|
+
* the SAME pipeline → a new immutable version, then compare the challenger's
|
|
74
|
+
* holdout metric vs the incumbent's and return a promotion RECOMMENDATION
|
|
75
|
+
* (`promote` / `hold`). Never auto-promotes.
|
|
76
|
+
*
|
|
77
|
+
* @param binding the binding whose model may be retrained
|
|
78
|
+
* @param incumbent the current (stale) model
|
|
79
|
+
* @param staleness the staleness verdict driving the decision
|
|
80
|
+
* @param policy the policy (for the promotion margin + comparison metric)
|
|
81
|
+
* @param deps the injected dependency bundle (carries the training engine + deps)
|
|
82
|
+
* @param trainInputOverrides optional extra train inputs (labelEventDates / maxRows / etc.)
|
|
83
|
+
*/
|
|
84
|
+
triggerRetrainIfStale(binding: MJMLModelScoringBindingEntity, incumbent: MJMLModelEntity, staleness: StalenessResult, policy: Partial<RetrainingPolicy>, deps: MaintenanceDeps, trainInputOverrides?: Partial<Omit<TrainModelInput, 'pipelineId'>>): Promise<RetrainOutcome>;
|
|
85
|
+
/** Retrain the incumbent's pipeline into a new immutable version via the training engine. */
|
|
86
|
+
private retrainSamePipeline;
|
|
87
|
+
/**
|
|
88
|
+
* Compare a challenger model's holdout metric vs the incumbent's and recommend
|
|
89
|
+
* `promote` (challenger wins by ≥ margin) or `hold`. Pure / synchronous — reads
|
|
90
|
+
* the frozen `HoldoutMetrics` JSON off both models. This is a RECOMMENDATION; no
|
|
91
|
+
* promotion is performed here (that is a separate signed-off Action).
|
|
92
|
+
*
|
|
93
|
+
* @param incumbent the current model
|
|
94
|
+
* @param challenger the freshly-retrained model
|
|
95
|
+
* @param policy the resolved policy (margin + comparison metric)
|
|
96
|
+
*/
|
|
97
|
+
compareChallenger(incumbent: MJMLModelEntity, challenger: MJMLModelEntity, policy: RetrainingPolicy): ChallengerComparison;
|
|
98
|
+
/**
|
|
99
|
+
* How much the challenger improves over the incumbent, in the metric's natural
|
|
100
|
+
* direction (positive = better). Returns `null` when either value is absent.
|
|
101
|
+
* For error metrics lower is better → improvement = incumbent − challenger;
|
|
102
|
+
* for higher-is-better metrics → improvement = challenger − incumbent.
|
|
103
|
+
*/
|
|
104
|
+
private metricImprovement;
|
|
105
|
+
/** Decide promote-vs-hold from the directional improvement + margin (hold when unknown). */
|
|
106
|
+
private recommendPromotion;
|
|
107
|
+
/** Plain-language comparison explanation (business-friendly; never implies auto-promotion). */
|
|
108
|
+
private buildComparisonDetail;
|
|
109
|
+
/**
|
|
110
|
+
* Run the full maintenance pass over a set of bindings — the entry the scheduler
|
|
111
|
+
* (or an Action) calls. For each binding: load its model, detect staleness,
|
|
112
|
+
* optionally re-score (`Scheduled` bindings), and optionally retrain+compare when
|
|
113
|
+
* stale. Each binding is isolated: a failure is captured on its entry and the
|
|
114
|
+
* pass continues.
|
|
115
|
+
*
|
|
116
|
+
* @param bindings the bindings to maintain (resolve via the loader for "all scheduled")
|
|
117
|
+
* @param policy the staleness/retraining policy (partial → merged with defaults)
|
|
118
|
+
* @param deps the injected dependency bundle
|
|
119
|
+
* @param options pass toggles (re-score scheduled / retrain stale)
|
|
120
|
+
*/
|
|
121
|
+
runMaintenancePass(bindings: MJMLModelScoringBindingEntity[], policy: Partial<RetrainingPolicy>, deps: MaintenanceDeps, options?: MaintenancePassOptions): Promise<MaintenancePassResult>;
|
|
122
|
+
/** Maintain a single binding end-to-end, capturing any error on the entry. */
|
|
123
|
+
private maintainOne;
|
|
124
|
+
/** Fold per-binding entries into the pass-level counts. */
|
|
125
|
+
private summarizePass;
|
|
126
|
+
/** Merge a partial policy over the defaults. */
|
|
127
|
+
private resolvePolicy;
|
|
128
|
+
/**
|
|
129
|
+
* Resolve the model's target entity name from its frozen lineage (the
|
|
130
|
+
* training-unit entity), matching how {@link MLModelInferenceProcessor} resolves
|
|
131
|
+
* it at score time. Falls back to the model's `Pipeline` name virtual when
|
|
132
|
+
* lineage is absent.
|
|
133
|
+
*/
|
|
134
|
+
private targetEntityName;
|
|
135
|
+
/** Save a binding and throw with `LatestResult.CompleteMessage` on failure (CLAUDE.md). */
|
|
136
|
+
private saveOrThrow;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Convenience free-function entry for the scheduler / an Action: construct a
|
|
140
|
+
* {@link MaintenanceEngine} and run a single pass. Mirrors the "expose a clean
|
|
141
|
+
* `runMaintenancePass(bindings, policy, deps)` entry" scheduling hook (plan §12 /
|
|
142
|
+
* SP10) so callers don't have to manage the engine instance.
|
|
143
|
+
*
|
|
144
|
+
* @param bindings the bindings to maintain
|
|
145
|
+
* @param policy the staleness/retraining policy
|
|
146
|
+
* @param deps the injected dependency bundle
|
|
147
|
+
* @param options pass toggles
|
|
148
|
+
*/
|
|
149
|
+
export declare function runMaintenancePass(bindings: MJMLModelScoringBindingEntity[], policy: Partial<RetrainingPolicy>, deps: MaintenanceDeps, options?: MaintenancePassOptions): Promise<MaintenancePassResult>;
|
|
150
|
+
/** Re-export for downstream maintenance consumers without reaching into core. */
|
|
151
|
+
export type { UserInfo };
|
|
152
|
+
//# sourceMappingURL=maintenance-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maintenance-engine.d.ts","sourceRoot":"","sources":["../../src/maintenance/maintenance-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,KAAK,EACV,eAAe,EACf,6BAA6B,EAC9B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,aAAa,CAAC;AAErE,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,eAAe,EAEf,aAAa,EACb,cAAc,EACd,oBAAoB,EAIpB,sBAAsB,EACtB,qBAAqB,EAEtB,MAAM,SAAS,CAAC;AAMjB;;;;GAIG;AACH,qBAAa,iBAAiB;IAG5B;;;;;;;;OAQG;IACU,eAAe,CAC1B,OAAO,EAAE,6BAA6B,EACtC,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,OAAO,CAAC,gBAAgB,CAAC,EACjC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,eAAe,CAAC;IAsB3B,qFAAqF;IACrF,OAAO,CAAC,iBAAiB;IAgCzB,sFAAsF;IACtF,OAAO,CAAC,oBAAoB;IAuB5B,uFAAuF;YACzE,eAAe;IAwB7B,qGAAqG;YACvF,eAAe;IAe7B;;;;;;;;;OASG;IACU,uBAAuB,CAClC,OAAO,EAAE,6BAA6B,EACtC,KAAK,EAAE,eAAe,EACtB,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAoBhC,0FAA0F;YAC5E,eAAe;IAa7B;;;;;;;;;;;;OAYG;IACU,qBAAqB,CAChC,OAAO,EAAE,6BAA6B,EACtC,SAAS,EAAE,eAAe,EAC1B,SAAS,EAAE,eAAe,EAC1B,MAAM,EAAE,OAAO,CAAC,gBAAgB,CAAC,EACjC,IAAI,EAAE,eAAe,EACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC,GACjE,OAAO,CAAC,cAAc,CAAC;IAwB1B,6FAA6F;YAC/E,mBAAmB;IAYjC;;;;;;;;;OASG;IACI,iBAAiB,CACtB,SAAS,EAAE,eAAe,EAC1B,UAAU,EAAE,eAAe,EAC3B,MAAM,EAAE,gBAAgB,GACvB,oBAAoB;IAuBvB;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAOzB,4FAA4F;IAC5F,OAAO,CAAC,kBAAkB;IAO1B,+FAA+F;IAC/F,OAAO,CAAC,qBAAqB;IAyB7B;;;;;;;;;;;OAWG;IACU,kBAAkB,CAC7B,QAAQ,EAAE,6BAA6B,EAAE,EACzC,MAAM,EAAE,OAAO,CAAC,gBAAgB,CAAC,EACjC,IAAI,EAAE,eAAe,EACrB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,qBAAqB,CAAC;IAWjC,8EAA8E;YAChE,WAAW;IAuCzB,2DAA2D;IAC3D,OAAO,CAAC,aAAa;IA0BrB,gDAAgD;IAChD,OAAO,CAAC,aAAa;IAIrB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAQxB,2FAA2F;YAC7E,WAAW;CAO1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,6BAA6B,EAAE,EACzC,MAAM,EAAE,OAAO,CAAC,gBAAgB,CAAC,EACjC,IAAI,EAAE,eAAe,EACrB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CAEhC;AAmBD,iFAAiF;AACjF,YAAY,EAAE,QAAQ,EAAE,CAAC"}
|