@memberjunction/predictive-studio 6.2.0 → 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
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module training/compute-cost
|
|
3
|
+
*
|
|
4
|
+
* A training run records the compute it really used (`ComputeSeconds`, wall-clock seconds) and prices it at
|
|
5
|
+
* `PS_COMPUTE_USD_PER_SECOND`. Without a configured rate the cost is unknown (NULL), never a hard-coded 0.
|
|
6
|
+
*/
|
|
7
|
+
/** Compute pricing: the configured rate per second and the cost of a run's measured seconds. */
|
|
8
|
+
export declare class ComputePricing {
|
|
9
|
+
/**
|
|
10
|
+
* The configured USD price of one compute second, or null when `PS_COMPUTE_USD_PER_SECOND` is unset or blank.
|
|
11
|
+
* Throws a `RangeError` for a value that is not a finite number >= 0, so a misconfigured rate fails before any
|
|
12
|
+
* training starts.
|
|
13
|
+
*/
|
|
14
|
+
static ReadComputeRate(env?: NodeJS.ProcessEnv): number | null;
|
|
15
|
+
/** Measured seconds at the scale `ComputeSeconds` stores (3 decimal places), so the run row holds what was priced. */
|
|
16
|
+
static RoundSeconds(seconds: number): number;
|
|
17
|
+
/**
|
|
18
|
+
* The cost of `seconds` (rounded as {@link RoundSeconds} stores them) at the rate, rounded to the 6 decimal places
|
|
19
|
+
* `ComputeCost` stores; null when the rate is unknown.
|
|
20
|
+
*/
|
|
21
|
+
static ComputeCostFor(seconds: number, usdPerSecond: number | null): number | null;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=compute-cost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-cost.d.ts","sourceRoot":"","sources":["../../src/training/compute-cost.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,gGAAgG;AAChG,qBAAa,cAAc;IACzB;;;;OAIG;WACW,eAAe,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,IAAI;IAUlF,sHAAsH;WACxG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAInD;;;OAGG;WACW,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI;CAG1F"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module training/compute-cost
|
|
3
|
+
*
|
|
4
|
+
* A training run records the compute it really used (`ComputeSeconds`, wall-clock seconds) and prices it at
|
|
5
|
+
* `PS_COMPUTE_USD_PER_SECOND`. Without a configured rate the cost is unknown (NULL), never a hard-coded 0.
|
|
6
|
+
*/
|
|
7
|
+
/** Compute pricing: the configured rate per second and the cost of a run's measured seconds. */
|
|
8
|
+
export class ComputePricing {
|
|
9
|
+
/**
|
|
10
|
+
* The configured USD price of one compute second, or null when `PS_COMPUTE_USD_PER_SECOND` is unset or blank.
|
|
11
|
+
* Throws a `RangeError` for a value that is not a finite number >= 0, so a misconfigured rate fails before any
|
|
12
|
+
* training starts.
|
|
13
|
+
*/
|
|
14
|
+
static ReadComputeRate(env = process.env) {
|
|
15
|
+
const raw = env.PS_COMPUTE_USD_PER_SECOND;
|
|
16
|
+
if (raw === undefined || raw.trim().length === 0)
|
|
17
|
+
return null;
|
|
18
|
+
const rate = Number(raw);
|
|
19
|
+
if (!Number.isFinite(rate) || rate < 0) {
|
|
20
|
+
throw new RangeError(`PS_COMPUTE_USD_PER_SECOND must be a number >= 0, got "${raw}"`);
|
|
21
|
+
}
|
|
22
|
+
return rate;
|
|
23
|
+
}
|
|
24
|
+
/** Measured seconds at the scale `ComputeSeconds` stores (3 decimal places), so the run row holds what was priced. */
|
|
25
|
+
static RoundSeconds(seconds) {
|
|
26
|
+
return Math.round(seconds * 1e3) / 1e3;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The cost of `seconds` (rounded as {@link RoundSeconds} stores them) at the rate, rounded to the 6 decimal places
|
|
30
|
+
* `ComputeCost` stores; null when the rate is unknown.
|
|
31
|
+
*/
|
|
32
|
+
static ComputeCostFor(seconds, usdPerSecond) {
|
|
33
|
+
return usdPerSecond === null ? null : Math.round(ComputePricing.RoundSeconds(seconds) * usdPerSecond * 1e6) / 1e6;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=compute-cost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-cost.js","sourceRoot":"","sources":["../../src/training/compute-cost.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,gGAAgG;AAChG,MAAM,OAAO,cAAc;IACzB;;;;OAIG;IACI,MAAM,CAAC,eAAe,CAAC,MAAyB,OAAO,CAAC,GAAG;QAChE,MAAM,GAAG,GAAG,GAAG,CAAC,yBAAyB,CAAC;QAC1C,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAC9D,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;YACvC,MAAM,IAAI,UAAU,CAAC,yDAAyD,GAAG,GAAG,CAAC,CAAC;QACxF,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,sHAAsH;IAC/G,MAAM,CAAC,YAAY,CAAC,OAAe;QACxC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IACzC,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,cAAc,CAAC,OAAe,EAAE,YAA2B;QACvE,OAAO,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,YAAY,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IACpH,CAAC;CACF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module training/evaluation-protocol-store
|
|
3
|
+
*
|
|
4
|
+
* Reading the Evaluation Protocol a pipeline is bound to. A training run, a retraining and the search guard read the
|
|
5
|
+
* protocol row by ID and parse it into the typed spec the trainer request carries; the read is a seam so the engine
|
|
6
|
+
* tests serve rows without a database. A pipeline's protocol is exactly the version its `EvaluationProtocolID` names:
|
|
7
|
+
* there is no "latest version of the lineage" lookup.
|
|
8
|
+
*/
|
|
9
|
+
import { type IMetadataProvider, type UserInfo } from '@memberjunction/core';
|
|
10
|
+
import type { MJMLEvaluationProtocolEntity } from '@memberjunction/core-entities';
|
|
11
|
+
import { type EvaluationProtocolColumns, type EvaluationProtocolSpec } from '@memberjunction/predictive-studio-core';
|
|
12
|
+
/** A stored protocol row: its columns and the instant the database created it. */
|
|
13
|
+
export type StoredEvaluationProtocol = EvaluationProtocolColumns & Pick<MJMLEvaluationProtocolEntity, '__mj_CreatedAt'>;
|
|
14
|
+
/** One protocol version, parsed, with the row facts a run is checked against. */
|
|
15
|
+
export interface LoadedProtocol {
|
|
16
|
+
/** `MJ: ML Evaluation Protocols`.ID of this version's row. */
|
|
17
|
+
readonly RowID: string;
|
|
18
|
+
/** The version number within the protocol's lineage. */
|
|
19
|
+
readonly Version: number;
|
|
20
|
+
/** The row's `__mj_CreatedAt` (the database clock, the same clock that stamps the run row). */
|
|
21
|
+
readonly CreatedAt: Date;
|
|
22
|
+
/** The parsed protocol. */
|
|
23
|
+
readonly Protocol: EvaluationProtocolSpec;
|
|
24
|
+
}
|
|
25
|
+
/** Reads Evaluation Protocol rows by ID. */
|
|
26
|
+
export interface IEvaluationProtocolStore {
|
|
27
|
+
/** The protocol version with this ID, or null when there is none. A failed read throws. */
|
|
28
|
+
Load(protocolId: string): Promise<StoredEvaluationProtocol | null>;
|
|
29
|
+
}
|
|
30
|
+
/** Reads protocol rows through the request's provider (never the global one), as the request's user. */
|
|
31
|
+
export declare class RunViewEvaluationProtocolStore implements IEvaluationProtocolStore {
|
|
32
|
+
private readonly contextUser;
|
|
33
|
+
private readonly runView;
|
|
34
|
+
constructor(provider: IMetadataProvider, contextUser: UserInfo);
|
|
35
|
+
/** Read-only, so the row is read as plain values (`'simple'`). */
|
|
36
|
+
Load(protocolId: string): Promise<StoredEvaluationProtocol | null>;
|
|
37
|
+
}
|
|
38
|
+
/** Loads and parses protocols. */
|
|
39
|
+
export declare class EvaluationProtocolSpecs {
|
|
40
|
+
/**
|
|
41
|
+
* The protocol version with this ID, parsed, or null when the row does not exist.
|
|
42
|
+
*
|
|
43
|
+
* @throws TrainingRefusedError (`protocol-invalid`) naming the protocol and its problems when the row does not parse
|
|
44
|
+
*/
|
|
45
|
+
static LoadProtocol(store: IEvaluationProtocolStore, protocolId: string): Promise<LoadedProtocol | null>;
|
|
46
|
+
/**
|
|
47
|
+
* The parsed protocol with this ID, or null when the row does not exist.
|
|
48
|
+
*
|
|
49
|
+
* @throws TrainingRefusedError (`protocol-invalid`) when the row does not parse
|
|
50
|
+
*/
|
|
51
|
+
static LoadSpec(store: IEvaluationProtocolStore, protocolId: string): Promise<EvaluationProtocolSpec | null>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=evaluation-protocol-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluation-protocol-store.d.ts","sourceRoot":"","sources":["../../src/training/evaluation-protocol-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAW,KAAK,iBAAiB,EAAE,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAElF,OAAO,EAAsB,KAAK,yBAAyB,EAAE,KAA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
|
|
3
|
+
*
|
|
4
|
+
* Reading the Evaluation Protocol a pipeline is bound to. A training run, a retraining and the search guard read the
|
|
5
|
+
* protocol row by ID and parse it into the typed spec the trainer request carries; the read is a seam so the engine
|
|
6
|
+
* tests serve rows without a database. A pipeline's protocol is exactly the version its `EvaluationProtocolID` names:
|
|
7
|
+
* there is no "latest version of the lineage" lookup.
|
|
8
|
+
*/
|
|
9
|
+
import { RunView } from '@memberjunction/core';
|
|
10
|
+
import { EscapeSQLString } from '@memberjunction/global';
|
|
11
|
+
import { EvaluationProtocol } from '@memberjunction/predictive-studio-core';
|
|
12
|
+
import { TrainingRefusedError } from './training-refusal.js';
|
|
13
|
+
/** Reads protocol rows through the request's provider (never the global one), as the request's user. */
|
|
14
|
+
export class RunViewEvaluationProtocolStore {
|
|
15
|
+
constructor(provider, contextUser) {
|
|
16
|
+
this.contextUser = contextUser;
|
|
17
|
+
this.runView = RunView.FromMetadataProvider(provider);
|
|
18
|
+
}
|
|
19
|
+
/** Read-only, so the row is read as plain values (`'simple'`). */
|
|
20
|
+
async Load(protocolId) {
|
|
21
|
+
const r = await this.runView.RunView({ EntityName: 'MJ: ML Evaluation Protocols', ExtraFilter: `ID='${EscapeSQLString(protocolId)}'`, MaxRows: 1, ResultType: 'simple' }, this.contextUser);
|
|
22
|
+
if (!r.Success)
|
|
23
|
+
throw new Error(`Reading Evaluation Protocol ${protocolId} failed: ${r.ErrorMessage}`);
|
|
24
|
+
return r.Results[0] || null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Loads and parses protocols. */
|
|
28
|
+
export class EvaluationProtocolSpecs {
|
|
29
|
+
/**
|
|
30
|
+
* The protocol version with this ID, parsed, or null when the row does not exist.
|
|
31
|
+
*
|
|
32
|
+
* @throws TrainingRefusedError (`protocol-invalid`) naming the protocol and its problems when the row does not parse
|
|
33
|
+
*/
|
|
34
|
+
static async LoadProtocol(store, protocolId) {
|
|
35
|
+
const row = await store.Load(protocolId);
|
|
36
|
+
if (!row)
|
|
37
|
+
return null;
|
|
38
|
+
const parsed = EvaluationProtocol.ParseEvaluationProtocolRow(row);
|
|
39
|
+
if (parsed.Ok === false)
|
|
40
|
+
throw new TrainingRefusedError({ stage: 'pipeline', reason: { kind: 'protocol-invalid', protocolId: row.ID, errors: parsed.Errors } });
|
|
41
|
+
// A plain row read through a client provider carries the instant as text; `new Date` reads either form.
|
|
42
|
+
return { RowID: row.ID, Version: row.Version, CreatedAt: new Date(row.__mj_CreatedAt), Protocol: parsed.Value };
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The parsed protocol with this ID, or null when the row does not exist.
|
|
46
|
+
*
|
|
47
|
+
* @throws TrainingRefusedError (`protocol-invalid`) when the row does not parse
|
|
48
|
+
*/
|
|
49
|
+
static async LoadSpec(store, protocolId) {
|
|
50
|
+
const loaded = await EvaluationProtocolSpecs.LoadProtocol(store, protocolId);
|
|
51
|
+
return loaded ? loaded.Protocol : null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=evaluation-protocol-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluation-protocol-store.js","sourceRoot":"","sources":["../../src/training/evaluation-protocol-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,OAAO,EAAyC,MAAM,sBAAsB,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAA+D,MAAM,wCAAwC,CAAC;AACzI,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAuB1D,wGAAwG;AACxG,MAAM,OAAO,8BAA8B;IAEzC,YAAY,QAA2B,EAAmB,WAAqB;QAArB,gBAAW,GAAX,WAAW,CAAU;QAC7E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC;IAED,kEAAkE;IAC3D,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AClH,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAA+B,EAAE,UAAkB;QAC9E,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,YAAY,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAC7E,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IACzC,CAAC;CACF"}
|
package/dist/training/index.d.ts
CHANGED
|
@@ -3,13 +3,21 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Barrel for the Predictive Studio **training orchestration** — the
|
|
5
5
|
* {@link TrainingEngine}, its dependency-injection seams (entity factory, record
|
|
6
|
-
* loader,
|
|
6
|
+
* loader, trainer, artifact store), and the production + in-memory
|
|
7
7
|
* implementations of those seams. See `./training-engine` for the flow overview.
|
|
8
8
|
*/
|
|
9
9
|
export * from './types.js';
|
|
10
|
+
export * from './unit-model-lineage.js';
|
|
11
|
+
export * from './trainer-model-lineage.js';
|
|
10
12
|
export * from './artifact-store.js';
|
|
13
|
+
export * from './storage-provider-artifact-store.js';
|
|
11
14
|
export * from './seams.js';
|
|
12
15
|
export * from './as-of-refusal.js';
|
|
16
|
+
export * from './training-refusal.js';
|
|
13
17
|
export * from './locked-holdout.js';
|
|
14
18
|
export * from './training-engine.js';
|
|
19
|
+
export * from './compute-cost.js';
|
|
20
|
+
export * from './trainer-result.js';
|
|
21
|
+
export * from './trainer-request.js';
|
|
22
|
+
export * from './evaluation-protocol-store.js';
|
|
15
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/training/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/training/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mCAAmC,CAAC;AAClD,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC"}
|
package/dist/training/index.js
CHANGED
|
@@ -3,13 +3,21 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Barrel for the Predictive Studio **training orchestration** — the
|
|
5
5
|
* {@link TrainingEngine}, its dependency-injection seams (entity factory, record
|
|
6
|
-
* loader,
|
|
6
|
+
* loader, trainer, artifact store), and the production + in-memory
|
|
7
7
|
* implementations of those seams. See `./training-engine` for the flow overview.
|
|
8
8
|
*/
|
|
9
9
|
export * from './types.js';
|
|
10
|
+
export * from './unit-model-lineage.js';
|
|
11
|
+
export * from './trainer-model-lineage.js';
|
|
10
12
|
export * from './artifact-store.js';
|
|
13
|
+
export * from './storage-provider-artifact-store.js';
|
|
11
14
|
export * from './seams.js';
|
|
12
15
|
export * from './as-of-refusal.js';
|
|
16
|
+
export * from './training-refusal.js';
|
|
13
17
|
export * from './locked-holdout.js';
|
|
14
18
|
export * from './training-engine.js';
|
|
19
|
+
export * from './compute-cost.js';
|
|
20
|
+
export * from './trainer-result.js';
|
|
21
|
+
export * from './trainer-request.js';
|
|
22
|
+
export * from './evaluation-protocol-store.js';
|
|
15
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/training/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/training/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mCAAmC,CAAC;AAClD,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC"}
|
|
@@ -6,11 +6,16 @@
|
|
|
6
6
|
* so the same training read with the same seed always holds out the same rows. Classification holdouts are
|
|
7
7
|
* stratified on the label (as the sidecar's own split is), so an imbalanced or small target keeps every class in the
|
|
8
8
|
* holdout when the data allows it; regression holdouts are a plain seeded sample.
|
|
9
|
+
*
|
|
10
|
+
* A Prediction Unit run does not carve here: its Training Snapshot's row manifest already names each row's role, and
|
|
11
|
+
* {@link LockedHoldoutSplitter.FromManifest} reads the split back from it.
|
|
9
12
|
*/
|
|
10
13
|
import type { MatrixData, ProblemType } from '@memberjunction/predictive-studio-core';
|
|
14
|
+
import type { SnapshotContent } from '../snapshot/snapshot-serialization.js';
|
|
11
15
|
/**
|
|
12
|
-
* The seed
|
|
13
|
-
*
|
|
16
|
+
* The default seed of a seeded locked-holdout carve (42, the sidecar's own default). The engine no longer carves with
|
|
17
|
+
* this module — a run's locked holdout is the one its Evaluation Protocol declares — and it stays exported for callers
|
|
18
|
+
* that carve a matrix directly.
|
|
14
19
|
*/
|
|
15
20
|
export declare const DEFAULT_SPLIT_SEED = 42;
|
|
16
21
|
/** The result of carving a matrix into a training portion and a locked holdout; both keep the input row order. */
|
|
@@ -46,6 +51,16 @@ export declare class LockedHoldoutSplitter {
|
|
|
46
51
|
* @param seed the split seed (normally {@link DEFAULT_SPLIT_SEED})
|
|
47
52
|
*/
|
|
48
53
|
static Carve(matrix: MatrixData, fraction: number, targetColumn: string, problemType: ProblemType, seed: number): LockedHoldoutSplit;
|
|
54
|
+
/**
|
|
55
|
+
* The split a Training Snapshot's row manifest records: the development rows are the training portion and the
|
|
56
|
+
* locked-holdout rows the holdout, each in matrix order, with every snapshot column. Nothing is re-carved, so the
|
|
57
|
+
* counts and the holdout class counts describe exactly the rows the manifest names.
|
|
58
|
+
*
|
|
59
|
+
* @param content the snapshot content (matrix row i is manifest line i)
|
|
60
|
+
* @param labelColumn the label column the holdout class counts are read from
|
|
61
|
+
* @param problemType classification counts the holdout rows per label; regression stores no class counts
|
|
62
|
+
*/
|
|
63
|
+
static FromManifest(content: SnapshotContent, labelColumn: string, problemType: ProblemType): LockedHoldoutSplit;
|
|
49
64
|
/** Rows per label, keyed by the label as text (the same key the stratified carve groups on), in sorted label order. */
|
|
50
65
|
private static countLabels;
|
|
51
66
|
/**
|
|
@@ -63,10 +78,10 @@ export declare class LockedHoldoutSplitter {
|
|
|
63
78
|
/** Fisher–Yates shuffle driven by the seeded generator. */
|
|
64
79
|
private static shuffleInPlace;
|
|
65
80
|
/**
|
|
66
|
-
*
|
|
81
|
+
* Mulberry32: a small, fast 32-bit seeded generator returning floats in [0, 1). Local so the carve has no dependency
|
|
67
82
|
* whose algorithm could change under it — the same seed must give the same holdout across releases.
|
|
68
83
|
*/
|
|
69
|
-
|
|
84
|
+
static Mulberry32(seed: number): () => number;
|
|
70
85
|
/** A fraction clamped into [0, 1]; a non-finite or negative value is 0. */
|
|
71
86
|
private static clampFraction;
|
|
72
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locked-holdout.d.ts","sourceRoot":"","sources":["../../src/training/locked-holdout.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"locked-holdout.d.ts","sourceRoot":"","sources":["../../src/training/locked-holdout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,kHAAkH;AAClH,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,QAAQ,EAAE,UAAU,CAAC;IACrB,sDAAsD;IACtD,aAAa,EAAE,UAAU,CAAC;IAC1B,mCAAmC;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,8BAA8B;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5C;AAYD,6DAA6D;AAC7D,qBAAa,qBAAqB;IAChC;;;OAGG;WACW,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAMnE;;;;;;;;OAQG;WACW,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,kBAAkB;IAsB3I;;;;;;;;OAQG;WACW,YAAY,CAAC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,kBAAkB;IAevH,uHAAuH;IACvH,OAAO,CAAC,MAAM,CAAC,WAAW;IAW1B;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IA4B7B,oHAAoH;IACpH,OAAO,CAAC,MAAM,CAAC,MAAM;IAWrB,yHAAyH;IACzH,OAAO,CAAC,MAAM,CAAC,MAAM;IAWrB,6CAA6C;IAC7C,OAAO,CAAC,MAAM,CAAC,eAAe;IAM9B,2DAA2D;IAC3D,OAAO,CAAC,MAAM,CAAC,cAAc;IAS7B;;;OAGG;WACW,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,MAAM;IAWpD,2EAA2E;IAC3E,OAAO,CAAC,MAAM,CAAC,aAAa;CAI7B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The seed
|
|
3
|
-
*
|
|
2
|
+
* The default seed of a seeded locked-holdout carve (42, the sidecar's own default). The engine no longer carves with
|
|
3
|
+
* this module — a run's locked holdout is the one its Evaluation Protocol declares — and it stays exported for callers
|
|
4
|
+
* that carve a matrix directly.
|
|
4
5
|
*/
|
|
5
6
|
export const DEFAULT_SPLIT_SEED = 42;
|
|
6
7
|
/** Seeded, stratified locked-holdout carve. Pure; no I/O. */
|
|
@@ -28,7 +29,7 @@ export class LockedHoldoutSplitter {
|
|
|
28
29
|
const total = matrix.rows.length;
|
|
29
30
|
const holdoutCount = LockedHoldoutSplitter.HoldoutCount(total, fraction);
|
|
30
31
|
const targetIdx = matrix.columns.indexOf(targetColumn);
|
|
31
|
-
const random = LockedHoldoutSplitter.
|
|
32
|
+
const random = LockedHoldoutSplitter.Mulberry32(seed);
|
|
32
33
|
const holdoutIndices = problemType === 'classification' && targetIdx >= 0
|
|
33
34
|
? LockedHoldoutSplitter.stratifiedPick(matrix, targetIdx, holdoutCount, random)
|
|
34
35
|
: LockedHoldoutSplitter.shuffledIndices(total, random).slice(0, holdoutCount);
|
|
@@ -43,6 +44,29 @@ export class LockedHoldoutSplitter {
|
|
|
43
44
|
HoldoutClassCounts: problemType === 'classification' && targetIdx >= 0 ? LockedHoldoutSplitter.countLabels(holdoutRows, targetIdx) : {},
|
|
44
45
|
};
|
|
45
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* The split a Training Snapshot's row manifest records: the development rows are the training portion and the
|
|
49
|
+
* locked-holdout rows the holdout, each in matrix order, with every snapshot column. Nothing is re-carved, so the
|
|
50
|
+
* counts and the holdout class counts describe exactly the rows the manifest names.
|
|
51
|
+
*
|
|
52
|
+
* @param content the snapshot content (matrix row i is manifest line i)
|
|
53
|
+
* @param labelColumn the label column the holdout class counts are read from
|
|
54
|
+
* @param problemType classification counts the holdout rows per label; regression stores no class counts
|
|
55
|
+
*/
|
|
56
|
+
static FromManifest(content, labelColumn, problemType) {
|
|
57
|
+
const columns = [...content.Header.columns];
|
|
58
|
+
const training = [];
|
|
59
|
+
const holdout = [];
|
|
60
|
+
content.Rows.forEach((row, i) => (content.Manifest[i].role === 'locked-holdout' ? holdout : training).push([...row]));
|
|
61
|
+
const targetIdx = columns.indexOf(labelColumn);
|
|
62
|
+
return {
|
|
63
|
+
Training: { columns, rows: training },
|
|
64
|
+
LockedHoldout: { columns, rows: holdout },
|
|
65
|
+
HoldoutRowCount: holdout.length,
|
|
66
|
+
TrainingRowCount: training.length,
|
|
67
|
+
HoldoutClassCounts: problemType === 'classification' && targetIdx >= 0 ? LockedHoldoutSplitter.countLabels(holdout, targetIdx) : {},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
46
70
|
/** Rows per label, keyed by the label as text (the same key the stratified carve groups on), in sorted label order. */
|
|
47
71
|
static countLabels(rows, targetIdx) {
|
|
48
72
|
const counts = new Map();
|
|
@@ -128,10 +152,10 @@ export class LockedHoldoutSplitter {
|
|
|
128
152
|
}
|
|
129
153
|
}
|
|
130
154
|
/**
|
|
131
|
-
*
|
|
155
|
+
* Mulberry32: a small, fast 32-bit seeded generator returning floats in [0, 1). Local so the carve has no dependency
|
|
132
156
|
* whose algorithm could change under it — the same seed must give the same holdout across releases.
|
|
133
157
|
*/
|
|
134
|
-
static
|
|
158
|
+
static Mulberry32(seed) {
|
|
135
159
|
let state = seed >>> 0;
|
|
136
160
|
return () => {
|
|
137
161
|
state = (state + 0x6d2b79f5) >>> 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locked-holdout.js","sourceRoot":"","sources":["../../src/training/locked-holdout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"locked-holdout.js","sourceRoot":"","sources":["../../src/training/locked-holdout.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AA6BrC,6DAA6D;AAC7D,MAAM,OAAO,qBAAqB;IAChC;;;OAGG;IACI,MAAM,CAAC,YAAY,CAAC,KAAa,EAAE,QAAgB;QACxD,MAAM,CAAC,GAAG,qBAAqB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QACxD,IAAI,KAAK,IAAI,CAAC;YAAE,OAAO,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,KAAK,CAAC,MAAkB,EAAE,QAAgB,EAAE,YAAoB,EAAE,WAAwB,EAAE,IAAY;QACpH,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;QACjC,MAAM,YAAY,GAAG,qBAAqB,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACzE,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG,qBAAqB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtD,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GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YACrC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;YAC1C,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,UAAU,CAAC;QAC/C,CAAC,CAAC;IACJ,CAAC;IAED,2EAA2E;IACnE,MAAM,CAAC,aAAa,CAAC,KAAa;QACxC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC;YAAE,OAAO,CAAC,CAAC;QACnD,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/B,CAAC;CACF"}
|
package/dist/training/seams.d.ts
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { type BaseEntity, type UserInfo, type IMetadataProvider } from '@memberjunction/core';
|
|
12
12
|
import type { MJMLTrainingPipelineEntity } from '@memberjunction/core-entities';
|
|
13
|
-
import type {
|
|
13
|
+
import type { TrainerRequest, TrainerResult } from '@memberjunction/predictive-studio-core';
|
|
14
14
|
import { MLSidecar } from '@memberjunction/predictive-studio-sidecar';
|
|
15
|
-
import type { IEntityFactory, IRecordLoader,
|
|
15
|
+
import type { IEntityFactory, IRecordLoader, ITrainerEvaluator, TrainerRequestReissue } from './types.js';
|
|
16
16
|
/**
|
|
17
17
|
* Provider-bound {@link IEntityFactory}: every entity is created through the
|
|
18
18
|
* caller's provider, never the global `Metadata` default.
|
|
@@ -39,9 +39,17 @@ export declare class RunViewRecordLoader implements IRecordLoader {
|
|
|
39
39
|
nextModelVersion(pipelineId: string, contextUser: UserInfo, provider: IMetadataProvider): Promise<number>;
|
|
40
40
|
/** @inheritdoc */
|
|
41
41
|
resolveAlgorithmDriverKey(algorithmId: string, contextUser: UserInfo, provider: IMetadataProvider): Promise<string | null>;
|
|
42
|
+
/**
|
|
43
|
+
* One read of `MJ: ML Algorithms` by `DriverClass` (at most two rows). Two rows are refused rather than one picked,
|
|
44
|
+
* the same ambiguity rule the agent's algorithm-name resolver applies (`PredictiveStudioPipelineBuilder.MatchAlgorithm`).
|
|
45
|
+
*
|
|
46
|
+
* @inheritdoc
|
|
47
|
+
* @throws Error when the read fails, or naming both rows when two share the driver key
|
|
48
|
+
*/
|
|
49
|
+
resolveAlgorithmIDForDriver(driverKey: string, contextUser: UserInfo, provider: IMetadataProvider): Promise<string | null>;
|
|
42
50
|
}
|
|
43
51
|
/**
|
|
44
|
-
* {@link
|
|
52
|
+
* {@link ITrainerEvaluator} backed by the self-managing {@link MLSidecar} client.
|
|
45
53
|
* Lazily starts the sidecar on first use (managed or remote mode is decided by
|
|
46
54
|
* `MLSidecar` from options/env). Defaults to the process-shared
|
|
47
55
|
* {@link MLSidecarProvider} instance rather than constructing a private `MLSidecar`
|
|
@@ -49,15 +57,33 @@ export declare class RunViewRecordLoader implements IRecordLoader {
|
|
|
49
57
|
* child process per action run. Tests (and callers that genuinely need an isolated
|
|
50
58
|
* sidecar) can still inject their own via the constructor parameter.
|
|
51
59
|
*/
|
|
52
|
-
export declare class MJSidecarTrainer implements
|
|
60
|
+
export declare class MJSidecarTrainer implements ITrainerEvaluator {
|
|
53
61
|
private readonly sidecar;
|
|
54
|
-
private
|
|
62
|
+
private readonly clockMs;
|
|
55
63
|
/**
|
|
56
64
|
* @param sidecar an `MLSidecar` instance (managed or remote); defaults to the
|
|
57
65
|
* shared, process-lifetime instance from {@link MLSidecarProvider}
|
|
66
|
+
* @param clockMs the clock (milliseconds) a protocol training's wall seconds are measured with; tests pin it
|
|
58
67
|
*/
|
|
59
|
-
constructor(sidecar?: MLSidecar);
|
|
60
|
-
/**
|
|
61
|
-
|
|
68
|
+
constructor(sidecar?: MLSidecar, clockMs?: () => number);
|
|
69
|
+
/**
|
|
70
|
+
* Run one protocol-driven training with bounded retries: a transport failure or a 5xx answer is retried up to
|
|
71
|
+
* `req.maxRetries` times. Each retry sends the request `reissue` builds, with fresh snapshot downloads, since the
|
|
72
|
+
* first attempt's may have expired by then (a failed re-issue counts as that attempt failing). Each attempt first
|
|
73
|
+
* calls `Start()`, which does nothing while the sidecar runs and respawns a managed child that died, so a crash
|
|
74
|
+
* mid-training is recovered by the next attempt (a failed respawn counts as that attempt failing). A 4xx refusal and
|
|
75
|
+
* a malformed answer are not retried (the same request gets the same answer) and are rethrown. A `failed` answer to
|
|
76
|
+
* a retry keeps the error that forced the retry in its message. When every attempt fails the result is `failed` at
|
|
77
|
+
* stage `timeout` naming the last error, never partial metrics, with the wall seconds the attempts took as its
|
|
78
|
+
* `computeSeconds` (the sidecar may have computed for all of them, so the run records that time rather than none).
|
|
79
|
+
*
|
|
80
|
+
* A retried transport failure can repeat a training that is still running: a socket reset on a remote sidecar
|
|
81
|
+
* that kept computing makes attempt 2 train and score the holdout again, concurrently. The sidecar is stateless
|
|
82
|
+
* and the run is seeded, so the repeat produces the same result; only compute repeats, up to
|
|
83
|
+
* `(maxRetries + 1) × (timeoutSeconds + 60)` seconds of wall time.
|
|
84
|
+
*/
|
|
85
|
+
RunTrainer(req: TrainerRequest, reissue: TrainerRequestReissue): Promise<TrainerResult>;
|
|
86
|
+
/** A refusal (4xx) or a malformed answer: sending the same request again gets the same answer. */
|
|
87
|
+
private static isNotRetryable;
|
|
62
88
|
}
|
|
63
89
|
//# sourceMappingURL=seams.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seams.d.ts","sourceRoot":"","sources":["../../src/training/seams.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;
|
|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BzB;;;;;;OAMG;IACU,2BAA2B,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAmBxI;AAED;;;;;;;;GAQG;AACH,qBAAa,gBAAiB,YAAW,iBAAiB;IAOtD,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAP1B;;;;OAIG;gBAEgB,OAAO,GAAE,SAAmD,EAC5D,OAAO,GAAE,MAAM,MAAgC;IAGlE;;;;;;;;;;;;;;;OAeG;IACU,UAAU,CAAC,GAAG,EAAE,cAAc,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC;IAwBpG,kGAAkG;IAClG,OAAO,CAAC,MAAM,CAAC,cAAc;CAG9B"}
|
package/dist/training/seams.js
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* substitute in-memory fakes and never need a DB or sidecar.
|
|
10
10
|
*/
|
|
11
11
|
import { RunView, } from '@memberjunction/core';
|
|
12
|
+
import { EscapeSQLString, NormalizeUUID } from '@memberjunction/global';
|
|
13
|
+
import { SidecarError, TrainerResultMalformedError } from '@memberjunction/predictive-studio-sidecar';
|
|
12
14
|
import { MLSidecarProvider } from '../sidecar-provider.js';
|
|
13
15
|
/**
|
|
14
16
|
* Provider-bound {@link IEntityFactory}: every entity is created through the
|
|
@@ -81,9 +83,33 @@ export class RunViewRecordLoader {
|
|
|
81
83
|
}
|
|
82
84
|
return result.Results[0].DriverClass ?? null;
|
|
83
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* One read of `MJ: ML Algorithms` by `DriverClass` (at most two rows). Two rows are refused rather than one picked,
|
|
88
|
+
* the same ambiguity rule the agent's algorithm-name resolver applies (`PredictiveStudioPipelineBuilder.MatchAlgorithm`).
|
|
89
|
+
*
|
|
90
|
+
* @inheritdoc
|
|
91
|
+
* @throws Error when the read fails, or naming both rows when two share the driver key
|
|
92
|
+
*/
|
|
93
|
+
async resolveAlgorithmIDForDriver(driverKey, contextUser, provider) {
|
|
94
|
+
const result = await RunView.FromMetadataProvider(provider).RunView({
|
|
95
|
+
EntityName: 'MJ: ML Algorithms',
|
|
96
|
+
ExtraFilter: `DriverClass='${EscapeSQLString(driverKey)}'`,
|
|
97
|
+
Fields: ['ID', 'Name'],
|
|
98
|
+
MaxRows: 2,
|
|
99
|
+
SkipTotalRowCount: true,
|
|
100
|
+
ResultType: 'simple',
|
|
101
|
+
}, contextUser);
|
|
102
|
+
if (!result.Success)
|
|
103
|
+
throw new Error(`Reading MJ: ML Algorithms for driver '${driverKey}' failed: ${result.ErrorMessage || 'unknown error'}`);
|
|
104
|
+
if (result.Results.length > 1) {
|
|
105
|
+
const named = result.Results.map((a) => `'${a.Name}' (${NormalizeUUID(a.ID)})`).join(' and ');
|
|
106
|
+
throw new Error(`Driver '${driverKey}' matches more than one MJ: ML Algorithms row: ${named}; the shipped model's algorithm is ambiguous.`);
|
|
107
|
+
}
|
|
108
|
+
return result.Results.length === 1 ? result.Results[0].ID : null;
|
|
109
|
+
}
|
|
84
110
|
}
|
|
85
111
|
/**
|
|
86
|
-
* {@link
|
|
112
|
+
* {@link ITrainerEvaluator} backed by the self-managing {@link MLSidecar} client.
|
|
87
113
|
* Lazily starts the sidecar on first use (managed or remote mode is decided by
|
|
88
114
|
* `MLSidecar` from options/env). Defaults to the process-shared
|
|
89
115
|
* {@link MLSidecarProvider} instance rather than constructing a private `MLSidecar`
|
|
@@ -95,27 +121,57 @@ export class MJSidecarTrainer {
|
|
|
95
121
|
/**
|
|
96
122
|
* @param sidecar an `MLSidecar` instance (managed or remote); defaults to the
|
|
97
123
|
* shared, process-lifetime instance from {@link MLSidecarProvider}
|
|
124
|
+
* @param clockMs the clock (milliseconds) a protocol training's wall seconds are measured with; tests pin it
|
|
98
125
|
*/
|
|
99
|
-
constructor(sidecar = MLSidecarProvider.Instance.GetSidecar()) {
|
|
126
|
+
constructor(sidecar = MLSidecarProvider.Instance.GetSidecar(), clockMs = () => performance.now()) {
|
|
100
127
|
this.sidecar = sidecar;
|
|
101
|
-
this.
|
|
128
|
+
this.clockMs = clockMs;
|
|
102
129
|
}
|
|
103
|
-
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Run one protocol-driven training with bounded retries: a transport failure or a 5xx answer is retried up to
|
|
132
|
+
* `req.maxRetries` times. Each retry sends the request `reissue` builds, with fresh snapshot downloads, since the
|
|
133
|
+
* first attempt's may have expired by then (a failed re-issue counts as that attempt failing). Each attempt first
|
|
134
|
+
* calls `Start()`, which does nothing while the sidecar runs and respawns a managed child that died, so a crash
|
|
135
|
+
* mid-training is recovered by the next attempt (a failed respawn counts as that attempt failing). A 4xx refusal and
|
|
136
|
+
* a malformed answer are not retried (the same request gets the same answer) and are rethrown. A `failed` answer to
|
|
137
|
+
* a retry keeps the error that forced the retry in its message. When every attempt fails the result is `failed` at
|
|
138
|
+
* stage `timeout` naming the last error, never partial metrics, with the wall seconds the attempts took as its
|
|
139
|
+
* `computeSeconds` (the sidecar may have computed for all of them, so the run records that time rather than none).
|
|
140
|
+
*
|
|
141
|
+
* A retried transport failure can repeat a training that is still running: a socket reset on a remote sidecar
|
|
142
|
+
* that kept computing makes attempt 2 train and score the holdout again, concurrently. The sidecar is stateless
|
|
143
|
+
* and the run is seeded, so the repeat produces the same result; only compute repeats, up to
|
|
144
|
+
* `(maxRetries + 1) × (timeoutSeconds + 60)` seconds of wall time.
|
|
145
|
+
*/
|
|
146
|
+
async RunTrainer(req, reissue) {
|
|
147
|
+
let lastError = '';
|
|
148
|
+
const startedMs = this.clockMs();
|
|
149
|
+
for (let attempt = 0; attempt <= req.maxRetries; attempt++) {
|
|
150
|
+
try {
|
|
151
|
+
const sent = attempt === 0 ? req : await reissue();
|
|
152
|
+
await this.sidecar.Start();
|
|
153
|
+
const result = await this.sidecar.RunTrainer(sent);
|
|
154
|
+
if (result.status !== 'failed' || attempt === 0)
|
|
155
|
+
return result;
|
|
156
|
+
return { ...result, message: `${result.message} (attempt ${attempt + 1} of ${req.maxRetries + 1}; attempt ${attempt} failed: ${lastError})` };
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
if (MJSidecarTrainer.isNotRetryable(err))
|
|
160
|
+
throw err;
|
|
161
|
+
lastError = err instanceof Error ? err.message : String(err);
|
|
162
|
+
}
|
|
108
163
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
164
|
+
return {
|
|
165
|
+
status: 'failed',
|
|
166
|
+
trainingRunId: req.trainingRunId,
|
|
167
|
+
stage: 'timeout',
|
|
168
|
+
message: `sidecar gave no result after ${req.maxRetries + 1} attempt(s): ${lastError}`,
|
|
169
|
+
computeSeconds: (this.clockMs() - startedMs) / 1000,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/** A refusal (4xx) or a malformed answer: sending the same request again gets the same answer. */
|
|
173
|
+
static isNotRetryable(err) {
|
|
174
|
+
return err instanceof TrainerResultMalformedError || (err instanceof SidecarError && err.Status >= 400 && err.Status < 500);
|
|
119
175
|
}
|
|
120
176
|
}
|
|
121
177
|
//# sourceMappingURL=seams.js.map
|