quantrs2_device/mapping_scirs2/
ml_integration.rs1use super::*;
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct MLMappingConfig {
8 pub enable_ml: bool,
10 pub model_types: Vec<MLModelType>,
12 pub feature_config: FeatureConfig,
14 pub training_config: TrainingConfig,
16 pub prediction_config: PredictionConfig,
18 pub transfer_learning: TransferLearningConfig,
20}
21
22#[derive(Debug, Clone, Serialize, Deserialize)]
24pub struct FeatureConfig {
25 pub enable_structural: bool,
27 pub enable_temporal: bool,
29 pub enable_hardware: bool,
31 pub enable_circuit: bool,
33 pub selection_method: FeatureSelectionMethod,
35 pub max_features: usize,
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41pub struct TrainingConfig {
42 pub batch_size: usize,
44 pub epochs: usize,
46 pub learning_rate: f64,
48 pub validation_split: f64,
50 pub early_stopping_patience: usize,
52 pub regularization: RegularizationParams,
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize)]
58pub struct RegularizationParams {
59 pub l1_lambda: f64,
61 pub l2_lambda: f64,
63 pub dropout: f64,
65 pub batch_norm: bool,
67}
68
69#[derive(Debug, Clone, Serialize, Deserialize)]
71pub struct PredictionConfig {
72 pub ensemble_size: usize,
74 pub confidence_threshold: f64,
76 pub use_uncertainty_estimation: bool,
78 pub monte_carlo_samples: usize,
80 pub temperature_scaling: bool,
82 pub calibration_method: CalibrationMethod,
84}
85
86#[derive(Debug, Clone, Serialize, Deserialize)]
88pub struct TransferLearningConfig {
89 pub enable_transfer: bool,
91 pub source_domains: Vec<String>,
93 pub adaptation_method: DomainAdaptationMethod,
95 pub fine_tuning: FineTuningConfig,
97}
98
99#[derive(Debug, Clone, Serialize, Deserialize)]
101pub struct FineTuningConfig {
102 pub freeze_layers: Vec<usize>,
104 pub unfreeze_after_epochs: usize,
106 pub reduced_learning_rate: f64,
108}
109
110#[derive(Debug, Clone, Serialize, Deserialize)]
112pub struct PerformancePredictions {
113 pub predicted_swaps: f64,
115 pub predicted_time: f64,
117 pub predicted_fidelity: f64,
119 pub confidence_intervals: HashMap<String, (f64, f64)>,
121 pub uncertainty_estimates: HashMap<String, f64>,
123}
124
125#[derive(Debug, Clone, Serialize, Deserialize)]
127pub struct MLPerformanceResult {
128 pub model_accuracy: HashMap<String, f64>,
130 pub feature_importance: HashMap<String, f64>,
132 pub prediction_reliability: f64,
134 pub training_history: Vec<TrainingEpoch>,
136}
137
138#[derive(Debug, Clone, Serialize, Deserialize)]
140pub struct TrainingEpoch {
141 pub epoch: usize,
143 pub training_loss: f64,
145 pub validation_loss: f64,
147 pub learning_rate: f64,
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153pub struct AdaptiveMappingInsights {
154 pub learning_progress: HashMap<String, f64>,
156 pub adaptation_effectiveness: HashMap<String, f64>,
158 pub performance_trends: HashMap<String, Vec<f64>>,
160 pub recommended_adjustments: Vec<ParameterAdjustment>,
162}
163
164#[derive(Debug, Clone, Serialize, Deserialize)]
166pub struct ParameterAdjustment {
167 pub parameter: String,
169 pub current_value: f64,
171 pub recommended_value: f64,
173 pub expected_improvement: f64,
175 pub confidence: f64,
177}