scirs2_ndimage/ai_driven_adaptive_processing/
learning.rs1use scirs2_core::ndarray::{Array1, Array2, Array3};
7use std::collections::{HashMap, VecDeque};
8
9use super::config::{AlgorithmType, ImagePattern, PatternType};
10
11#[derive(Debug, Clone)]
13pub struct NeuralModel {
14 pub weights: Array2<f64>,
16 pub biases: Array1<f64>,
18 pub architecture: String,
20}
21
22#[derive(Debug, Clone)]
24pub struct ProcessingExperience {
25 pub inputfeatures: Array1<f64>,
27 pub action: ProcessingAction,
29 pub reward: f64,
31 pub performance: PerformanceMetrics,
33 pub nextfeatures: Array1<f64>,
35 pub context: String,
37}
38
39#[derive(Debug, Clone)]
41pub struct ProcessingAction {
42 pub primary_algorithm: AlgorithmType,
44 pub secondary_algorithms: Vec<AlgorithmType>,
46 pub parameter_adjustments: HashMap<String, f64>,
48 pub processing_order: Vec<usize>,
50}
51
52#[derive(Debug, Clone)]
54pub struct PerformanceMetrics {
55 pub speed: f64,
57 pub quality: f64,
59 pub memory_usage: f64,
61 pub energy_consumption: f64,
63 pub user_satisfaction: Option<f64>,
65}
66
67#[derive(Debug, Clone)]
69pub struct ContinualLearningState {
70 pub task_knowledge: Vec<TaskKnowledge>,
72 pub forgetting_prevention: ForgettingPreventionState,
74 pub meta_learning_params: Array1<f64>,
76 pub adaptationhistory: Vec<AdaptationRecord>,
78}
79
80#[derive(Debug, Clone)]
82pub struct TaskKnowledge {
83 pub task_id: String,
85 pub parameters: Array1<f64>,
87 pub importance_weights: Array1<f64>,
89 pub task_performance: f64,
91}
92
93#[derive(Debug, Clone)]
95pub struct ForgettingPreventionState {
96 pub ewc_params: Array1<f64>,
98 pub fisher_information: Array2<f64>,
100 pub importance_mask: Array1<bool>,
102 pub memory_strength: f64,
104}
105
106#[derive(Debug, Clone)]
108pub struct AdaptationRecord {
109 pub timestamp: u64,
111 pub adaptation_type: String,
113 pub parameters_changed: Vec<String>,
115 pub improvement: f64,
117}
118
119#[derive(Debug, Clone)]
121pub struct TransferLearningModel {
122 pub source_domain: String,
124 pub target_domain: String,
126 pub transfer_weights: Array2<f64>,
128 pub effectiveness: f64,
130 pub transfer_count: usize,
132}
133
134#[derive(Debug, Clone)]
136pub struct FewShotLearningEntry {
137 pub examples: Vec<Array1<f64>>,
139 pub labels: Vec<String>,
141 pub adaptation_params: Array1<f64>,
143 pub learning_progress: f64,
145}
146
147#[derive(Debug, Clone)]
149pub struct ExplanationTracker {
150 pub decision_explanations: VecDeque<String>,
152 pub feature_importance: HashMap<String, f64>,
154 pub justifications: HashMap<String, String>,
156 pub confidence_scores: HashMap<String, f64>,
158}
159
160#[derive(Debug, Clone)]
162pub struct PredictionModel {
163 pub weights: Array2<f64>,
165 pub model_type: String,
167 pub accuracy: f64,
169 pub epochs_trained: usize,
171}