sklears_preprocessing/
streaming.rs1use scirs2_core::ndarray::Array2;
12use sklears_core::types::Float;
13
14#[derive(Debug, Clone, Default)]
16pub struct StreamingConfig {
17 pub chunk_size: usize,
19}
20
21#[derive(Debug, Clone, Default)]
23pub struct StreamingStandardScaler {
24 }
26
27impl StreamingStandardScaler {
28 pub fn new(_config: StreamingConfig) -> Self {
30 Self::default()
31 }
32}
33
34impl StreamingTransformer for StreamingStandardScaler {
35 fn partial_fit(&mut self, _x: &Array2<Float>) -> Result<(), Box<dyn std::error::Error>> {
36 Ok(())
38 }
39
40 fn transform(&self, x: &Array2<Float>) -> Result<Array2<Float>, Box<dyn std::error::Error>> {
41 Ok(x.clone())
43 }
44}
45
46#[derive(Debug, Clone, Default)]
48pub struct StreamingMinMaxScaler {
49 }
51
52#[derive(Debug, Clone, Default)]
54pub struct StreamingRobustScaler {
55 }
57
58#[derive(Debug, Clone, Default)]
60pub struct StreamingRobustScalerStats {
61 pub n_samples_seen: usize,
63}
64
65#[derive(Debug, Clone, Default)]
67pub struct StreamingLabelEncoder {
68 }
70
71#[derive(Debug, Clone, Default)]
73pub struct StreamingSimpleImputer {
74 }
76
77#[derive(Debug, Clone, Default)]
79pub struct StreamingPipeline {
80 }
82
83#[derive(Debug, Clone, Default)]
85pub struct StreamingStats {
86 pub n_samples_seen: usize,
88}
89
90pub trait StreamingTransformer {
92 fn partial_fit(&mut self, x: &Array2<Float>) -> Result<(), Box<dyn std::error::Error>>;
94
95 fn transform(&self, x: &Array2<Float>) -> Result<Array2<Float>, Box<dyn std::error::Error>>;
97
98 fn is_fitted(&self) -> bool {
100 true }
102
103 fn get_stats(&self) -> StreamingStats {
105 StreamingStats::default()
106 }
107
108 fn reset(&mut self) {
110 }
112}
113
114#[derive(Debug, Clone, Default)]
116pub struct AdaptiveConfig {
117 pub learning_rate: Float,
119}
120
121#[derive(Debug, Clone, Default)]
123pub struct AdaptiveParameterManager {
124 }
126
127#[derive(Debug, Clone, Default)]
129pub struct AdaptiveStreamingStandardScaler {
130 }
132
133#[derive(Debug, Clone, Default)]
135pub struct AdaptiveStreamingMinMaxScaler {
136 }
138
139#[derive(Debug, Clone, Default)]
141pub struct IncrementalPCA {
142 }
144
145#[derive(Debug, Clone, Default)]
147pub struct IncrementalPCAStats {
148 pub n_components: usize,
150}
151
152#[derive(Debug, Clone, Default)]
154pub struct MiniBatchConfig {
155 pub batch_size: usize,
157}
158
159#[derive(Debug, Clone, Default)]
161pub struct MiniBatchIterator {
162 }
164
165#[derive(Debug, Clone, Default)]
167pub struct MiniBatchPipeline {
168 }
170
171#[derive(Debug, Clone, Default)]
173pub struct MiniBatchStats {
174 pub n_batches_processed: usize,
176}
177
178#[derive(Debug, Clone, Default)]
180pub struct MiniBatchStreamingTransformer {
181 }
183
184pub trait MiniBatchTransformer {
186 fn process_batch(
188 &mut self,
189 batch: &Array2<Float>,
190 ) -> Result<Array2<Float>, Box<dyn std::error::Error>>;
191}
192
193#[derive(Debug, Clone, Default)]
195pub struct MultiQuantileEstimator {
196 }
198
199#[derive(Debug, Clone, Default)]
201pub struct OnlineMADEstimator {
202 }
204
205#[derive(Debug, Clone, Default)]
207pub struct OnlineMADStats {
208 pub mad_estimate: Float,
210}
211
212#[derive(Debug, Clone, Default)]
214pub struct OnlineQuantileEstimator {
215 }
217
218#[derive(Debug, Clone, Default)]
220pub struct OnlineQuantileStats {
221 pub quantile: Float,
223}
224
225#[derive(Debug, Clone)]
227pub struct ParameterUpdate {
228 pub parameter: String,
230 pub old_value: Float,
232 pub new_value: Float,
234 pub reason: String,
236}
237
238#[derive(Debug, Clone, Default)]
240pub struct StreamCharacteristics {
241 pub mean: Float,
243 pub variance: Float,
245}