V6 Pipeline: Add comprehensive two-stage testing framework#2
Draft
V6 Pipeline: Add comprehensive two-stage testing framework#2
Conversation
Co-authored-by: ArielShamay <157797315+ArielShamay@users.noreply.github.com>
Co-authored-by: ArielShamay <157797315+ArielShamay@users.noreply.github.com>
…a met Co-authored-by: ArielShamay <157797315+ArielShamay@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Replace V4 ensemble with MiniRocket and XGBoost pipeline
V6 Pipeline: Add comprehensive two-stage testing framework
Jan 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements comprehensive testing infrastructure for V6 simplified pipeline (MiniRocket → XGBoost) per Phase 2 requirements. Creates two-stage validation: integrity verification and performance benchmarking.
Changes
New Test Framework (
scripts/v6_comprehensive_test.py)REPORTS/directory--stage 1|2or--allUpdated Unit Tests (
tests/test_xgboost_v6_pipeline.py)importlib.utilTest Infrastructure
xgboost_v5.pkl(CalibratedClassifierCV, 10,004 features) for testing without production model.gitignorefor test artifactsUsage
Results
Notes
xgboost_v5.pklfor production validationOriginal prompt
This section details on the original issue you should resolve
<issue_title>V6 Testing</issue_title>
<issue_description>
Title
SentinelFetal V6: Replace V4 Ensemble with MiniRocket → XGBoost (V5) Simplified Pipeline (Keep Pre-AI + Hybrid Logic + UI JSON intact)
Overview
We want to replace the current 3-model ensemble (XGBoost + RandomForest + SGD) with a single MiniRocket → XGBoost pipeline, while preserving all critical system invariants:
Must remain unchanged
Pre-AI pipeline: quality gate + invariants + windowing (Steel Wall)
Smart Hybrid Logic (3-tier decision system)
Rule Engine safety net
UI JSON output contract (snapshot / state bridge)
Current vs Target Architecture
CURRENT (V4.0)
TARGET (V6)
Available Model Artifacts
Model file | Size | Location -- | -- | -- minirocket_encoder.joblib | 41 KB | models/ xgboost_v5.pkl | 950 KB | models/ and models/ensemble_v5/ ctg_xgboost_pipeline.pkl | 1.2 MB | models/Scope
Goals
Add a V6 pipeline that uses MiniRocket → XGBoost (xgboost_v5.pkl) as the only AI classifier.
Keep decision logic and safety behavior identical at the system level:
Rule override remains MAX(ai_risk, rule_severity)
Same categories 1/2/3
Same predict/predict_proba contract for adapters
Non-goals
No retraining.
No changes to:
group split logic
calibration behavior (if model is calibrated, keep it)
invariants / windowing params
Smart Hybrid Logic algorithm
UI code or JSON schema
Steel Wall (Do Not Touch)
These paths/files are strictly unchanged:
src/v6/pre_ai/(quality gate, invariants, windowing)src/decision/smart_hybrid_logic.pysrc/models/minirocket_encoder.pysrc/rules/(all rule engine files)src/explainability/src/interfaces/state_bridge.py(UI JSON output)Implementation Plan
Step 1 — Verify Model Compatibility
Create and run a verification script to inspect
xgboost_v5.pkl:Determine:
expected input feature dimension (
n_features_in_if available)whether it’s
CalibratedClassifierCVor raw estimatorConfirm:
MiniRocket output is 9,996
Model expects 10,004 (see padding decision below)
Run a small end-to-end inference sanity check
Feature Dimension Handling (Confirmed Decision)
The XGBoost model expects 10,004 features:
MiniRocket: 9,996
Clinical features: 8 (not available in this simplified pipeline)
Decision: pad missing clinical features with zeros (neutral defaults) without retraining.
Files to Create
1)
src/adapters/xgboost_only_classifier.pyNew XGBoost-only classifier (replaces EnsembleManager behavior at adapter level):
Load
xgboost_v5.pklProvide same predict surface expected by the pipeline
Apply rule engine safety override:
final_risk = MAX(ai_risk, rule_severity)Return a compatible
EnsemblePrediction-like dict structure (so explainability / state bridge remains stable)2)
src/adapters/xgboost_v6_adapter.pyAdapter implementing
IClassifierprotocol:Wrap
XGBoostOnlyClassifierDrop-in replacement for
EnsembleCla...💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.