#!/usr/bin/env python3
"""
Neural Gating Metamodel Package
================================
Combines 5 trading strategies (PVA, MRD, VBP, MSA, MTS) using a learned
neural gating network that adapts weights based on market context.

Components:
- GatingNetwork: MLP-based network that outputs strategy weights
- EnsemblePipeline: Orchestrates predictions from all strategies
- ConfidenceCalibrator: Calibrates confidence scores to match accuracy
- NeuralGatingMetamodel: Complete metamodel integrating all components
- MetamodelTrainer: Training pipeline with walk-forward validation

Key Features:
- Dynamic strategy weighting based on market context
- Entropy regularization prevents collapse to single strategy
- Calibrated confidence scores
- Interpretable strategy contributions
- Walk-forward training support

Usage:
    from src.models.metamodel import NeuralGatingMetamodel, MetamodelConfig

    # Initialize
    config = MetamodelConfig()
    model = NeuralGatingMetamodel(config)

    # Load strategies
    model.load_strategies(['EURUSD', 'GBPUSD'])

    # Train
    trainer = MetamodelTrainer(model)
    trainer.walk_forward_train(df, 'EURUSD')

    # Predict
    prediction = model.predict(df_ohlcv)
    print(f"Direction: {prediction.direction:.3f}")
    print(f"Confidence: {prediction.confidence:.3f}")
    print(f"Dominant: {prediction.dominant_strategy}")

Author: ML-Specialist (NEXUS v4.0)
Version: 1.0.0
Created: 2026-01-25
"""

# Gating Network
from .gating_network import (
    GatingNetwork,
    GatingConfig,
    ContextEncoder,
    StrategyOutputEncoder,
)

# Ensemble Pipeline
from .ensemble_pipeline import (
    EnsemblePipeline,
    EnsemblePrediction,
    StrategyPredictions,
)

# Calibration
from .calibration import (
    ConfidenceCalibrator,
    CalibrationMetrics,
    TemperatureScalingNN,
    calibrate_ensemble_confidence,
)

# Complete Metamodel
from .model import (
    NeuralGatingMetamodel,
    MetamodelConfig,
    MetamodelPrediction,
)

# Trainer
from .trainer import (
    MetamodelTrainer,
    TrainerConfig,
    TrainingMetrics,
)

__all__ = [
    # Gating Network
    'GatingNetwork',
    'GatingConfig',
    'ContextEncoder',
    'StrategyOutputEncoder',
    # Ensemble Pipeline
    'EnsemblePipeline',
    'EnsemblePrediction',
    'StrategyPredictions',
    # Calibration
    'ConfidenceCalibrator',
    'CalibrationMetrics',
    'TemperatureScalingNN',
    'calibrate_ensemble_confidence',
    # Complete Metamodel
    'NeuralGatingMetamodel',
    'MetamodelConfig',
    'MetamodelPrediction',
    # Trainer
    'MetamodelTrainer',
    'TrainerConfig',
    'TrainingMetrics',
]

__version__ = '1.0.0'
