scirs2_datasets/generators/
config.rs1use crate::error::{DatasetsError, Result};
4
5#[derive(Debug, Clone, Copy)]
7pub enum MissingPattern {
8 MCAR,
10 MAR,
12 MNAR,
14 Block,
16}
17
18#[derive(Debug, Clone, Copy)]
20pub enum OutlierType {
21 Point,
23 Contextual,
25 Collective,
27}
28
29#[derive(Debug, Clone)]
31pub struct GpuConfig {
32 pub use_gpu: bool,
34 pub device_id: usize,
36 pub use_single_precision: bool,
38 pub chunk_size: usize,
40}
41
42impl Default for GpuConfig {
43 fn default() -> Self {
44 Self {
45 use_gpu: true,
46 device_id: 0,
47 use_single_precision: false,
48 chunk_size: 10000,
49 }
50 }
51}
52
53impl GpuConfig {
54 pub fn new() -> Self {
56 Self::default()
57 }
58
59 pub fn with_gpu(mut self, use_gpu: bool) -> Self {
61 self.use_gpu = use_gpu;
62 self
63 }
64
65 pub fn with_device(mut self, device_id: usize) -> Self {
67 self.device_id = device_id;
68 self
69 }
70
71 pub fn with_single_precision(mut self, single_precision: bool) -> Self {
73 self.use_single_precision = single_precision;
74 self
75 }
76
77 pub fn with_chunk_size(mut self, chunk_size: usize) -> Self {
79 self.chunk_size = chunk_size;
80 self
81 }
82}
83
84#[derive(Debug, Clone)]
86pub struct ManifoldConfig {
87 pub manifold_type: ManifoldType,
89 pub n_samples: usize,
91 pub noise: f64,
93 pub randomseed: Option<u64>,
95 pub parameters: std::collections::HashMap<String, f64>,
97}
98
99#[derive(Debug, Clone)]
101pub enum ManifoldType {
102 SCurve,
104 SwissRoll {
106 hole: bool,
108 },
109 SeveredSphere,
111 TwinPeaks,
113 Helix {
115 n_turns: f64,
117 },
118 IntersectingManifolds,
120 Torus {
122 major_radius: f64,
124 minor_radius: f64,
126 },
127}
128
129impl Default for ManifoldConfig {
130 fn default() -> Self {
131 Self {
132 manifold_type: ManifoldType::SCurve,
133 n_samples: 1000,
134 noise: 0.1,
135 randomseed: None,
136 parameters: std::collections::HashMap::new(),
137 }
138 }
139}
140
141impl ManifoldConfig {
142 pub fn new(manifold_type: ManifoldType) -> Self {
144 Self {
145 manifold_type,
146 ..Default::default()
147 }
148 }
149
150 pub fn with_samples(mut self, n_samples: usize) -> Self {
152 self.n_samples = n_samples;
153 self
154 }
155
156 pub fn with_noise(mut self, noise: f64) -> Self {
158 self.noise = noise;
159 self
160 }
161
162 pub fn with_seed(mut self, seed: u64) -> Self {
164 self.randomseed = Some(seed);
165 self
166 }
167
168 pub fn with_parameter(mut self, name: String, value: f64) -> Self {
170 self.parameters.insert(name, value);
171 self
172 }
173}