@memberjunction/predictive-studio 6.2.1 → 6.3.0-edge.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 +16 -11
- package/dist/actions/base-predictive-studio.action.d.ts +7 -0
- package/dist/actions/base-predictive-studio.action.d.ts.map +1 -1
- package/dist/actions/base-predictive-studio.action.js +22 -0
- package/dist/actions/base-predictive-studio.action.js.map +1 -1
- package/dist/actions/driver-classes.d.ts +2 -0
- package/dist/actions/driver-classes.d.ts.map +1 -1
- package/dist/actions/driver-classes.js +2 -0
- package/dist/actions/driver-classes.js.map +1 -1
- package/dist/actions/evaluate-drift.action.d.ts +100 -0
- package/dist/actions/evaluate-drift.action.d.ts.map +1 -0
- package/dist/actions/evaluate-drift.action.js +512 -0
- package/dist/actions/evaluate-drift.action.js.map +1 -0
- package/dist/actions/index.d.ts +3 -0
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +7 -0
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/migrate-pipelines.action.d.ts +19 -0
- package/dist/actions/migrate-pipelines.action.d.ts.map +1 -0
- package/dist/actions/migrate-pipelines.action.js +51 -0
- package/dist/actions/migrate-pipelines.action.js.map +1 -0
- package/dist/actions/promote-model.action.d.ts +12 -1
- package/dist/actions/promote-model.action.d.ts.map +1 -1
- package/dist/actions/promote-model.action.js +7 -2
- package/dist/actions/promote-model.action.js.map +1 -1
- package/dist/actions/promote-model.gate.d.ts +31 -2
- package/dist/actions/promote-model.gate.d.ts.map +1 -1
- package/dist/actions/promote-model.gate.js +84 -5
- package/dist/actions/promote-model.gate.js.map +1 -1
- package/dist/actions/run-experiment.action.d.ts.map +1 -1
- package/dist/actions/run-experiment.action.js +5 -4
- package/dist/actions/run-experiment.action.js.map +1 -1
- package/dist/actions/schedule-model-scoring.action.js +2 -2
- package/dist/actions/schedule-model-scoring.action.js.map +1 -1
- package/dist/actions/score-record-set.action.js +1 -1
- package/dist/actions/score-record-set.action.js.map +1 -1
- package/dist/actions/score-record-set.runner.d.ts +2 -2
- package/dist/actions/score-record-set.runner.js +3 -3
- package/dist/actions/score-record-set.runner.js.map +1 -1
- package/dist/actions/train-model.action.d.ts +28 -25
- package/dist/actions/train-model.action.d.ts.map +1 -1
- package/dist/actions/train-model.action.js +50 -39
- package/dist/actions/train-model.action.js.map +1 -1
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/agent/modeling-plan-to-pipeline.d.ts +0 -2
- package/dist/agent/modeling-plan-to-pipeline.d.ts.map +1 -1
- package/dist/agent/modeling-plan-to-pipeline.js +30 -39
- package/dist/agent/modeling-plan-to-pipeline.js.map +1 -1
- package/dist/agent/pipeline-builder-agent.d.ts +47 -18
- package/dist/agent/pipeline-builder-agent.d.ts.map +1 -1
- package/dist/agent/pipeline-builder-agent.js +161 -92
- package/dist/agent/pipeline-builder-agent.js.map +1 -1
- package/dist/agent/pipeline-builder.d.ts +178 -56
- package/dist/agent/pipeline-builder.d.ts.map +1 -1
- package/dist/agent/pipeline-builder.js +333 -234
- package/dist/agent/pipeline-builder.js.map +1 -1
- package/dist/experiment/budget.d.ts +61 -0
- package/dist/experiment/budget.d.ts.map +1 -0
- package/dist/experiment/budget.js +72 -0
- package/dist/experiment/budget.js.map +1 -0
- package/dist/experiment/experiment-orchestrator.d.ts +43 -7
- package/dist/experiment/experiment-orchestrator.d.ts.map +1 -1
- package/dist/experiment/experiment-orchestrator.js +130 -33
- package/dist/experiment/experiment-orchestrator.js.map +1 -1
- package/dist/experiment/index.d.ts +2 -0
- package/dist/experiment/index.d.ts.map +1 -1
- package/dist/experiment/index.js +2 -0
- package/dist/experiment/index.js.map +1 -1
- package/dist/experiment/leaderboard.d.ts +15 -15
- package/dist/experiment/leaderboard.d.ts.map +1 -1
- package/dist/experiment/leaderboard.js +44 -18
- package/dist/experiment/leaderboard.js.map +1 -1
- package/dist/experiment/scores.d.ts +32 -0
- package/dist/experiment/scores.d.ts.map +1 -0
- package/dist/experiment/scores.js +62 -0
- package/dist/experiment/scores.js.map +1 -0
- package/dist/experiment/seams.d.ts +23 -20
- package/dist/experiment/seams.d.ts.map +1 -1
- package/dist/experiment/seams.js +54 -56
- package/dist/experiment/seams.js.map +1 -1
- package/dist/experiment/types.d.ts +55 -10
- package/dist/experiment/types.d.ts.map +1 -1
- package/dist/experiment/types.js.map +1 -1
- package/dist/feature-assembly/as-of/as-of-assembler.d.ts +412 -0
- package/dist/feature-assembly/as-of/as-of-assembler.d.ts.map +1 -0
- package/dist/feature-assembly/as-of/as-of-assembler.js +1239 -0
- package/dist/feature-assembly/as-of/as-of-assembler.js.map +1 -0
- package/dist/feature-assembly/as-of/feature-resolution.d.ts +84 -0
- package/dist/feature-assembly/as-of/feature-resolution.d.ts.map +1 -0
- package/dist/feature-assembly/as-of/feature-resolution.js +229 -0
- package/dist/feature-assembly/as-of/feature-resolution.js.map +1 -0
- package/dist/feature-assembly/as-of/index.d.ts +15 -0
- package/dist/feature-assembly/as-of/index.d.ts.map +1 -0
- package/dist/feature-assembly/as-of/index.js +15 -0
- package/dist/feature-assembly/as-of/index.js.map +1 -0
- package/dist/feature-assembly/as-of/read-by-keys.d.ts +30 -0
- package/dist/feature-assembly/as-of/read-by-keys.d.ts.map +1 -0
- package/dist/feature-assembly/as-of/read-by-keys.js +51 -0
- package/dist/feature-assembly/as-of/read-by-keys.js.map +1 -0
- package/dist/feature-assembly/as-of/record-history.d.ts +256 -0
- package/dist/feature-assembly/as-of/record-history.d.ts.map +1 -0
- package/dist/feature-assembly/as-of/record-history.js +505 -0
- package/dist/feature-assembly/as-of/record-history.js.map +1 -0
- package/dist/feature-assembly/as-of/refusal.d.ts +19 -0
- package/dist/feature-assembly/as-of/refusal.d.ts.map +1 -0
- package/dist/feature-assembly/as-of/refusal.js +13 -0
- package/dist/feature-assembly/as-of/refusal.js.map +1 -0
- package/dist/feature-assembly/as-of/series-features.d.ts +65 -0
- package/dist/feature-assembly/as-of/series-features.d.ts.map +1 -0
- package/dist/feature-assembly/as-of/series-features.js +97 -0
- package/dist/feature-assembly/as-of/series-features.js.map +1 -0
- package/dist/feature-assembly/as-of/windowed-aggregate.d.ts +36 -0
- package/dist/feature-assembly/as-of/windowed-aggregate.d.ts.map +1 -0
- package/dist/feature-assembly/as-of/windowed-aggregate.js +99 -0
- package/dist/feature-assembly/as-of/windowed-aggregate.js.map +1 -0
- package/dist/feature-assembly/as-of.d.ts +1 -9
- package/dist/feature-assembly/as-of.d.ts.map +1 -1
- package/dist/feature-assembly/as-of.js +2 -19
- package/dist/feature-assembly/as-of.js.map +1 -1
- package/dist/feature-assembly/assembly-metadata.d.ts +34 -0
- package/dist/feature-assembly/assembly-metadata.d.ts.map +1 -0
- package/dist/feature-assembly/assembly-metadata.js +26 -0
- package/dist/feature-assembly/assembly-metadata.js.map +1 -0
- package/dist/feature-assembly/data-access.d.ts +21 -2
- package/dist/feature-assembly/data-access.d.ts.map +1 -1
- package/dist/feature-assembly/data-access.js +14 -0
- package/dist/feature-assembly/data-access.js.map +1 -1
- package/dist/feature-assembly/feature-assembly-executor.d.ts.map +1 -1
- package/dist/feature-assembly/feature-assembly-executor.js +5 -2
- package/dist/feature-assembly/feature-assembly-executor.js.map +1 -1
- package/dist/feature-assembly/index.d.ts +3 -0
- package/dist/feature-assembly/index.d.ts.map +1 -1
- package/dist/feature-assembly/index.js +3 -0
- package/dist/feature-assembly/index.js.map +1 -1
- package/dist/feature-assembly/leakage-guard.d.ts +1 -1
- package/dist/feature-assembly/leakage-guard.js +1 -1
- package/dist/feature-assembly/read-policy.d.ts +27 -0
- package/dist/feature-assembly/read-policy.d.ts.map +1 -0
- package/dist/feature-assembly/read-policy.js +63 -0
- package/dist/feature-assembly/read-policy.js.map +1 -0
- package/dist/feature-pipelines/feature-pipeline-engine.d.ts.map +1 -1
- package/dist/feature-pipelines/feature-pipeline-engine.js +3 -1
- package/dist/feature-pipelines/feature-pipeline-engine.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/dist/maintenance/index.d.ts +1 -0
- package/dist/maintenance/index.d.ts.map +1 -1
- package/dist/maintenance/index.js +1 -0
- package/dist/maintenance/index.js.map +1 -1
- package/dist/maintenance/maintenance-engine.d.ts +16 -19
- package/dist/maintenance/maintenance-engine.d.ts.map +1 -1
- package/dist/maintenance/maintenance-engine.js +53 -53
- package/dist/maintenance/maintenance-engine.js.map +1 -1
- package/dist/maintenance/metrics.d.ts +19 -15
- package/dist/maintenance/metrics.d.ts.map +1 -1
- package/dist/maintenance/metrics.js +29 -24
- package/dist/maintenance/metrics.js.map +1 -1
- package/dist/maintenance/psi-drift-detector.d.ts +246 -0
- package/dist/maintenance/psi-drift-detector.d.ts.map +1 -0
- package/dist/maintenance/psi-drift-detector.js +1002 -0
- package/dist/maintenance/psi-drift-detector.js.map +1 -0
- package/dist/maintenance/types.d.ts +11 -2
- package/dist/maintenance/types.d.ts.map +1 -1
- package/dist/maintenance/types.js.map +1 -1
- package/dist/migration/index.d.ts +8 -0
- package/dist/migration/index.d.ts.map +1 -0
- package/dist/migration/index.js +8 -0
- package/dist/migration/index.js.map +1 -0
- package/dist/migration/legacy-pipeline-migration.d.ts +138 -0
- package/dist/migration/legacy-pipeline-migration.d.ts.map +1 -0
- package/dist/migration/legacy-pipeline-migration.js +273 -0
- package/dist/migration/legacy-pipeline-migration.js.map +1 -0
- package/dist/operations/delegation.d.ts +58 -46
- package/dist/operations/delegation.d.ts.map +1 -1
- package/dist/operations/delegation.js +90 -77
- package/dist/operations/delegation.js.map +1 -1
- package/dist/operations/promote-model.operation.d.ts +2 -2
- package/dist/operations/promote-model.operation.d.ts.map +1 -1
- package/dist/operations/promote-model.operation.js +6 -2
- package/dist/operations/promote-model.operation.js.map +1 -1
- package/dist/operations/refusals.d.ts +5 -0
- package/dist/operations/refusals.d.ts.map +1 -1
- package/dist/operations/refusals.js +26 -1
- package/dist/operations/refusals.js.map +1 -1
- package/dist/operations/start-experiment-session.operation.js +3 -3
- package/dist/operations/train-model.mapping.d.ts +91 -0
- package/dist/operations/train-model.mapping.d.ts.map +1 -0
- package/dist/operations/train-model.mapping.js +145 -0
- package/dist/operations/train-model.mapping.js.map +1 -0
- package/dist/operations/train-model.operation.d.ts +14 -9
- package/dist/operations/train-model.operation.d.ts.map +1 -1
- package/dist/operations/train-model.operation.js +30 -51
- package/dist/operations/train-model.operation.js.map +1 -1
- package/dist/prediction-unit/decision-date-advance.d.ts +46 -0
- package/dist/prediction-unit/decision-date-advance.d.ts.map +1 -0
- package/dist/prediction-unit/decision-date-advance.js +79 -0
- package/dist/prediction-unit/decision-date-advance.js.map +1 -0
- package/dist/prediction-unit/index.d.ts +12 -0
- package/dist/prediction-unit/index.d.ts.map +1 -0
- package/dist/prediction-unit/index.js +12 -0
- package/dist/prediction-unit/index.js.map +1 -0
- package/dist/prediction-unit/target-validation.d.ts +21 -0
- package/dist/prediction-unit/target-validation.d.ts.map +1 -0
- package/dist/prediction-unit/target-validation.js +54 -0
- package/dist/prediction-unit/target-validation.js.map +1 -0
- package/dist/prediction-unit/unit-row-reader.d.ts +108 -0
- package/dist/prediction-unit/unit-row-reader.d.ts.map +1 -0
- package/dist/prediction-unit/unit-row-reader.js +348 -0
- package/dist/prediction-unit/unit-row-reader.js.map +1 -0
- package/dist/prediction-unit/unit-store.d.ts +28 -0
- package/dist/prediction-unit/unit-store.d.ts.map +1 -0
- package/dist/prediction-unit/unit-store.js +41 -0
- package/dist/prediction-unit/unit-store.js.map +1 -0
- package/dist/prediction-unit/unit-versioning.d.ts +43 -0
- package/dist/prediction-unit/unit-versioning.d.ts.map +1 -0
- package/dist/prediction-unit/unit-versioning.js +71 -0
- package/dist/prediction-unit/unit-versioning.js.map +1 -0
- package/dist/protocol/index.d.ts +9 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +9 -0
- package/dist/protocol/index.js.map +1 -0
- package/dist/protocol/protocol-defaults.d.ts +37 -0
- package/dist/protocol/protocol-defaults.d.ts.map +1 -0
- package/dist/protocol/protocol-defaults.js +59 -0
- package/dist/protocol/protocol-defaults.js.map +1 -0
- package/dist/protocol/protocol-versioning.d.ts +46 -0
- package/dist/protocol/protocol-versioning.d.ts.map +1 -0
- package/dist/protocol/protocol-versioning.js +48 -0
- package/dist/protocol/protocol-versioning.js.map +1 -0
- package/dist/protocol/search-guard.d.ts +45 -0
- package/dist/protocol/search-guard.d.ts.map +1 -0
- package/dist/protocol/search-guard.js +50 -0
- package/dist/protocol/search-guard.js.map +1 -0
- package/dist/scoring/artifact-loader.d.ts +5 -32
- package/dist/scoring/artifact-loader.d.ts.map +1 -1
- package/dist/scoring/artifact-loader.js +4 -59
- package/dist/scoring/artifact-loader.js.map +1 -1
- package/dist/scoring/auto-train.d.ts +25 -5
- package/dist/scoring/auto-train.d.ts.map +1 -1
- package/dist/scoring/auto-train.js +48 -31
- package/dist/scoring/auto-train.js.map +1 -1
- package/dist/scoring/index.d.ts +3 -0
- package/dist/scoring/index.d.ts.map +1 -1
- package/dist/scoring/index.js +3 -0
- package/dist/scoring/index.js.map +1 -1
- package/dist/scoring/ml-model-inference-processor.d.ts +137 -10
- package/dist/scoring/ml-model-inference-processor.d.ts.map +1 -1
- package/dist/scoring/ml-model-inference-processor.js +383 -40
- package/dist/scoring/ml-model-inference-processor.js.map +1 -1
- package/dist/scoring/model-readiness.d.ts +45 -0
- package/dist/scoring/model-readiness.d.ts.map +1 -1
- package/dist/scoring/model-readiness.js +49 -0
- package/dist/scoring/model-readiness.js.map +1 -1
- package/dist/scoring/register.d.ts +8 -3
- package/dist/scoring/register.d.ts.map +1 -1
- package/dist/scoring/register.js +28 -4
- package/dist/scoring/register.js.map +1 -1
- package/dist/scoring/seams.d.ts +18 -2
- package/dist/scoring/seams.d.ts.map +1 -1
- package/dist/scoring/seams.js +35 -10
- package/dist/scoring/seams.js.map +1 -1
- package/dist/scoring/shadow-scoring.d.ts +245 -0
- package/dist/scoring/shadow-scoring.d.ts.map +1 -0
- package/dist/scoring/shadow-scoring.js +510 -0
- package/dist/scoring/shadow-scoring.js.map +1 -0
- package/dist/scoring/startup-register.d.ts +3 -3
- package/dist/scoring/startup-register.d.ts.map +1 -1
- package/dist/scoring/startup-register.js +10 -4
- package/dist/scoring/startup-register.js.map +1 -1
- package/dist/scoring/storage-provider-artifact-loader.d.ts +14 -0
- package/dist/scoring/storage-provider-artifact-loader.d.ts.map +1 -0
- package/dist/scoring/storage-provider-artifact-loader.js +47 -0
- package/dist/scoring/storage-provider-artifact-loader.js.map +1 -0
- package/dist/scoring/training-keys.d.ts +27 -0
- package/dist/scoring/training-keys.d.ts.map +1 -0
- package/dist/scoring/training-keys.js +54 -0
- package/dist/scoring/training-keys.js.map +1 -0
- package/dist/scoring/types.d.ts +72 -7
- package/dist/scoring/types.d.ts.map +1 -1
- package/dist/scoring/types.js +4 -0
- package/dist/scoring/types.js.map +1 -1
- package/dist/sidecar-provider.d.ts +2 -2
- package/dist/sidecar-provider.js +3 -3
- package/dist/snapshot/code-version.d.ts +16 -0
- package/dist/snapshot/code-version.d.ts.map +1 -0
- package/dist/snapshot/code-version.js +39 -0
- package/dist/snapshot/code-version.js.map +1 -0
- package/dist/snapshot/holdout-carver.d.ts +110 -0
- package/dist/snapshot/holdout-carver.d.ts.map +1 -0
- package/dist/snapshot/holdout-carver.js +171 -0
- package/dist/snapshot/holdout-carver.js.map +1 -0
- package/dist/snapshot/index.d.ts +17 -0
- package/dist/snapshot/index.d.ts.map +1 -0
- package/dist/snapshot/index.js +17 -0
- package/dist/snapshot/index.js.map +1 -0
- package/dist/snapshot/snapshot-builder.d.ts +152 -0
- package/dist/snapshot/snapshot-builder.d.ts.map +1 -0
- package/dist/snapshot/snapshot-builder.js +286 -0
- package/dist/snapshot/snapshot-builder.js.map +1 -0
- package/dist/snapshot/snapshot-file-store.d.ts +161 -0
- package/dist/snapshot/snapshot-file-store.d.ts.map +1 -0
- package/dist/snapshot/snapshot-file-store.js +204 -0
- package/dist/snapshot/snapshot-file-store.js.map +1 -0
- package/dist/snapshot/snapshot-hash.d.ts +6 -0
- package/dist/snapshot/snapshot-hash.d.ts.map +1 -0
- package/dist/snapshot/snapshot-hash.js +16 -0
- package/dist/snapshot/snapshot-hash.js.map +1 -0
- package/dist/snapshot/snapshot-manifest.d.ts +43 -0
- package/dist/snapshot/snapshot-manifest.d.ts.map +1 -0
- package/dist/snapshot/snapshot-manifest.js +43 -0
- package/dist/snapshot/snapshot-manifest.js.map +1 -0
- package/dist/snapshot/snapshot-retrainer.d.ts +107 -0
- package/dist/snapshot/snapshot-retrainer.d.ts.map +1 -0
- package/dist/snapshot/snapshot-retrainer.js +194 -0
- package/dist/snapshot/snapshot-retrainer.js.map +1 -0
- package/dist/snapshot/snapshot-serialization.d.ts +99 -0
- package/dist/snapshot/snapshot-serialization.d.ts.map +1 -0
- package/dist/snapshot/snapshot-serialization.js +191 -0
- package/dist/snapshot/snapshot-serialization.js.map +1 -0
- package/dist/snapshot/training-snapshot-store.d.ts +38 -0
- package/dist/snapshot/training-snapshot-store.d.ts.map +1 -0
- package/dist/snapshot/training-snapshot-store.js +41 -0
- package/dist/snapshot/training-snapshot-store.js.map +1 -0
- package/dist/storage/ps-storage-provider.d.ts +108 -0
- package/dist/storage/ps-storage-provider.d.ts.map +1 -0
- package/dist/storage/ps-storage-provider.js +154 -0
- package/dist/storage/ps-storage-provider.js.map +1 -0
- package/dist/training/artifact-store.d.ts +12 -103
- package/dist/training/artifact-store.d.ts.map +1 -1
- package/dist/training/artifact-store.js +13 -137
- package/dist/training/artifact-store.js.map +1 -1
- package/dist/training/compute-cost.d.ts +23 -0
- package/dist/training/compute-cost.d.ts.map +1 -0
- package/dist/training/compute-cost.js +36 -0
- package/dist/training/compute-cost.js.map +1 -0
- package/dist/training/evaluation-protocol-store.d.ts +53 -0
- package/dist/training/evaluation-protocol-store.d.ts.map +1 -0
- package/dist/training/evaluation-protocol-store.js +54 -0
- package/dist/training/evaluation-protocol-store.js.map +1 -0
- package/dist/training/index.d.ts +9 -1
- package/dist/training/index.d.ts.map +1 -1
- package/dist/training/index.js +9 -1
- package/dist/training/index.js.map +1 -1
- package/dist/training/locked-holdout.d.ts +19 -4
- package/dist/training/locked-holdout.d.ts.map +1 -1
- package/dist/training/locked-holdout.js +29 -5
- package/dist/training/locked-holdout.js.map +1 -1
- package/dist/training/seams.d.ts +34 -8
- package/dist/training/seams.d.ts.map +1 -1
- package/dist/training/seams.js +74 -18
- package/dist/training/seams.js.map +1 -1
- package/dist/training/storage-provider-artifact-store.d.ts +49 -0
- package/dist/training/storage-provider-artifact-store.d.ts.map +1 -0
- package/dist/training/storage-provider-artifact-store.js +147 -0
- package/dist/training/storage-provider-artifact-store.js.map +1 -0
- package/dist/training/trainer-model-lineage.d.ts +32 -0
- package/dist/training/trainer-model-lineage.d.ts.map +1 -0
- package/dist/training/trainer-model-lineage.js +62 -0
- package/dist/training/trainer-model-lineage.js.map +1 -0
- package/dist/training/trainer-request.d.ts +50 -0
- package/dist/training/trainer-request.d.ts.map +1 -0
- package/dist/training/trainer-request.js +65 -0
- package/dist/training/trainer-request.js.map +1 -0
- package/dist/training/trainer-result.d.ts +30 -0
- package/dist/training/trainer-result.d.ts.map +1 -0
- package/dist/training/trainer-result.js +40 -0
- package/dist/training/trainer-result.js.map +1 -0
- package/dist/training/training-engine.d.ts +417 -64
- package/dist/training/training-engine.d.ts.map +1 -1
- package/dist/training/training-engine.js +869 -178
- package/dist/training/training-engine.js.map +1 -1
- package/dist/training/training-refusal.d.ts +15 -0
- package/dist/training/training-refusal.d.ts.map +1 -0
- package/dist/training/training-refusal.js +62 -0
- package/dist/training/training-refusal.js.map +1 -0
- package/dist/training/types.d.ts +133 -41
- package/dist/training/types.d.ts.map +1 -1
- package/dist/training/types.js +4 -4
- package/dist/training/unit-model-lineage.d.ts +72 -0
- package/dist/training/unit-model-lineage.d.ts.map +1 -0
- package/dist/training/unit-model-lineage.js +288 -0
- package/dist/training/unit-model-lineage.js.map +1 -0
- package/package.json +16 -13
- package/dist/operations/__tests__/helpers.d.ts +0 -30
- package/dist/operations/__tests__/helpers.d.ts.map +0 -1
- package/dist/operations/__tests__/helpers.js +0 -44
- package/dist/operations/__tests__/helpers.js.map +0 -1
|
@@ -5,183 +5,70 @@
|
|
|
5
5
|
* of Database Designer's schema builder and Agent Manager's `AgentSpecSync`. It takes an approved,
|
|
6
6
|
* strongly-typed {@link ModelingPlanSpec} and, in pure code (NO LLM), crafts the actual metadata:
|
|
7
7
|
* creates the `MJ: ML Training Pipelines` row, kicks off training, then **publishes the model only
|
|
8
|
-
* if the trust verdict clears the bar** — the same `TrustVerdicts.DeriveTrustVerdict`
|
|
9
|
-
*
|
|
8
|
+
* if the trust verdict clears the bar** — the same `TrustVerdicts.DeriveTrustVerdict` rendering of the training run's
|
|
9
|
+
* stored gate decision the business UI uses, so a model the gate did not ship, a model trained without an Evaluation
|
|
10
|
+
* Protocol (not evaluated), a leakage-flagged model or a calibration-held model is never silently published into the
|
|
11
|
+
* catalog. Publishing goes through the promotion gate (`ProductionModelPromotionGate`: Draft → Validated → Published,
|
|
12
|
+
* with no sign-off), so its readiness checks and the per-model scoring Action apply; a refusal holds the model with
|
|
13
|
+
* the gate's reason.
|
|
14
|
+
*
|
|
15
|
+
* Every approved experiment is a candidate of ONE search on ONE pipeline. The saved pipeline is bound to version 1 of
|
|
16
|
+
* a Prediction Unit mapped from the plan's target (the pipeline migration's mapping; a target the mapping would archive
|
|
17
|
+
* or hold is refused) and to an Evaluation Protocol before it trains, and the trainer picks the finalist on inner-fold
|
|
18
|
+
* scores (the simplest candidate within one standard error of the best), reading the held-back rows once, for the
|
|
19
|
+
* finalist.
|
|
10
20
|
*
|
|
11
21
|
* Used by the agent's builder sub-agent AND directly callable from a headless script/test, so the
|
|
12
22
|
* "build a new prediction" path is verifiable without the full LLM loop.
|
|
13
23
|
*/
|
|
14
|
-
import { UUIDsEqual } from '@memberjunction/global';
|
|
15
|
-
import { RunView, LogError } from '@memberjunction/core';
|
|
16
|
-
import { TrustVerdicts } from '@memberjunction/predictive-studio-core';
|
|
24
|
+
import { NormalizeUUID, UUIDsEqual } from '@memberjunction/global';
|
|
25
|
+
import { RunView, LogError, LogStatus } from '@memberjunction/core';
|
|
26
|
+
import { EvaluationProtocolRules, InnerScoreSelection, UtcDay, PredictionUnit, TrainingRunResultsParser, TrustVerdicts, } from '@memberjunction/predictive-studio-core';
|
|
17
27
|
import { ModelingPlanToPipelineConfig } from './modeling-plan-to-pipeline.js';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
ModelID: t.Model.ID,
|
|
51
|
-
rank: idx + 1,
|
|
52
|
-
algorithm: t.AlgorithmName,
|
|
53
|
-
featureSet: t.FeatureSetName,
|
|
54
|
-
score,
|
|
55
|
-
metricName: t.Trust.headlineMetric ? t.Trust.headlineMetric.key : null,
|
|
56
|
-
modelId: t.Model.ID,
|
|
57
|
-
isWinner: idx === 0 && score !== null,
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* The error a tournament throws when every candidate failed. When every candidate hit the same Predictive Studio
|
|
63
|
-
* refusal, the first one is rethrown so its type and code survive; otherwise one error lists each distinct message.
|
|
64
|
-
*/
|
|
65
|
-
static AllCandidatesFailed(errors) {
|
|
66
|
-
const codes = errors.map((e) => PredictiveStudioRefusals.CodeOf(e));
|
|
67
|
-
const first = codes[0];
|
|
68
|
-
if (first !== null && first !== undefined && codes.every((c) => c === first)) {
|
|
69
|
-
return errors[0];
|
|
70
|
-
}
|
|
71
|
-
const distinct = [...new Set(errors.map((e) => e.message))];
|
|
72
|
-
return new Error(`All proposed experiment candidates failed to train: ${distinct.join(' | ')}`);
|
|
73
|
-
}
|
|
28
|
+
import { TrainingDelegation, WasTrainingLeakageFlagged } from '../operations/delegation.js';
|
|
29
|
+
import { ProductionModelPromotionGate } from '../actions/promote-model.gate.js';
|
|
30
|
+
import { TrainerModelLineageReader } from '../training/trainer-model-lineage.js';
|
|
31
|
+
import { TrainingEngine } from '../training/training-engine.js';
|
|
32
|
+
import { MetadataEntityFactory } from '../training/seams.js';
|
|
33
|
+
import { EvaluationProtocolVersioning } from '../protocol/protocol-versioning.js';
|
|
34
|
+
import { ProtocolDefaults } from '../protocol/protocol-defaults.js';
|
|
35
|
+
import { RunViewDataAccess } from '../feature-assembly/data-access.js';
|
|
36
|
+
import { ProviderAssemblyMetadata } from '../feature-assembly/assembly-metadata.js';
|
|
37
|
+
import { PipelineMigration } from '../migration/legacy-pipeline-migration.js';
|
|
38
|
+
/** Baseline member names a candidate may not take (with the `heuristic:` prefix); the sidecar refuses them too. */
|
|
39
|
+
export const RESERVED_CANDIDATE_NAMES = ['dummy', 'oneFeature', 'glm', 'naive', 'seasonalNaive'];
|
|
40
|
+
/** The prefix of the incumbent-heuristic baseline members' names, reserved like {@link RESERVED_CANDIDATE_NAMES}. */
|
|
41
|
+
export const RESERVED_CANDIDATE_PREFIX = 'heuristic:';
|
|
42
|
+
/** Common short names an LLM writes for an algorithm, read as the normalized name of the algorithm they mean. */
|
|
43
|
+
const ALGORITHM_ALIASES = {
|
|
44
|
+
linearregression: 'ridgeregression',
|
|
45
|
+
linear: 'ridgeregression',
|
|
46
|
+
ols: 'ridgeregression',
|
|
47
|
+
ridge: 'ridgeregression',
|
|
48
|
+
logistic: 'logisticregression',
|
|
49
|
+
rf: 'randomforest',
|
|
50
|
+
lgb: 'lightgbm',
|
|
51
|
+
lgbm: 'lightgbm',
|
|
52
|
+
xgb: 'xgboost',
|
|
53
|
+
mlp: 'multilayerperceptron',
|
|
54
|
+
neuralnet: 'multilayerperceptron',
|
|
55
|
+
neuralnetwork: 'multilayerperceptron',
|
|
56
|
+
};
|
|
57
|
+
/** A name as the tolerant matchers compare it: lower-case letters and digits only (`Random Forest` → `randomforest`). */
|
|
58
|
+
function normalizeName(s) {
|
|
59
|
+
return (s || '').toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
74
60
|
}
|
|
75
61
|
/** Deterministic builder: approved {@link ModelingPlanSpec} → pipeline + trained (+ maybe published) model. */
|
|
76
62
|
export class PredictiveStudioPipelineBuilder {
|
|
77
63
|
/**
|
|
78
|
-
* Build a prediction from an approved plan: create
|
|
79
|
-
* verdict clears the bar.
|
|
80
|
-
* across up to 3 candidates, ranks them on each one's trust-verdict headline metric (unmeasured
|
|
81
|
-
* candidates last, never the winner), and selects/publishes the winning model.
|
|
64
|
+
* Build a prediction from an approved plan: create one pipeline, bind its Prediction Unit, train it — one search
|
|
65
|
+
* over every approved experiment — and publish if the trust verdict clears the bar. Every experiment's name and algorithm are checked before any row is written.
|
|
82
66
|
* Never throws — returns a typed result with `success`/`errorMessage`.
|
|
83
67
|
*/
|
|
84
68
|
async Build(input) {
|
|
85
|
-
const
|
|
86
|
-
const collectedWarnings = [];
|
|
87
|
-
const seenWarningKeys = new Set();
|
|
88
|
-
const recordWarnings = (warnings) => {
|
|
89
|
-
for (const w of warnings) {
|
|
90
|
-
const key = `${w.FeatureName}:${w.Kind}`;
|
|
91
|
-
if (!seenWarningKeys.has(key)) {
|
|
92
|
-
seenWarningKeys.add(key);
|
|
93
|
-
collectedWarnings.push(w);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
};
|
|
69
|
+
const warnings = [];
|
|
97
70
|
try {
|
|
98
|
-
|
|
99
|
-
? [...spec.ProposedExperiments].sort((a, b) => (a.Priority ?? 0) - (b.Priority ?? 0))
|
|
100
|
-
: [];
|
|
101
|
-
if (experiments.length <= 1) {
|
|
102
|
-
const config = ModelingPlanToPipelineConfig(spec);
|
|
103
|
-
recordWarnings(config.warnings);
|
|
104
|
-
const pipeline = await this.createPipeline(config, provider, user);
|
|
105
|
-
const trainResult = await trainModelViaEngine({ pipelineId: pipeline.ID, sidecarVersion }, provider, user);
|
|
106
|
-
const model = trainResult.model;
|
|
107
|
-
const trust = TrustVerdicts.DeriveTrustVerdict(model);
|
|
108
|
-
const leakageFlagged = wasTrainingLeakageFlagged(trainResult);
|
|
109
|
-
const { published, heldReason } = await this.maybePublish(model, trust, leakageFlagged, autoPublish);
|
|
110
|
-
const leaderboard = TournamentRanking.Leaderboard([{
|
|
111
|
-
Pipeline: pipeline,
|
|
112
|
-
Model: model,
|
|
113
|
-
Trust: trust,
|
|
114
|
-
LeakageFlagged: leakageFlagged,
|
|
115
|
-
AlgorithmName: experiments[0]?.AlgorithmName ?? config.algorithmName,
|
|
116
|
-
FeatureSetName: experiments[0]?.FeatureSet?.join(', ') || 'Full Feature Set',
|
|
117
|
-
}]);
|
|
118
|
-
return {
|
|
119
|
-
success: true,
|
|
120
|
-
pipelineId: pipeline.ID,
|
|
121
|
-
modelId: model.ID,
|
|
122
|
-
model,
|
|
123
|
-
pipeline,
|
|
124
|
-
trust,
|
|
125
|
-
published,
|
|
126
|
-
leakageFlagged,
|
|
127
|
-
heldReason,
|
|
128
|
-
errorMessage: null,
|
|
129
|
-
leaderboard,
|
|
130
|
-
warnings: collectedWarnings.length > 0 ? collectedWarnings : undefined,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
// Multi-algorithm tournament over up to 3 candidate experiments
|
|
134
|
-
const candidatesToRun = experiments.slice(0, 3);
|
|
135
|
-
const trained = [];
|
|
136
|
-
const candidateErrors = [];
|
|
137
|
-
for (let i = 0; i < candidatesToRun.length; i++) {
|
|
138
|
-
const exp = candidatesToRun[i];
|
|
139
|
-
try {
|
|
140
|
-
const config = ModelingPlanToPipelineConfig(spec, i);
|
|
141
|
-
recordWarnings(config.warnings);
|
|
142
|
-
const pipeline = await this.createPipeline(config, provider, user);
|
|
143
|
-
const trainResult = await trainModelViaEngine({ pipelineId: pipeline.ID, sidecarVersion }, provider, user);
|
|
144
|
-
const model = trainResult.model;
|
|
145
|
-
const trust = TrustVerdicts.DeriveTrustVerdict(model);
|
|
146
|
-
const leakageFlagged = wasTrainingLeakageFlagged(trainResult);
|
|
147
|
-
trained.push({
|
|
148
|
-
Pipeline: pipeline,
|
|
149
|
-
Model: model,
|
|
150
|
-
Trust: trust,
|
|
151
|
-
LeakageFlagged: leakageFlagged,
|
|
152
|
-
AlgorithmName: exp.AlgorithmName || config.algorithmName,
|
|
153
|
-
FeatureSetName: exp.FeatureSet?.join(', ') || 'Full Feature Set',
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
catch (candidateErr) {
|
|
157
|
-
const error = candidateErr instanceof Error ? candidateErr : new Error(String(candidateErr));
|
|
158
|
-
candidateErrors.push(error);
|
|
159
|
-
LogError(`PredictiveStudioPipelineBuilder: candidate '${exp.AlgorithmName}' failed: ${error.message}`);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
if (trained.length === 0) {
|
|
163
|
-
throw TournamentRanking.AllCandidatesFailed(candidateErrors);
|
|
164
|
-
}
|
|
165
|
-
// Measured candidates best-first, unmeasured last. When none was measured there is no winner: the result
|
|
166
|
-
// still reports the top-priority candidate (held by the trust gate, which never lets an unmeasured model act).
|
|
167
|
-
const ranked = TournamentRanking.Rank(trained);
|
|
168
|
-
const winner = ranked[0];
|
|
169
|
-
const { published, heldReason } = await this.maybePublish(winner.Model, winner.Trust, winner.LeakageFlagged, autoPublish);
|
|
170
|
-
const leaderboard = TournamentRanking.Leaderboard(ranked);
|
|
171
|
-
return {
|
|
172
|
-
success: true,
|
|
173
|
-
pipelineId: winner.Pipeline.ID,
|
|
174
|
-
modelId: winner.Model.ID,
|
|
175
|
-
model: winner.Model,
|
|
176
|
-
pipeline: winner.Pipeline,
|
|
177
|
-
trust: winner.Trust,
|
|
178
|
-
published,
|
|
179
|
-
leakageFlagged: winner.LeakageFlagged,
|
|
180
|
-
heldReason,
|
|
181
|
-
errorMessage: null,
|
|
182
|
-
leaderboard,
|
|
183
|
-
warnings: collectedWarnings.length > 0 ? collectedWarnings : undefined,
|
|
184
|
-
};
|
|
71
|
+
return await this.runBuild(input, warnings);
|
|
185
72
|
}
|
|
186
73
|
catch (err) {
|
|
187
74
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
@@ -189,22 +76,230 @@ export class PredictiveStudioPipelineBuilder {
|
|
|
189
76
|
return {
|
|
190
77
|
success: false,
|
|
191
78
|
published: false,
|
|
79
|
+
readyToPublish: false,
|
|
192
80
|
leakageFlagged: false,
|
|
193
81
|
heldReason: null,
|
|
194
82
|
errorMessage,
|
|
195
|
-
warnings:
|
|
83
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
196
84
|
};
|
|
197
85
|
}
|
|
198
86
|
}
|
|
199
|
-
/**
|
|
200
|
-
|
|
201
|
-
|
|
87
|
+
/**
|
|
88
|
+
* The build's steps — resolve the plan, save and bind the pipeline, train one search, publish when the verdict
|
|
89
|
+
* clears the bar. Throws on any failure; the plan's feature-step warnings go into `warnings` first, so the failure
|
|
90
|
+
* result {@link Build} returns still carries them.
|
|
91
|
+
*/
|
|
92
|
+
async runBuild(input, warnings) {
|
|
93
|
+
const { spec, provider, user, autoPublish = true, sidecarVersion = 'predictive-studio-agent' } = input;
|
|
94
|
+
const config = ModelingPlanToPipelineConfig(spec);
|
|
95
|
+
warnings.push(...PredictiveStudioPipelineBuilder.DistinctWarnings(config.warnings));
|
|
96
|
+
const { Pipeline: pipeline, Candidates: candidates } = await this.createBoundPipeline(spec, config, provider, user);
|
|
97
|
+
const training = await this.trainSearch(pipeline, candidates, sidecarVersion, provider, user);
|
|
98
|
+
const model = training.Train.model;
|
|
99
|
+
if (model === null)
|
|
100
|
+
return PredictiveStudioPipelineBuilder.heldWithoutModel(pipeline, training, warnings);
|
|
101
|
+
const trust = TrustVerdicts.DeriveTrustVerdict({ ValidationResults: training.Train.run.ValidationResults, Lineage: model.Lineage });
|
|
102
|
+
const leakageFlagged = WasTrainingLeakageFlagged(training.Train);
|
|
103
|
+
const { published, heldReason, readyToPublish } = await this.maybePublish({ Model: model, Trust: trust, LeakageFlagged: leakageFlagged, AutoPublish: autoPublish, Provider: provider, User: user });
|
|
104
|
+
return {
|
|
105
|
+
success: true, pipelineId: pipeline.ID, modelId: model.ID, model, pipeline, trust, published, readyToPublish, leakageFlagged, heldReason,
|
|
106
|
+
errorMessage: null, leaderboard: training.Leaderboard, Gate: training.Gate || undefined,
|
|
107
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/** The warnings with one entry per feature and kind, first occurrence kept. */
|
|
111
|
+
static DistinctWarnings(warnings) {
|
|
112
|
+
const seen = new Set();
|
|
113
|
+
return warnings.filter((w) => {
|
|
114
|
+
const key = `${w.FeatureName}:${w.Kind}`;
|
|
115
|
+
if (seen.has(key))
|
|
116
|
+
return false;
|
|
117
|
+
seen.add(key);
|
|
118
|
+
return true;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Checks every approved experiment's name and algorithm, then saves the pipeline and binds its Prediction Unit; no
|
|
123
|
+
* row is written before the checks pass. Returns the saved pipeline and the search's candidates.
|
|
124
|
+
*/
|
|
125
|
+
async createBoundPipeline(spec, config, provider, user) {
|
|
126
|
+
const entity = this.preparePipelineConfig(config, provider);
|
|
127
|
+
const approved = PredictiveStudioPipelineBuilder.ApprovedExperiments(spec);
|
|
128
|
+
const algorithms = await this.resolveAlgorithms([config.algorithmName, ...approved.map((e) => e.AlgorithmName)], provider, user);
|
|
129
|
+
const candidates = PredictiveStudioPipelineBuilder.BuildCandidateSpecs(approved, algorithms);
|
|
130
|
+
if (approved.some((e) => (e.FeatureSet || []).length > 0)) {
|
|
131
|
+
LogStatus('PredictiveStudioPipelineBuilder: per-experiment feature sets are not candidates of one search; every candidate uses the pipeline feature schema.');
|
|
132
|
+
}
|
|
133
|
+
const pipeline = await this.savePipeline(config, entity, PredictiveStudioPipelineBuilder.algorithmOf(algorithms, config.algorithmName).ID, provider, user);
|
|
134
|
+
await PredictiveStudioPipelineBuilder.bindUnit(pipeline, provider, user);
|
|
135
|
+
return { Pipeline: pipeline, Candidates: candidates };
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The result of a build whose training run shipped no model (the gate decided `no-signal`, or kept the unit's existing
|
|
139
|
+
* rule): built, not published, held with the run's stored reason, and no trust verdict (there is no model to judge).
|
|
140
|
+
*/
|
|
141
|
+
static heldWithoutModel(pipeline, training, warnings) {
|
|
142
|
+
return {
|
|
143
|
+
success: true, pipelineId: pipeline.ID, pipeline, published: false, readyToPublish: false, leakageFlagged: WasTrainingLeakageFlagged(training.Train),
|
|
144
|
+
heldReason: `Not published — the training run shipped no model: ${TrainingEngine.NoModelReason(training.Train)}`,
|
|
145
|
+
errorMessage: null, leaderboard: training.Leaderboard, Gate: training.Gate || undefined,
|
|
146
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/** The plan's proposed experiments, highest priority (lowest `Priority`) first; ties keep plan order. */
|
|
150
|
+
static ApprovedExperiments(spec) {
|
|
151
|
+
return [...(spec.ProposedExperiments || [])]
|
|
152
|
+
.sort((a, b) => (a.Priority || 0) - (b.Priority || 0))
|
|
153
|
+
.map((e) => ({ ...e, AlgorithmName: e.AlgorithmName.trim() }));
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Every approved experiment becomes one candidate of the single search, in plan-priority order. A label a baseline
|
|
157
|
+
* member uses (or one with the heuristic prefix) and a label used twice are refused, as is an algorithm name that
|
|
158
|
+
* was not resolved. Hyperparameters keep their scalar values; nested objects are dropped.
|
|
159
|
+
*
|
|
160
|
+
* @throws Error naming the experiment
|
|
161
|
+
*/
|
|
162
|
+
static BuildCandidateSpecs(experiments, algorithms) {
|
|
163
|
+
const seen = new Set();
|
|
164
|
+
return experiments.map((e) => {
|
|
165
|
+
if (RESERVED_CANDIDATE_NAMES.includes(e.Label) || e.Label.startsWith(RESERVED_CANDIDATE_PREFIX)) {
|
|
166
|
+
throw new Error(`Experiment label '${e.Label}' is reserved for a baseline member; rename the experiment.`);
|
|
167
|
+
}
|
|
168
|
+
if (seen.has(e.Label))
|
|
169
|
+
throw new Error(`Experiment label '${e.Label}' is used by two experiments; every candidate of a search needs its own name.`);
|
|
170
|
+
seen.add(e.Label);
|
|
171
|
+
const algorithm = PredictiveStudioPipelineBuilder.algorithmOf(algorithms, e.AlgorithmName);
|
|
172
|
+
return { name: e.Label, algorithmId: algorithm.ID, driverKey: algorithm.DriverClass, hyperparameters: PredictiveStudioPipelineBuilder.scalarHyperparameters(e.Hyperparameters) };
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The `MJ: ML Algorithms` row an algorithm name means. Tolerant of LLM naming variation: the display `Name` or the
|
|
177
|
+
* `DriverClass` matches case- and separator-insensitively, and common short names (`rf`, `xgb`, `linear`, …) are
|
|
178
|
+
* read as the algorithm they name. Two different rows that both match are refused rather than one being picked.
|
|
179
|
+
*
|
|
180
|
+
* @throws Error listing the available algorithms when nothing matches, or naming both rows when two match
|
|
181
|
+
*/
|
|
182
|
+
static MatchAlgorithm(algorithmName, rows) {
|
|
183
|
+
const normalized = normalizeName(algorithmName);
|
|
184
|
+
const want = ALGORITHM_ALIASES[normalized] || normalized;
|
|
185
|
+
const matches = rows.filter((a) => normalizeName(a.Name) === want || normalizeName(a.DriverClass) === want);
|
|
186
|
+
if (matches.length === 0) {
|
|
187
|
+
const available = rows.map((a) => a.Name).join(', ');
|
|
188
|
+
throw new Error(`Algorithm '${algorithmName}' was not found in MJ: ML Algorithms. Available: ${available || '(none)'}.`);
|
|
189
|
+
}
|
|
190
|
+
if (matches.length > 1) {
|
|
191
|
+
const named = matches.map((a) => `'${a.Name}' (${a.DriverClass}, ${NormalizeUUID(a.ID)})`).join(' and ');
|
|
192
|
+
throw new Error(`Algorithm '${algorithmName}' matches more than one MJ: ML Algorithms row: ${named}; name the algorithm by one of them.`);
|
|
193
|
+
}
|
|
194
|
+
return { ID: matches[0].ID, DriverClass: matches[0].DriverClass };
|
|
195
|
+
}
|
|
196
|
+
/** The resolved algorithm of a name, which {@link resolveAlgorithms} resolved before any row was written. */
|
|
197
|
+
static algorithmOf(algorithms, name) {
|
|
198
|
+
const algorithm = algorithms.get(name);
|
|
199
|
+
if (algorithm === undefined)
|
|
200
|
+
throw new Error(`Algorithm '${name}' was not resolved.`);
|
|
201
|
+
return algorithm;
|
|
202
|
+
}
|
|
203
|
+
/** A plan experiment's hyperparameters as candidate values: scalars and null kept, nested objects and arrays dropped. */
|
|
204
|
+
static scalarHyperparameters(raw) {
|
|
205
|
+
const hyperparameters = {};
|
|
206
|
+
for (const [key, value] of Object.entries(raw || {})) {
|
|
207
|
+
if (PredictiveStudioPipelineBuilder.isHyperparameterValue(value))
|
|
208
|
+
hyperparameters[key] = value;
|
|
209
|
+
}
|
|
210
|
+
return hyperparameters;
|
|
211
|
+
}
|
|
212
|
+
/** A scalar or null: the values a candidate's hyperparameter can hold. */
|
|
213
|
+
static isHyperparameterValue(value) {
|
|
214
|
+
return value === null || typeof value === 'number' || typeof value === 'string' || typeof value === 'boolean';
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Bind version 1 of the pipeline's Prediction Unit, mapped from the columns the plan wrote (the pipeline migration's
|
|
218
|
+
* mapping), right after the pipeline is saved; its search protocol is bound later, for every candidate. A pipeline
|
|
219
|
+
* the mapping would archive or hold is refused with the mapping's reason, and the pipeline just saved is deleted: no
|
|
220
|
+
* pipeline trains without a unit, and the build leaves no unit-less Draft behind.
|
|
221
|
+
*
|
|
222
|
+
* @throws Error naming why the pipeline gets no unit (and the pipeline's ID when deleting it failed)
|
|
223
|
+
*/
|
|
224
|
+
static async bindUnit(pipeline, provider, user) {
|
|
225
|
+
const deps = { Provider: provider, User: user, EntityFactory: new MetadataEntityFactory(provider), Today: UtcDay.UtcDayIso(new Date()) };
|
|
226
|
+
const bound = await PipelineMigration.BindMigratedUnit(pipeline, deps);
|
|
227
|
+
if (bound.Ok === true)
|
|
228
|
+
return;
|
|
229
|
+
const id = pipeline.ID;
|
|
230
|
+
if (await pipeline.Delete())
|
|
231
|
+
throw new Error(`The pipeline gets no Prediction Unit, so it cannot train and was not kept: ${bound.Reason}`);
|
|
232
|
+
throw new Error(`The pipeline gets no Prediction Unit, so it cannot train (${bound.Reason}); deleting pipeline ${id} failed: ${pipeline.LatestResult?.CompleteMessage || 'Delete() returned false'}`);
|
|
202
233
|
}
|
|
203
|
-
/**
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
234
|
+
/**
|
|
235
|
+
* Train a pipeline with a Prediction Unit: bind its default Evaluation Protocol (before the run row), run ONE search
|
|
236
|
+
* over every candidate, and read the leaderboard from the stored inner-fold scores and the gate decision from the stored record.
|
|
237
|
+
*/
|
|
238
|
+
async trainSearch(pipeline, candidates, sidecarVersion, provider, user) {
|
|
239
|
+
await this.ensureProtocol(pipeline, candidates.length, provider, user);
|
|
240
|
+
const train = await TrainingDelegation.TrainModelViaEngine({ pipelineId: pipeline.ID, candidates, sidecarVersion }, provider, user);
|
|
241
|
+
return { Train: train, ...PredictiveStudioPipelineBuilder.searchResults(train) };
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* A search's leaderboard from the run's stored trainer result: every candidate best-first by inner-fold mean with its
|
|
245
|
+
* interval, each optimistic, the trainer's finalist the winner. The finalist's row links the model only when the gate
|
|
246
|
+
* shipped the finalist; a kept baseline member's model, or no model, links no candidate row. With it, the stored
|
|
247
|
+
* gate decision (outcome and reason), so a reader of the leaderboard knows whether the finalist shipped.
|
|
248
|
+
*
|
|
249
|
+
* @throws Error when the completed run stores no trainer result
|
|
250
|
+
*/
|
|
251
|
+
static searchResults(train) {
|
|
252
|
+
const results = TrainingRunResultsParser.ParseTrainingRunResults(train.run.ValidationResults);
|
|
253
|
+
if (!results.Ok || results.Value.status !== 'completed' || results.Value.trainer === null) {
|
|
254
|
+
throw new Error(`Training run ${train.run.ID} completed without a stored trainer result; its search has no leaderboard.`);
|
|
255
|
+
}
|
|
256
|
+
const trainer = results.Value.trainer;
|
|
257
|
+
const gate = results.Value.gate;
|
|
258
|
+
const finalistModelId = train.model !== null && gate !== null && gate.decision.outcome === 'model' ? train.model.ID : undefined;
|
|
259
|
+
const leaderboard = InnerScoreSelection.LeaderboardFromInnerScores(trainer.innerScores, trainer.finalist).map((row) => ({
|
|
260
|
+
IterationID: train.run.ID, Metric: row.Mean, ModelID: row.IsFinalist ? finalistModelId : undefined, rank: row.Rank, algorithm: row.Candidate,
|
|
261
|
+
featureSet: 'Pipeline feature set', score: row.Mean, metricName: row.Metric, innerLower: row.Lower, innerUpper: row.Upper,
|
|
262
|
+
optimistic: row.Optimistic, modelId: row.IsFinalist ? finalistModelId : undefined, isWinner: row.IsFinalist,
|
|
263
|
+
}));
|
|
264
|
+
return { Leaderboard: leaderboard, Gate: gate === null ? null : { Outcome: gate.decision.outcome, Reason: gate.reason.text } };
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Resolve each distinct algorithm name once over one read of `MJ: ML Algorithms` (keys are the names as written in
|
|
268
|
+
* the plan), so a bad name fails before any row is written.
|
|
269
|
+
*/
|
|
270
|
+
async resolveAlgorithms(names, provider, user) {
|
|
271
|
+
const rv = RunView.FromMetadataProvider(provider);
|
|
272
|
+
const res = await rv.RunView({ EntityName: 'MJ: ML Algorithms', Fields: ['ID', 'Name', 'DriverClass'], ResultType: 'simple' }, user);
|
|
273
|
+
if (!res.Success)
|
|
274
|
+
throw new Error(`Loading MJ: ML Algorithms failed: ${res.ErrorMessage}`);
|
|
275
|
+
return new Map([...new Set(names)].map((name) => [name, PredictiveStudioPipelineBuilder.MatchAlgorithm(name, res.Results)]));
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Bind version 1 of a default Evaluation Protocol when the pipeline has none — always before the first candidate
|
|
279
|
+
* trains, so the protocol row precedes the run row. The holdout is the unit's default ({@link ProtocolDefaults}).
|
|
280
|
+
*/
|
|
281
|
+
async ensureProtocol(pipeline, candidates, provider, user) {
|
|
282
|
+
if (pipeline.EvaluationProtocolID)
|
|
283
|
+
return;
|
|
284
|
+
const unitRow = await provider.GetEntityObject('MJ: ML Prediction Units', user);
|
|
285
|
+
if (!pipeline.PredictionUnitID || !(await unitRow.Load(pipeline.PredictionUnitID)))
|
|
286
|
+
throw new Error(`Prediction Unit ${pipeline.PredictionUnitID || '(none)'} not found.`);
|
|
287
|
+
const parsed = PredictionUnit.ParsePredictionUnitRow(unitRow);
|
|
288
|
+
if (parsed.Ok === false)
|
|
289
|
+
throw new Error(`Prediction Unit cannot be read: ${parsed.Errors.join('; ')}`);
|
|
290
|
+
const holdout = await ProtocolDefaults.DefaultHoldoutFor(parsed.Value, { DataAccess: new RunViewDataAccess(user, provider), Metadata: new ProviderAssemblyMetadata(provider), Now: new Date() });
|
|
291
|
+
const draft = EvaluationProtocolRules.DefaultEvaluationProtocolDraft({ Unit: parsed.Value, Holdout: holdout, Candidates: candidates, Seed: ProtocolDefaults.DEFAULT_SEED, Name: `${pipeline.Name} — protocol` });
|
|
292
|
+
const row = await EvaluationProtocolVersioning.CreateEvaluationProtocolV1(draft, { kind: 'system', component: 'pipeline-builder' }, new MetadataEntityFactory(provider), user);
|
|
293
|
+
pipeline.EvaluationProtocolID = row.ID;
|
|
294
|
+
if (!(await pipeline.Save()))
|
|
295
|
+
throw new Error(`Binding the Evaluation Protocol failed: ${pipeline.LatestResult?.CompleteMessage || 'unknown error'}`);
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Validate the whole plan against real metadata BEFORE any row is written or anything trains — so an invalid plan
|
|
299
|
+
* (bad entity / target / feature) fails fast with an actionable message and leaves no orphan pipeline or run rows
|
|
300
|
+
* behind — and canonicalize its names. Returns the target entity.
|
|
301
|
+
*/
|
|
302
|
+
preparePipelineConfig(config, provider) {
|
|
208
303
|
const entity = ResolveEntity(config.targetEntityName, provider);
|
|
209
304
|
if (!entity) {
|
|
210
305
|
throw new Error(`Target entity '${config.targetEntityName}' was not found in metadata. The plan must reference a real entity.`);
|
|
@@ -220,15 +315,17 @@ export class PredictiveStudioPipelineBuilder {
|
|
|
220
315
|
// Sanitize leakage guard deny fields against real entity schema
|
|
221
316
|
this.sanitizeLeakageGuard(config, entity, provider);
|
|
222
317
|
this.validatePlanFields(config, entity);
|
|
223
|
-
|
|
224
|
-
|
|
318
|
+
return entity;
|
|
319
|
+
}
|
|
320
|
+
/** Create + save the `MJ: ML Training Pipelines` row from the validated config. */
|
|
321
|
+
async savePipeline(config, entity, algorithmId, provider, user) {
|
|
225
322
|
const pipeline = await provider.GetEntityObject('MJ: ML Training Pipelines', user);
|
|
226
323
|
pipeline.NewRecord();
|
|
227
324
|
pipeline.Name = config.name;
|
|
228
325
|
pipeline.Description = config.description;
|
|
229
326
|
pipeline.Version = 1;
|
|
230
327
|
pipeline.Status = 'Draft';
|
|
231
|
-
pipeline.TargetEntityID =
|
|
328
|
+
pipeline.TargetEntityID = entity.ID;
|
|
232
329
|
pipeline.TargetVariable = config.targetVariable;
|
|
233
330
|
pipeline.ProblemType = config.problemType;
|
|
234
331
|
pipeline.AlgorithmID = algorithmId;
|
|
@@ -332,61 +429,68 @@ export class PredictiveStudioPipelineBuilder {
|
|
|
332
429
|
}
|
|
333
430
|
}
|
|
334
431
|
/**
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
* `'Logistic Regression'`, and `'logistic_regression'` all resolve to the same row.
|
|
339
|
-
* Throws with the available algorithm list if nothing matches.
|
|
432
|
+
* Publish the trained model into the business catalog ONLY if auto-publish is on, training wasn't leakage-flagged,
|
|
433
|
+
* the model holds no calibration hold and the trust verdict clears the bar, and then only through the promotion
|
|
434
|
+
* gate ({@link publishThroughGate}). Otherwise the model stays where it is and the plain held-reason is returned.
|
|
340
435
|
*/
|
|
341
|
-
async
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
linearregression: 'ridgeregression',
|
|
349
|
-
linear: 'ridgeregression',
|
|
350
|
-
ols: 'ridgeregression',
|
|
351
|
-
ridge: 'ridgeregression',
|
|
352
|
-
logistic: 'logisticregression',
|
|
353
|
-
rf: 'randomforest',
|
|
354
|
-
lgb: 'lightgbm',
|
|
355
|
-
lgbm: 'lightgbm',
|
|
356
|
-
xgb: 'xgboost',
|
|
357
|
-
mlp: 'multilayerperceptron',
|
|
358
|
-
neuralnet: 'multilayerperceptron',
|
|
359
|
-
neuralnetwork: 'multilayerperceptron',
|
|
360
|
-
};
|
|
361
|
-
if (ALIASES[want]) {
|
|
362
|
-
want = ALIASES[want];
|
|
363
|
-
}
|
|
364
|
-
const match = algos.find((a) => normalize(a.Name) === want || normalize(a.DriverClass) === want);
|
|
365
|
-
if (!match) {
|
|
366
|
-
const available = algos.map((a) => a.Name).join(', ');
|
|
367
|
-
throw new Error(`Algorithm '${algorithmName}' was not found in MJ: ML Algorithms. Available: ${available || '(none)'}.`);
|
|
368
|
-
}
|
|
369
|
-
return match.ID;
|
|
436
|
+
async maybePublish(p) {
|
|
437
|
+
const held = PredictiveStudioPipelineBuilder.heldBeforePromotion(p);
|
|
438
|
+
if (held !== null)
|
|
439
|
+
return { published: false, heldReason: held, readyToPublish: false };
|
|
440
|
+
if (!p.AutoPublish)
|
|
441
|
+
return { published: false, heldReason: PredictiveStudioPipelineBuilder.KeptInDraftReason, readyToPublish: true };
|
|
442
|
+
return this.publishThroughGate(p.Model, p.Provider, p.User);
|
|
370
443
|
}
|
|
444
|
+
/** The held reason of a model that clears the bar to publish and stays in Draft only because auto-publish was off. */
|
|
445
|
+
static { this.KeptInDraftReason = 'Kept in Draft — it clears the bar to publish, and is published only when you ask.'; }
|
|
371
446
|
/**
|
|
372
|
-
*
|
|
373
|
-
*
|
|
447
|
+
* Why a trained model cannot be published; null when the promotion gate may be asked to publish it. Auto-publish is
|
|
448
|
+
* not one of these reasons: a model that is off only for that is ready to publish ({@link maybePublish}).
|
|
374
449
|
*/
|
|
375
|
-
|
|
376
|
-
if (
|
|
377
|
-
return
|
|
378
|
-
|
|
379
|
-
if (
|
|
380
|
-
return {
|
|
450
|
+
static heldBeforePromotion(p) {
|
|
451
|
+
if (p.LeakageFlagged)
|
|
452
|
+
return 'Held for analyst review — training flagged a possible data-leakage issue.';
|
|
453
|
+
const hold = TrainerModelLineageReader.CalibrationHoldOf(p.Model.Lineage);
|
|
454
|
+
if (hold !== null) {
|
|
455
|
+
return `Held — ${ProductionModelPromotionGate.DescribeRefusal({ kind: 'refused-calibration', slope: hold.slope })}; a hidden family is never published.`;
|
|
381
456
|
}
|
|
382
|
-
|
|
383
|
-
|
|
457
|
+
return p.Trust.CanAct ? null : p.Trust.Reason;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Move the model Draft → Validated → Published through the promotion gate with no sign-off, so the gate's leakage,
|
|
461
|
+
* calibration and readiness checks apply and it generates the per-model scoring Action. A refusal holds the model at
|
|
462
|
+
* the status the gate left it, with the gate's reason. The gate saves its own copy of the row, so the returned model
|
|
463
|
+
* is reloaded once anything moved and reads the status the gate stored.
|
|
464
|
+
*/
|
|
465
|
+
async publishThroughGate(model, provider, user) {
|
|
466
|
+
const gate = this.CreatePromotionGate();
|
|
467
|
+
let result = { published: true, heldReason: null, readyToPublish: false };
|
|
468
|
+
let moved = false;
|
|
469
|
+
for (const targetStatus of ['Validated', 'Published']) {
|
|
470
|
+
const outcome = await gate.promote({ modelId: model.ID, targetStatus, signOff: false, contextUser: user, provider });
|
|
471
|
+
if (outcome.kind !== 'promoted') {
|
|
472
|
+
const reason = ProductionModelPromotionGate.DescribeRefusal(outcome);
|
|
473
|
+
result = { published: false, heldReason: `Not published — the promotion gate refused to move it to ${targetStatus}: ${reason}${reason.endsWith('.') ? '' : '.'}`, readyToPublish: false };
|
|
474
|
+
break;
|
|
475
|
+
}
|
|
476
|
+
moved = true;
|
|
384
477
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
478
|
+
if (moved)
|
|
479
|
+
await PredictiveStudioPipelineBuilder.reloadModel(model);
|
|
480
|
+
return result;
|
|
481
|
+
}
|
|
482
|
+
/** Read the model row back after the gate changed it; a failed read is logged (the promotion itself succeeded). */
|
|
483
|
+
static async reloadModel(model) {
|
|
484
|
+
if (!(await model.Load(model.ID))) {
|
|
485
|
+
LogError(`PredictiveStudioPipelineBuilder: model ${model.ID} was promoted but could not be read back: ${model.LatestResult?.CompleteMessage || 'unknown error'}`);
|
|
388
486
|
}
|
|
389
|
-
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* The promotion gate the build publishes through: the production {@link ProductionModelPromotionGate}, the same gate
|
|
490
|
+
* the Promote action, operation and auto-train use. Overridable so tests inject a gate with no live DB.
|
|
491
|
+
*/
|
|
492
|
+
CreatePromotionGate() {
|
|
493
|
+
return new ProductionModelPromotionGate();
|
|
390
494
|
}
|
|
391
495
|
}
|
|
392
496
|
/**
|
|
@@ -402,8 +506,7 @@ export function ResolveEntity(nameOrView, provider) {
|
|
|
402
506
|
if (direct)
|
|
403
507
|
return direct;
|
|
404
508
|
const trimmed = nameOrView.trim().toLowerCase();
|
|
405
|
-
const
|
|
406
|
-
const normalizedTarget = normalize(nameOrView);
|
|
509
|
+
const normalizedTarget = normalizeName(nameOrView);
|
|
407
510
|
for (const e of provider.Entities) {
|
|
408
511
|
if (e.Name.trim().toLowerCase() === trimmed)
|
|
409
512
|
return e;
|
|
@@ -415,20 +518,16 @@ export function ResolveEntity(nameOrView, provider) {
|
|
|
415
518
|
return e;
|
|
416
519
|
if (e.SchemaName && e.BaseTable && `${e.SchemaName}.${e.BaseTable}`.trim().toLowerCase() === trimmed)
|
|
417
520
|
return e;
|
|
418
|
-
if (
|
|
521
|
+
if (normalizeName(e.Name) === normalizedTarget)
|
|
419
522
|
return e;
|
|
420
|
-
if (e.BaseView &&
|
|
523
|
+
if (e.BaseView && normalizeName(e.BaseView) === normalizedTarget)
|
|
421
524
|
return e;
|
|
422
|
-
if (e.BaseTable &&
|
|
525
|
+
if (e.BaseTable && normalizeName(e.BaseTable) === normalizedTarget)
|
|
423
526
|
return e;
|
|
424
527
|
const strippedPrefix = e.Name.replace(/^[^:]+:\s*/, '').trim().toLowerCase();
|
|
425
|
-
if (strippedPrefix === trimmed ||
|
|
528
|
+
if (strippedPrefix === trimmed || normalizeName(strippedPrefix) === normalizedTarget)
|
|
426
529
|
return e;
|
|
427
530
|
}
|
|
428
531
|
return undefined;
|
|
429
532
|
}
|
|
430
|
-
/** @deprecated Use {@link ResolveEntity}. */
|
|
431
|
-
export function resolveEntity(nameOrView, provider) {
|
|
432
|
-
return ResolveEntity(nameOrView, provider);
|
|
433
|
-
}
|
|
434
533
|
//# sourceMappingURL=pipeline-builder.js.map
|