Changeset 14228 for trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Various
- Timestamp:
- 08/02/16 18:09:47 (8 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Various
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Various/BreimanOne.cs
r14185 r14228 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Random; 26 27 … … 43 44 protected override int TestPartitionEnd { get { return 10001; } } 44 45 45 protected static FastRandom rand = new FastRandom(); 46 public int Seed { get; } 47 48 public BreimanOne() : this((int)DateTime.Now.Ticks) { } 49 public BreimanOne(int seed) : base() { 50 Seed = seed; 51 } 46 52 47 53 protected override List<List<double>> GenerateValues() { 48 54 List<List<double>> data = new List<List<double>>(); 49 55 List<int> values = new List<int>() { -1, 1 }; 50 data.Add(GenerateUniformIntegerDistribution(values, TestPartitionEnd)); 56 var rand = new MersenneTwister((uint)Seed); 57 data.Add(GenerateUniformIntegerDistribution(rand, values, TestPartitionEnd)); 51 58 values.Add(0); 52 59 for (int i = 0; i < AllowedInputVariables.Count() - 1; i++) { 53 data.Add(GenerateUniformIntegerDistribution( values, TestPartitionEnd));60 data.Add(GenerateUniformIntegerDistribution(rand, values, TestPartitionEnd)); 54 61 } 55 56 62 double x1, x2, x3, x4, x5, x6, x7; 57 63 double f; … … 79 85 } 80 86 81 private List<double> GenerateUniformIntegerDistribution( List<int> classes, int amount) {87 private List<double> GenerateUniformIntegerDistribution(IRandom rand, List<int> classes, int amount) { 82 88 List<double> values = new List<double>(); 83 89 for (int i = 0; i < amount; i++) { -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Various/FriedmanOne.cs
r14185 r14228 42 42 protected override int TestPartitionStart { get { return 5000; } } 43 43 protected override int TestPartitionEnd { get { return 10000; } } 44 public int Seed { get; } 44 45 45 protected static FastRandom rand = new FastRandom(); 46 public FriedmanOne() : this((int)DateTime.Now.Ticks) { } 47 48 public FriedmanOne(int seed) : base() { 49 Seed = seed; 50 } 46 51 47 52 protected override List<List<double>> GenerateValues() { 48 53 List<List<double>> data = new List<List<double>>(); 54 var rand = new MersenneTwister((uint)Seed); 49 55 for (int i = 0; i < AllowedInputVariables.Count(); i++) { 50 data.Add(ValueGenerator.GenerateUniformDistributedValues( 10000, 0, 1).ToList());56 data.Add(ValueGenerator.GenerateUniformDistributedValues(rand.Next(), 10000, 0, 1).ToList()); 51 57 } 52 58 -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Various/FriedmanTwo.cs
r14185 r14228 43 43 protected override int TestPartitionEnd { get { return 10000; } } 44 44 45 p rotected static FastRandom rand = new FastRandom();45 public int Seed { get; } 46 46 47 public FriedmanTwo() : this((int)DateTime.Now.Ticks) { } 48 49 public FriedmanTwo(int seed) : base() { 50 Seed = seed; 51 } 47 52 protected override List<List<double>> GenerateValues() { 48 53 List<List<double>> data = new List<List<double>>(); 54 var rand = new MersenneTwister((uint)Seed); 55 49 56 for (int i = 0; i < AllowedInputVariables.Count(); i++) { 50 data.Add(ValueGenerator.GenerateUniformDistributedValues( 10000, 0, 1).ToList());57 data.Add(ValueGenerator.GenerateUniformDistributedValues(rand.Next(), 10000, 0, 1).ToList()); 51 58 } 52 59 -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Various/PolyTen.cs
r14185 r14228 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Random; 25 26 26 27 namespace HeuristicLab.Problems.Instances.DataAnalysis { … … 45 46 protected override int TestPartitionStart { get { return 250; } } 46 47 protected override int TestPartitionEnd { get { return 500; } } 48 public int Seed { get; } 47 49 50 public PolyTen() : this((int)DateTime.Now.Ticks) { } 51 52 public PolyTen(int seed) : base() { 53 Seed = seed; 54 } 48 55 protected override List<List<double>> GenerateValues() { 49 56 List<List<double>> data = new List<List<double>>(); 57 var rand = new MersenneTwister((uint)Seed); 58 50 59 for (int i = 0; i < AllowedInputVariables.Count(); i++) { 51 data.Add(ValueGenerator.GenerateUniformDistributedValues( TestPartitionEnd, -1, 1).ToList());60 data.Add(ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, -1, 1).ToList()); 52 61 } 53 62 -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Various/SpatialCoevolution.cs
r14185 r14228 24 24 using System.Linq; 25 25 using HeuristicLab.Common; 26 using HeuristicLab.Random; 26 27 27 28 namespace HeuristicLab.Problems.Instances.DataAnalysis { … … 50 51 protected override int TestPartitionStart { get { return 676; } } 51 52 protected override int TestPartitionEnd { get { return 1676; } } 53 public int Seed { get; } 52 54 55 public SpatialCoevolution() : this((int)DateTime.Now.Ticks) { } 56 57 public SpatialCoevolution(int seed) : base() { 58 Seed = seed; 59 } 53 60 protected override List<List<double>> GenerateValues() { 54 61 List<List<double>> data = new List<List<double>>(); … … 57 64 List<List<double>> trainingData = new List<List<double>>() { evenlySpacedSequence, evenlySpacedSequence }; 58 65 var combinations = ValueGenerator.GenerateAllCombinationsOfValuesInLists(trainingData).ToList(); 66 var rand = new MersenneTwister((uint)Seed); 59 67 60 68 for (int i = 0; i < AllowedInputVariables.Count(); i++) { 61 69 data.Add(combinations[i].ToList()); 62 data[i].AddRange(ValueGenerator.GenerateUniformDistributedValues( 1000, -5, 5).ToList());70 data[i].AddRange(ValueGenerator.GenerateUniformDistributedValues(rand.Next(), 1000, -5, 5).ToList()); 63 71 } 64 72 -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Various/VariousInstanceProvider.cs
r14185 r14228 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Random; 24 25 25 26 namespace HeuristicLab.Problems.Instances.DataAnalysis { … … 37 38 get { return ""; } 38 39 } 40 public int Seed { get; } 39 41 42 public VariousInstanceProvider() : this((int)DateTime.Now.Ticks) { } 43 44 public VariousInstanceProvider(int seed) : base() { 45 Seed = seed; 46 } 40 47 public override IEnumerable<IDataDescriptor> GetDataDescriptors() { 41 48 List<IDataDescriptor> descriptorList = new List<IDataDescriptor>(); 42 descriptorList.Add(new BreimanOne()); 43 descriptorList.Add(new FriedmanOne()); 44 descriptorList.Add(new FriedmanTwo()); 45 descriptorList.Add(new PolyTen()); 46 descriptorList.Add(new SpatialCoevolution()); 49 var rand = new MersenneTwister((uint)Seed); 50 descriptorList.Add(new BreimanOne(rand.Next())); 51 descriptorList.Add(new FriedmanOne(rand.Next())); 52 descriptorList.Add(new FriedmanTwo(rand.Next())); 53 descriptorList.Add(new PolyTen(rand.Next())); 54 descriptorList.Add(new SpatialCoevolution(rand.Next())); 47 55 return descriptorList; 48 56 }
Note: See TracChangeset
for help on using the changeset viewer.