Mon, 06 Jan 2025 21:37:03 -0500
Attempt to do more Serialize / Deserialize but run into csv problems
| 0 | 1 | /*! |
| 2 | Experimental setups. | |
| 3 | */ | |
| 4 | ||
| 5 | //use numeric_literals::replace_float_literals; | |
| 6 | use serde::{Serialize, Deserialize}; | |
| 7 | use clap::ValueEnum; | |
| 8 | use std::collections::HashMap; | |
| 9 | use std::hash::{Hash, Hasher}; | |
| 10 | use std::collections::hash_map::DefaultHasher; | |
| 11 | ||
| 12 | use alg_tools::bisection_tree::*; | |
| 13 | use alg_tools::error::DynResult; | |
| 14 | use alg_tools::norms::Linfinity; | |
| 15 | ||
| 16 | use crate::ExperimentOverrides; | |
| 17 | use crate::kernels::*; | |
|
34
efa60bc4f743
Radon FB + sliding improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
25
diff
changeset
|
18 | use crate::kernels::SupportProductFirst as Prod; |
| 0 | 19 | use crate::pdps::PDPSConfig; |
| 20 | use crate::types::*; | |
| 21 | use crate::run::{ | |
| 22 | RunnableExperiment, | |
|
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
23 | ExperimentV2, |
| 35 | 24 | ExperimentBiased, |
| 0 | 25 | Named, |
| 26 | DefaultAlgorithm, | |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
27 | AlgorithmConfig, |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
28 | ProxTerm |
| 0 | 29 | }; |
| 30 | //use crate::fb::FBGenericConfig; | |
| 31 | use crate::rand_distr::{SerializableNormal, SaltAndPepper}; | |
|
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
32 | use crate::regularisation::Regularisation; |
| 35 | 33 | use alg_tools::euclidean::Euclidean; |
| 34 | use alg_tools::instance::Instance; | |
| 35 | use alg_tools::mapping::Mapping; | |
| 36 | use alg_tools::operator_arithmetic::{MappingSum, Weighted}; | |
| 0 | 37 | |
| 38 | /// Experiments shorthands, to be used with the command line parser | |
| 39 | ||
| 40 | #[derive(ValueEnum, Debug, Copy, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)] | |
| 41 | #[allow(non_camel_case_types)] | |
| 42 | pub enum DefaultExperiment { | |
| 43 | /// One dimension, cut gaussian spread, 2-norm-squared data fidelity | |
| 44 | #[clap(name = "1d")] | |
| 45 | Experiment1D, | |
| 46 | /// One dimension, “fast” spread, 2-norm-squared data fidelity | |
| 47 | #[clap(name = "1d_fast")] | |
| 48 | Experiment1DFast, | |
| 49 | /// Two dimensions, cut gaussian spread, 2-norm-squared data fidelity | |
| 50 | #[clap(name = "2d")] | |
| 51 | Experiment2D, | |
| 52 | /// Two dimensions, “fast” spread, 2-norm-squared data fidelity | |
| 53 | #[clap(name = "2d_fast")] | |
| 54 | Experiment2DFast, | |
| 55 | /// One dimension, cut gaussian spread, 1-norm data fidelity | |
| 56 | #[clap(name = "1d_l1")] | |
| 57 | Experiment1D_L1, | |
| 58 | /// One dimension, ‘“fast” spread, 1-norm data fidelity | |
| 59 | #[clap(name = "1d_l1_fast")] | |
| 60 | Experiment1D_L1_Fast, | |
| 61 | /// Two dimensions, cut gaussian spread, 1-norm data fidelity | |
| 62 | #[clap(name = "2d_l1")] | |
| 63 | Experiment2D_L1, | |
| 64 | /// Two dimensions, “fast” spread, 1-norm data fidelity | |
| 65 | #[clap(name = "2d_l1_fast")] | |
| 66 | Experiment2D_L1_Fast, | |
| 35 | 67 | /// One dimension, “fast” spread, 2-norm-squared data fidelity with extra TV-regularised bias |
| 68 | #[clap(name = "1d_tv_fast")] | |
| 69 | Experiment1D_TV_Fast, | |
| 0 | 70 | } |
| 71 | ||
| 72 | macro_rules! make_float_constant { | |
| 73 | ($name:ident = $value:expr) => { | |
| 74 | #[derive(Debug, Copy, Eq, PartialEq, Clone, Serialize, Deserialize)] | |
| 75 | #[serde(into = "float")] | |
| 76 | struct $name; | |
| 77 | impl Into<float> for $name { | |
| 78 | #[inline] | |
| 79 | fn into(self) -> float { $value } | |
| 80 | } | |
| 81 | impl Constant for $name { | |
| 82 | type Type = float; | |
| 83 | fn value(&self) -> float { $value } | |
| 84 | } | |
| 85 | } | |
| 86 | } | |
| 87 | ||
| 88 | /// Ground-truth measure spike locations and magnitudes for 1D experiments | |
| 89 | static MU_TRUE_1D_BASIC : [(float, float); 4] = [ | |
| 90 | (0.10, 10.0), | |
| 91 | (0.30, 2.0), | |
| 92 | (0.70, 3.0), | |
| 93 | (0.80, 5.0) | |
| 94 | ]; | |
| 95 | ||
| 96 | /// Ground-truth measure spike locations and magnitudes for 2D experiments | |
| 97 | static MU_TRUE_2D_BASIC : [([float; 2], float); 4] = [ | |
| 98 | ([0.15, 0.15], 10.0), | |
| 99 | ([0.75, 0.45], 2.0), | |
| 100 | ([0.80, 0.50], 4.0), | |
| 101 | ([0.30, 0.70], 5.0) | |
| 102 | ]; | |
| 103 | ||
| 35 | 104 | /// The $\{0,1\}$-valued characteristic function of a ball as a [`Mapping`]. |
|
38
0f59c0d02e13
Attempt to do more Serialize / Deserialize but run into csv problems
Tuomo Valkonen <tuomov@iki.fi>
parents:
37
diff
changeset
|
105 | #[derive(Debug,Copy,Clone,Serialize,Deserialize,PartialEq)] |
|
0f59c0d02e13
Attempt to do more Serialize / Deserialize but run into csv problems
Tuomo Valkonen <tuomov@iki.fi>
parents:
37
diff
changeset
|
106 | #[serde(bound( |
|
0f59c0d02e13
Attempt to do more Serialize / Deserialize but run into csv problems
Tuomo Valkonen <tuomov@iki.fi>
parents:
37
diff
changeset
|
107 | serialize = "F : Serialize, |
|
0f59c0d02e13
Attempt to do more Serialize / Deserialize but run into csv problems
Tuomo Valkonen <tuomov@iki.fi>
parents:
37
diff
changeset
|
108 | Loc<F, N> : Serialize", |
|
0f59c0d02e13
Attempt to do more Serialize / Deserialize but run into csv problems
Tuomo Valkonen <tuomov@iki.fi>
parents:
37
diff
changeset
|
109 | deserialize = "F : for<'a> Deserialize<'a>, |
|
0f59c0d02e13
Attempt to do more Serialize / Deserialize but run into csv problems
Tuomo Valkonen <tuomov@iki.fi>
parents:
37
diff
changeset
|
110 | Loc<F, N> : for<'a> Deserialize<'a>", |
|
0f59c0d02e13
Attempt to do more Serialize / Deserialize but run into csv problems
Tuomo Valkonen <tuomov@iki.fi>
parents:
37
diff
changeset
|
111 | ))] |
| 35 | 112 | struct BallCharacteristic<F : Float, const N : usize> { |
| 113 | pub center : Loc<F, N>, | |
| 114 | pub radius : F, | |
| 115 | } | |
| 116 | ||
| 117 | impl<F : Float, const N : usize> Mapping<Loc<F, N>> for BallCharacteristic<F, N> { | |
| 118 | type Codomain =F; | |
| 119 | ||
| 120 | fn apply<I : Instance<Loc<F, N>>>(&self, i : I) -> F { | |
| 121 | if self.center.dist2(i) <= self.radius { | |
| 122 | F::ONE | |
| 123 | } else { | |
| 124 | F::ZERO | |
| 125 | } | |
| 126 | } | |
| 127 | } | |
| 128 | ||
| 0 | 129 | //#[replace_float_literals(F::cast_from(literal))] |
| 130 | impl DefaultExperiment { | |
| 131 | /// Convert the experiment shorthand into a runnable experiment configuration. | |
| 132 | pub fn get_experiment(&self, cli : &ExperimentOverrides<float>) -> DynResult<Box<dyn RunnableExperiment<float>>> { | |
| 133 | let name = "pointsource".to_string() | |
| 134 | + self.to_possible_value().unwrap().get_name(); | |
| 135 | ||
| 136 | let kernel_plot_width = 0.2; | |
| 137 | ||
| 138 | const BASE_SEED : u64 = 915373234; | |
| 139 | ||
| 140 | const N_SENSORS_1D : usize = 100; | |
| 141 | make_float_constant!(SensorWidth1D = 0.4/(N_SENSORS_1D as float)); | |
| 142 | ||
| 143 | const N_SENSORS_2D : usize = 16; | |
| 144 | make_float_constant!(SensorWidth2D = 0.4/(N_SENSORS_2D as float)); | |
| 145 | ||
| 146 | const N_SENSORS_2D_MORE : usize = 32; | |
| 147 | make_float_constant!(SensorWidth2DMore = 0.4/(N_SENSORS_2D_MORE as float)); | |
| 148 | ||
| 149 | make_float_constant!(Variance1 = 0.05.powi(2)); | |
| 150 | make_float_constant!(CutOff1 = 0.15); | |
| 151 | make_float_constant!(Hat1 = 0.16); | |
| 35 | 152 | make_float_constant!(HatBias = 0.05); |
| 0 | 153 | |
| 154 | // We use a different step length for PDPS in 2D experiments | |
| 155 | let pdps_2d = || { | |
| 156 | let τ0 = 3.0; | |
| 157 | PDPSConfig { | |
| 158 | τ0, | |
| 159 | σ0 : 0.99 / τ0, | |
| 160 | .. Default::default() | |
| 161 | } | |
| 162 | }; | |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
163 | let defaults_2d = HashMap::from([ |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
164 | (DefaultAlgorithm::PDPS, AlgorithmConfig::PDPS(pdps_2d(), ProxTerm::Wave)), |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
165 | (DefaultAlgorithm::RadonPDPS, AlgorithmConfig::PDPS(pdps_2d(), ProxTerm::RadonSquared)) |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
166 | ]); |
|
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
167 | |
| 0 | 168 | // We add a hash of the experiment name to the configured |
| 169 | // noise seed to not use the same noise for different experiments. | |
| 170 | let mut h = DefaultHasher::new(); | |
| 171 | name.hash(&mut h); | |
| 172 | let noise_seed = cli.noise_seed.unwrap_or(BASE_SEED) + h.finish(); | |
| 173 | ||
| 174 | use DefaultExperiment::*; | |
| 175 | Ok(match self { | |
| 176 | Experiment1D => { | |
| 177 | let base_spread = Gaussian { variance : Variance1 }; | |
| 178 | let spread_cutoff = BallIndicator { r : CutOff1, exponent : Linfinity }; | |
|
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
179 | Box::new(Named { name, data : ExperimentV2 { |
| 0 | 180 | domain : [[0.0, 1.0]].into(), |
| 181 | sensor_count : [N_SENSORS_1D], | |
|
25
79943be70720
Implement non-negativity constraints for the conditional gradient methods
Tuomo Valkonen <tuomov@iki.fi>
parents:
24
diff
changeset
|
182 | regularisation : Regularisation::NonnegRadon(cli.alpha.unwrap_or(0.09)), |
| 0 | 183 | noise_distr : SerializableNormal::new(0.0, cli.variance.unwrap_or(0.2))?, |
| 184 | dataterm : DataTerm::L2Squared, | |
| 185 | μ_hat : MU_TRUE_1D_BASIC.into(), | |
| 186 | sensor : BallIndicator { r : SensorWidth1D, exponent : Linfinity }, | |
| 187 | spread : Prod(spread_cutoff, base_spread), | |
| 188 | kernel : Prod(AutoConvolution(spread_cutoff), base_spread), | |
| 189 | kernel_plot_width, | |
| 190 | noise_seed, | |
| 191 | algorithm_defaults: HashMap::new(), | |
| 192 | }}) | |
| 193 | }, | |
| 194 | Experiment1DFast => { | |
| 195 | let base_spread = HatConv { radius : Hat1 }; | |
|
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
196 | Box::new(Named { name, data : ExperimentV2 { |
| 0 | 197 | domain : [[0.0, 1.0]].into(), |
| 198 | sensor_count : [N_SENSORS_1D], | |
|
25
79943be70720
Implement non-negativity constraints for the conditional gradient methods
Tuomo Valkonen <tuomov@iki.fi>
parents:
24
diff
changeset
|
199 | regularisation : Regularisation::NonnegRadon(cli.alpha.unwrap_or(0.06)), |
| 0 | 200 | noise_distr : SerializableNormal::new(0.0, cli.variance.unwrap_or(0.2))?, |
| 201 | dataterm : DataTerm::L2Squared, | |
| 202 | μ_hat : MU_TRUE_1D_BASIC.into(), | |
| 203 | sensor : BallIndicator { r : SensorWidth1D, exponent : Linfinity }, | |
| 204 | spread : base_spread, | |
| 205 | kernel : base_spread, | |
| 206 | kernel_plot_width, | |
| 207 | noise_seed, | |
| 208 | algorithm_defaults: HashMap::new(), | |
| 209 | }}) | |
| 210 | }, | |
| 211 | Experiment2D => { | |
| 212 | let base_spread = Gaussian { variance : Variance1 }; | |
| 213 | let spread_cutoff = BallIndicator { r : CutOff1, exponent : Linfinity }; | |
|
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
214 | Box::new(Named { name, data : ExperimentV2 { |
| 0 | 215 | domain : [[0.0, 1.0]; 2].into(), |
| 216 | sensor_count : [N_SENSORS_2D; 2], | |
|
25
79943be70720
Implement non-negativity constraints for the conditional gradient methods
Tuomo Valkonen <tuomov@iki.fi>
parents:
24
diff
changeset
|
217 | regularisation : Regularisation::NonnegRadon(cli.alpha.unwrap_or(0.19)), |
| 0 | 218 | noise_distr : SerializableNormal::new(0.0, cli.variance.unwrap_or(0.25))?, |
| 219 | dataterm : DataTerm::L2Squared, | |
| 220 | μ_hat : MU_TRUE_2D_BASIC.into(), | |
| 221 | sensor : BallIndicator { r : SensorWidth2D, exponent : Linfinity }, | |
| 222 | spread : Prod(spread_cutoff, base_spread), | |
| 223 | kernel : Prod(AutoConvolution(spread_cutoff), base_spread), | |
| 224 | kernel_plot_width, | |
| 225 | noise_seed, | |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
226 | algorithm_defaults: defaults_2d, |
| 0 | 227 | }}) |
| 228 | }, | |
| 229 | Experiment2DFast => { | |
| 230 | let base_spread = HatConv { radius : Hat1 }; | |
|
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
231 | Box::new(Named { name, data : ExperimentV2 { |
| 0 | 232 | domain : [[0.0, 1.0]; 2].into(), |
| 233 | sensor_count : [N_SENSORS_2D; 2], | |
|
25
79943be70720
Implement non-negativity constraints for the conditional gradient methods
Tuomo Valkonen <tuomov@iki.fi>
parents:
24
diff
changeset
|
234 | regularisation : Regularisation::NonnegRadon(cli.alpha.unwrap_or(0.12)), |
| 0 | 235 | noise_distr : SerializableNormal::new(0.0, cli.variance.unwrap_or(0.15))?, //0.25 |
| 236 | dataterm : DataTerm::L2Squared, | |
| 237 | μ_hat : MU_TRUE_2D_BASIC.into(), | |
| 238 | sensor : BallIndicator { r : SensorWidth2D, exponent : Linfinity }, | |
| 239 | spread : base_spread, | |
| 240 | kernel : base_spread, | |
| 241 | kernel_plot_width, | |
| 242 | noise_seed, | |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
243 | algorithm_defaults: defaults_2d, |
| 0 | 244 | }}) |
| 245 | }, | |
| 246 | Experiment1D_L1 => { | |
| 247 | let base_spread = Gaussian { variance : Variance1 }; | |
| 248 | let spread_cutoff = BallIndicator { r : CutOff1, exponent : Linfinity }; | |
|
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
249 | Box::new(Named { name, data : ExperimentV2 { |
| 0 | 250 | domain : [[0.0, 1.0]].into(), |
| 251 | sensor_count : [N_SENSORS_1D], | |
|
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
252 | regularisation : Regularisation::NonnegRadon(cli.alpha.unwrap_or(0.1)), |
| 0 | 253 | noise_distr : SaltAndPepper::new( |
| 254 | cli.salt_and_pepper.as_ref().map_or(0.6, |v| v[0]), | |
| 255 | cli.salt_and_pepper.as_ref().map_or(0.4, |v| v[1]) | |
| 256 | )?, | |
| 257 | dataterm : DataTerm::L1, | |
| 258 | μ_hat : MU_TRUE_1D_BASIC.into(), | |
| 259 | sensor : BallIndicator { r : SensorWidth1D, exponent : Linfinity }, | |
| 260 | spread : Prod(spread_cutoff, base_spread), | |
| 261 | kernel : Prod(AutoConvolution(spread_cutoff), base_spread), | |
| 262 | kernel_plot_width, | |
| 263 | noise_seed, | |
| 264 | algorithm_defaults: HashMap::new(), | |
| 265 | }}) | |
| 266 | }, | |
| 267 | Experiment1D_L1_Fast => { | |
| 268 | let base_spread = HatConv { radius : Hat1 }; | |
|
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
269 | Box::new(Named { name, data : ExperimentV2 { |
| 0 | 270 | domain : [[0.0, 1.0]].into(), |
| 271 | sensor_count : [N_SENSORS_1D], | |
|
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
272 | regularisation : Regularisation::NonnegRadon(cli.alpha.unwrap_or(0.12)), |
| 0 | 273 | noise_distr : SaltAndPepper::new( |
| 274 | cli.salt_and_pepper.as_ref().map_or(0.6, |v| v[0]), | |
| 275 | cli.salt_and_pepper.as_ref().map_or(0.4, |v| v[1]) | |
| 276 | )?, | |
| 277 | dataterm : DataTerm::L1, | |
| 278 | μ_hat : MU_TRUE_1D_BASIC.into(), | |
| 279 | sensor : BallIndicator { r : SensorWidth1D, exponent : Linfinity }, | |
| 280 | spread : base_spread, | |
| 281 | kernel : base_spread, | |
| 282 | kernel_plot_width, | |
| 283 | noise_seed, | |
| 284 | algorithm_defaults: HashMap::new(), | |
| 285 | }}) | |
| 286 | }, | |
| 287 | Experiment2D_L1 => { | |
| 288 | let base_spread = Gaussian { variance : Variance1 }; | |
| 289 | let spread_cutoff = BallIndicator { r : CutOff1, exponent : Linfinity }; | |
|
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
290 | Box::new(Named { name, data : ExperimentV2 { |
| 0 | 291 | domain : [[0.0, 1.0]; 2].into(), |
| 292 | sensor_count : [N_SENSORS_2D; 2], | |
|
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
293 | regularisation : Regularisation::NonnegRadon(cli.alpha.unwrap_or(0.35)), |
| 0 | 294 | noise_distr : SaltAndPepper::new( |
| 295 | cli.salt_and_pepper.as_ref().map_or(0.8, |v| v[0]), | |
| 296 | cli.salt_and_pepper.as_ref().map_or(0.2, |v| v[1]) | |
| 297 | )?, | |
| 298 | dataterm : DataTerm::L1, | |
| 299 | μ_hat : MU_TRUE_2D_BASIC.into(), | |
| 300 | sensor : BallIndicator { r : SensorWidth2D, exponent : Linfinity }, | |
| 301 | spread : Prod(spread_cutoff, base_spread), | |
| 302 | kernel : Prod(AutoConvolution(spread_cutoff), base_spread), | |
| 303 | kernel_plot_width, | |
| 304 | noise_seed, | |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
305 | algorithm_defaults: defaults_2d, |
| 0 | 306 | }}) |
| 307 | }, | |
| 308 | Experiment2D_L1_Fast => { | |
| 309 | let base_spread = HatConv { radius : Hat1 }; | |
|
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
310 | Box::new(Named { name, data : ExperimentV2 { |
| 0 | 311 | domain : [[0.0, 1.0]; 2].into(), |
| 312 | sensor_count : [N_SENSORS_2D; 2], | |
|
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
313 | regularisation : Regularisation::NonnegRadon(cli.alpha.unwrap_or(0.40)), |
| 0 | 314 | noise_distr : SaltAndPepper::new( |
| 315 | cli.salt_and_pepper.as_ref().map_or(0.8, |v| v[0]), | |
| 316 | cli.salt_and_pepper.as_ref().map_or(0.2, |v| v[1]) | |
| 317 | )?, | |
| 318 | dataterm : DataTerm::L1, | |
| 319 | μ_hat : MU_TRUE_2D_BASIC.into(), | |
| 320 | sensor : BallIndicator { r : SensorWidth2D, exponent : Linfinity }, | |
| 321 | spread : base_spread, | |
| 322 | kernel : base_spread, | |
| 323 | kernel_plot_width, | |
| 324 | noise_seed, | |
|
37
c5d8bd1a7728
Generic proximal penalty support
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
325 | algorithm_defaults: defaults_2d, |
| 0 | 326 | }}) |
| 327 | }, | |
| 35 | 328 | Experiment1D_TV_Fast => { |
| 329 | let base_spread = HatConv { radius : HatBias }; | |
| 330 | Box::new(Named { name, data : ExperimentBiased { | |
| 331 | λ : 0.02, | |
| 332 | bias : MappingSum::new([ | |
| 333 | Weighted::new(1.0, BallCharacteristic{ center : 0.3.into(), radius : 0.2 }), | |
| 334 | Weighted::new(0.5, BallCharacteristic{ center : 0.6.into(), radius : 0.3 }), | |
| 335 | ]), | |
| 336 | base : ExperimentV2 { | |
| 337 | domain : [[0.0, 1.0]].into(), | |
| 338 | sensor_count : [N_SENSORS_1D], | |
| 339 | regularisation : Regularisation::NonnegRadon(cli.alpha.unwrap_or(0.2)), | |
| 340 | noise_distr : SerializableNormal::new(0.0, cli.variance.unwrap_or(0.1))?, | |
| 341 | dataterm : DataTerm::L2Squared, | |
| 342 | μ_hat : MU_TRUE_1D_BASIC.into(), | |
| 343 | sensor : BallIndicator { r : SensorWidth1D, exponent : Linfinity }, | |
| 344 | spread : base_spread, | |
| 345 | kernel : base_spread, | |
| 346 | kernel_plot_width, | |
| 347 | noise_seed, | |
| 348 | algorithm_defaults: HashMap::new(), | |
| 349 | }, | |
| 350 | }}) | |
| 351 | }, | |
| 0 | 352 | }) |
| 353 | } | |
| 354 | } | |
| 355 |