Last change
on this file since 18106 was
17973,
checked in by chaider, 4 years ago
|
#3075
- Added target without noise to noisy instances
- Moved noise calculation to descriptor
|
File size:
1.2 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Threading.Tasks;
|
---|
6 | using HeuristicLab.Common;
|
---|
7 | using HeuristicLab.Core;
|
---|
8 | using HeuristicLab.Random;
|
---|
9 |
|
---|
10 | namespace HeuristicLab.Problems.Instances.DataAnalysis {
|
---|
11 | public abstract class FeynmanDescriptor : ArtificialRegressionDataDescriptor {
|
---|
12 | protected double? noiseRatio;
|
---|
13 | public override string Description {
|
---|
14 | get {
|
---|
15 | return "Feynman instances ... descriptions follows: " + Environment.NewLine;
|
---|
16 | }
|
---|
17 | }
|
---|
18 |
|
---|
19 | public List<double> GetNoisyTarget(List<double> target, IRandom rand) {
|
---|
20 | if (noiseRatio == null) return null;
|
---|
21 |
|
---|
22 | var targetNoise = new List<double>();
|
---|
23 | var sigmaNoise = Math.Sqrt(noiseRatio.Value) * target.StandardDeviationPop();
|
---|
24 | targetNoise.AddRange(target.Select(md => md + NormalDistributedRandomPolar.NextDouble(rand, 0, sigmaNoise)));
|
---|
25 | return targetNoise;
|
---|
26 |
|
---|
27 | }
|
---|
28 |
|
---|
29 | protected override int TrainingPartitionStart { get { return 0; } }
|
---|
30 | protected override int TrainingPartitionEnd { get { return 100; } }
|
---|
31 | protected override int TestPartitionStart { get { return 100; } }
|
---|
32 | protected override int TestPartitionEnd { get { return 200; } }
|
---|
33 | }
|
---|
34 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.