Changeset 11434
- Timestamp:
- 10/09/14 11:15:59 (10 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionEight.cs
r11171 r11434 48 48 protected override List<List<double>> GenerateValues() { 49 49 List<List<double>> data = new List<List<double>>(); 50 data.Add(ValueGenerator.GenerateSteps(0 , 100, 1).ToList());51 data[0].AddRange(ValueGenerator.GenerateSteps(0 , 100, 0.1));50 data.Add(ValueGenerator.GenerateSteps(0m, 100, 1).Select(v => (double)v).ToList()); 51 data[0].AddRange(ValueGenerator.GenerateSteps(0m, 100, 0.1m).Select(v => (double)v)); 52 52 53 53 double x; -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionEleven.cs
r11171 r11434 49 49 protected override List<List<double>> GenerateValues() { 50 50 List<List<double>> data = new List<List<double>>(); 51 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01 ).ToList();51 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01m).Select(v => (double)v).ToList(); 52 52 List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData }; 53 53 -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionFifteen.cs
r11171 r11434 48 48 protected override List<List<double>> GenerateValues() { 49 49 List<List<double>> data = new List<List<double>>(); 50 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01 ).ToList();50 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01m).Select(v => (double)v).ToList(); 51 51 List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData }; 52 52 -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionFour.cs
r11171 r11434 49 49 protected override List<List<double>> GenerateValues() { 50 50 List<List<double>> data = new List<List<double>>(); 51 data.Add(ValueGenerator.GenerateSteps(0, 10, 0.05 ).ToList());52 data[0].AddRange(ValueGenerator.GenerateSteps(0.05 , 10.05, 0.05));51 data.Add(ValueGenerator.GenerateSteps(0, 10, 0.05m).Select(v => (double)v).ToList()); 52 data[0].AddRange(ValueGenerator.GenerateSteps(0.05m, 10.05m, 0.05m).Select(v => (double)v)); 53 53 54 54 double x; -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionFourteen.cs
r11171 r11434 48 48 protected override List<List<double>> GenerateValues() { 49 49 List<List<double>> data = new List<List<double>>(); 50 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01 ).ToList();50 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01m).Select(v => (double) v).ToList(); 51 51 List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData }; 52 52 -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionNine.cs
r11171 r11434 48 48 protected override List<List<double>> GenerateValues() { 49 49 List<List<double>> data = new List<List<double>>(); 50 data.Add(ValueGenerator.GenerateSteps(0 , 100, 1).ToList());51 data[0].AddRange(ValueGenerator.GenerateSteps(0, 100, 0.1 ));50 data.Add(ValueGenerator.GenerateSteps(0m, 100, 1).Select(v => (double)v).ToList()); 51 data[0].AddRange(ValueGenerator.GenerateSteps(0, 100, 0.1m).Select(v => (double)v)); 52 52 53 53 double x; -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionOne.cs
r11171 r11434 48 48 protected override List<List<double>> GenerateValues() { 49 49 List<List<double>> data = new List<List<double>>(); 50 data.Add(ValueGenerator.GenerateSteps(-1, 1, 0.1 ).ToList());51 data[0].AddRange(ValueGenerator.GenerateSteps(-1, 1, 0.001 ));50 data.Add(ValueGenerator.GenerateSteps(-1, 1, 0.1m).Select(v => (double)v).ToList()); 51 data[0].AddRange(ValueGenerator.GenerateSteps(-1, 1, 0.001m).Select(v => (double)v)); 52 52 53 53 double x; -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionSeven.cs
r11171 r11434 49 49 protected override List<List<double>> GenerateValues() { 50 50 List<List<double>> data = new List<List<double>>(); 51 data.Add(ValueGenerator.GenerateSteps(1 , 100, 1).ToList());52 data[0].AddRange(ValueGenerator.GenerateSteps(1 , 100, 0.1));51 data.Add(ValueGenerator.GenerateSteps(1m, 100, 1).Select(v => (double)v).ToList()); 52 data[0].AddRange(ValueGenerator.GenerateSteps(1m, 100, 0.1m).Select(v => (double)v)); 53 53 54 54 double x; -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionSix.cs
r11171 r11434 48 48 protected override List<List<double>> GenerateValues() { 49 49 List<List<double>> data = new List<List<double>>(); 50 data.Add(ValueGenerator.GenerateSteps(1 , 50, 1).ToList());51 data[0].AddRange(ValueGenerator.GenerateSteps(1 , 120, 1));50 data.Add(ValueGenerator.GenerateSteps(1m, 50, 1).Select(v => (double)v).ToList()); 51 data[0].AddRange(ValueGenerator.GenerateSteps(1m, 120, 1).Select(v => (double)v)); 52 52 53 53 double x; -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionTen.cs
r11171 r11434 49 49 List<List<double>> data = new List<List<double>>(); 50 50 51 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(0, 1, 0.01 ).ToList();51 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(0, 1, 0.01m).Select(v => (double)v).ToList(); 52 52 List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData }; 53 53 -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionThirteen.cs
r11171 r11434 48 48 protected override List<List<double>> GenerateValues() { 49 49 List<List<double>> data = new List<List<double>>(); 50 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01 ).ToList();50 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01m).Select(v => (double)v).ToList(); 51 51 List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData }; 52 52 -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionThree.cs
r11171 r11434 48 48 protected override List<List<double>> GenerateValues() { 49 49 List<List<double>> data = new List<List<double>>(); 50 data.Add(ValueGenerator.GenerateSteps(-3, 3, 0.1 ).ToList());51 data[0].AddRange(ValueGenerator.GenerateSteps(-3, 3, 0.001 ));50 data.Add(ValueGenerator.GenerateSteps(-3, 3, 0.1m).Select(v => (double)v).ToList()); 51 data[0].AddRange(ValueGenerator.GenerateSteps(-3, 3, 0.001m).Select(v => (double)v)); 52 52 53 53 double x; -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionTwelve.cs
r11171 r11434 48 48 protected override List<List<double>> GenerateValues() { 49 49 List<List<double>> data = new List<List<double>>(); 50 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01 ).ToList();50 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01m).Select(v => (double)v).ToList(); 51 51 List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData }; 52 52 -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionTwo.cs
r11171 r11434 48 48 protected override List<List<double>> GenerateValues() { 49 49 List<List<double>> data = new List<List<double>>(); 50 data.Add(ValueGenerator.GenerateSteps(-2, 2, 0.1 ).ToList());51 data[0].AddRange(ValueGenerator.GenerateSteps(-2, 2, 0.001 ));50 data.Add(ValueGenerator.GenerateSteps(-2, 2, 0.1m).Select(v => (double)v).ToList()); 51 data[0].AddRange(ValueGenerator.GenerateSteps(-2, 2, 0.001m).Select(v => (double)v)); 52 52 53 53 double x; -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/ValueGenerator.cs
r11348 r11434 31 31 32 32 /// <summary> 33 /// Generates a sequence of evenly spaced points between start and end (inclusive!). 33 /// Generates a sequence of evenly spaced points by returning the start value and adding the stepwidth until the end is reached or surpassed. 34 /// 34 35 /// </summary> 35 36 /// <param name="start">The smallest and first value of the sequence.</param> 36 37 /// <param name="end">The largest and last value of the sequence.</param> 37 38 /// <param name="stepWidth">The step size between subsequent values.</param> 38 /// <returns>An sequence of values from start to end (inclusive)</returns> 39 /// <returns>A sequence of values from start to end (inclusive)</returns> 40 [Obsolete("It is recommended to use the decimal overload to achieve a higher numerical accuracy.")] 39 41 public static IEnumerable<double> GenerateSteps(double start, double end, double stepWidth) { 40 if (stepWidth.IsAlmost(0)) 42 //mkommend: IEnumerable.Cast fails due to boxing and unboxing of the involved types 43 // http://referencesource.microsoft.com/#System.Core/System/Linq/Enumerable.cs#27bb217a6d5457ec 44 // http://blogs.msdn.com/b/ericlippert/archive/2009/03/19/representation-and-identity.aspx 45 46 return GenerateSteps((decimal)start, (decimal)end, (decimal)stepWidth).Select(x => (double)x); 47 } 48 49 /// <summary> 50 /// Generates a sequence of evenly spaced points by returning the start value and adding the stepwidth until the end is reached or surpassed. 51 /// </summary> 52 /// <param name="start">The smallest and first value of the sequence.</param> 53 /// <param name="end">The largest and last value of the sequence.</param> 54 /// <param name="stepWidth">The step size between subsequent values.</param> 55 /// <returns>A sequence of values from start to end</returns> 56 public static IEnumerable<decimal> GenerateSteps(decimal start, decimal end, decimal stepWidth) { 57 if (stepWidth == 0) 41 58 throw new ArgumentException("The step width cannot be zero."); 42 59 if (start < end && stepWidth < 0) … … 44 61 if (start > end && stepWidth > 0) 45 62 throw new ArgumentException("The step width must be smaller than zero for decreasing sequences (start > end)."); 46 double x = start; 47 // x<=end could skip the last value because of numerical problems48 while (x < end || x.IsAlmost(end)) {63 64 decimal x = start; 65 while (x <= end) { 49 66 yield return x; 50 67 x += stepWidth; 51 68 } 52 }53 54 /// <summary>55 /// Generate a logarithmic sequence between start and end by applying a power-of-10 function to an underlying evenly spaced sequence56 /// </summary>57 /// <param name="start">The start of the sequence</param>58 /// <param name="end">The end of the sequence</param>59 /// <param name="stepWidth">The stepwidth for the original sequence before the points are transformed</param>60 /// <returns>A logarithmic sequence from start to end (inclusive)</returns>61 public static IEnumerable<double> GenerateLogarithmicSteps(double start, double end, double stepWidth) {62 return GenerateSteps(start, end, stepWidth, x => Math.Pow(10, x));63 69 } 64 70 … … 71 77 /// <param name="transform">The transform function</param> 72 78 /// <returns></returns> 79 [Obsolete("It is recommended to use the decimal overload to achieve a higher numerical accuracy.")] 73 80 public static IEnumerable<double> GenerateSteps(double start, double end, double stepWidth, Func<double, double> transform) { 81 return GenerateSteps(start,end, stepWidth).Select(transform); 82 } 83 84 /// <summary> 85 /// Generates a sequence of points between start and end according to given transformation 86 /// </summary> 87 /// <param name="start">The smallest and first value of the sequence.</param> 88 /// <param name="end">The largest and last value of the sequence.</param> 89 /// <param name="stepWidth">The step size between subsequent values (before transform)</param> 90 /// <param name="transform">The transform function</param> 91 /// <returns></returns> 92 public static IEnumerable<decimal> GenerateSteps(decimal start, decimal end, decimal stepWidth, Func<decimal, decimal> transform) { 74 93 return GenerateSteps(start, end, stepWidth).Select(transform); 75 94 } -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Various/SpatialCoevolution.cs
r11171 r11434 53 53 List<List<double>> data = new List<List<double>>(); 54 54 55 List<double> evenlySpacedSequence = ValueGenerator.GenerateSteps(-5, 5, 0.4 ).ToList();55 List<double> evenlySpacedSequence = ValueGenerator.GenerateSteps(-5, 5, 0.4m).Select(v => (double)v).ToList(); 56 56 List<List<double>> trainingData = new List<List<double>>() { evenlySpacedSequence, evenlySpacedSequence }; 57 57 var combinations = ValueGenerator.GenerateAllCombinationsOfValuesInLists(trainingData).ToList(); -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Vladislavleva/KotanchekFunction.cs
r11171 r11434 49 49 List<List<double>> data = new List<List<double>>(); 50 50 51 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-0.2 , 4.2, 0.1).ToList();51 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-0.2m, 4.2m, 0.1m).Select(v => (double)v).ToList(); 52 52 List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData }; 53 53 var combinations = ValueGenerator.GenerateAllCombinationsOfValuesInLists(testData).ToList<IEnumerable<double>>(); -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Vladislavleva/RationalPolynomialThreeDimensional.cs
r11171 r11434 55 55 56 56 List<List<double>> testData = new List<List<double>>() { 57 ValueGenerator.GenerateSteps(-0.05 , 2.05, 0.15).ToList(),58 ValueGenerator.GenerateSteps( 0.95 , 2.05, 0.1).ToList(),59 ValueGenerator.GenerateSteps(-0.05 , 2.05, 0.15).ToList()57 ValueGenerator.GenerateSteps(-0.05m, 2.05m, 0.15m).Select(v => (double)v).ToList(), 58 ValueGenerator.GenerateSteps( 0.95m, 2.05m, 0.1m).Select(v => (double)v).ToList(), 59 ValueGenerator.GenerateSteps(-0.05m, 2.05m, 0.15m).Select(v => (double)v).ToList() 60 60 }; 61 61 -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Vladislavleva/RationalPolynomialTwoDimensional.cs
r11171 r11434 49 49 List<List<double>> data = new List<List<double>>(); 50 50 51 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-0.25 , 6.35, 0.2).ToList();51 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-0.25m, 6.35m, 0.2m).Select(v => (double)v).ToList(); 52 52 53 53 List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData }; -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Vladislavleva/SalutowiczFunctionOneDimensional.cs
r11171 r11434 48 48 protected override List<List<double>> GenerateValues() { 49 49 List<List<double>> data = new List<List<double>>(); 50 data.Add(ValueGenerator.GenerateSteps(0.05 , 10, 0.1).ToList());51 data[0].AddRange(ValueGenerator.GenerateSteps(-0.5 , 10.5, 0.05));50 data.Add(ValueGenerator.GenerateSteps(0.05m, 10, 0.1m).Select(v => (double)v).ToList()); 51 data[0].AddRange(ValueGenerator.GenerateSteps(-0.5m, 10.5m, 0.05m).Select(v => (double)v)); 52 52 53 53 double x; -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Vladislavleva/SalutowiczFunctionTwoDimensional.cs
r11171 r11434 49 49 List<List<double>> data = new List<List<double>>(); 50 50 List<List<double>> trainingData = new List<List<double>>() { 51 ValueGenerator.GenerateSteps(0.05 , 10, 0.1).ToList(),52 ValueGenerator.GenerateSteps(0.05 , 10.05, 2).ToList()51 ValueGenerator.GenerateSteps(0.05m, 10, 0.1m).Select(v => (double)v).ToList(), 52 ValueGenerator.GenerateSteps(0.05m, 10.05m, 2).Select(v => (double)v).ToList() 53 53 }; 54 54 55 55 List<List<double>> testData = new List<List<double>>() { 56 ValueGenerator.GenerateSteps(-0.5 , 10.5, 0.05).ToList(),57 ValueGenerator.GenerateSteps(-0.5 , 10.5, 0.5).ToList()56 ValueGenerator.GenerateSteps(-0.5m, 10.5m, 0.05m).Select(v => (double)v).ToList(), 57 ValueGenerator.GenerateSteps(-0.5m, 10.5m, 0.5m).Select(v => (double)v).ToList() 58 58 }; 59 59 -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Vladislavleva/SineCosineFunction.cs
r11171 r11434 48 48 protected override List<List<double>> GenerateValues() { 49 49 List<List<double>> data = new List<List<double>>(); 50 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-0.05 , 6.05, 0.02).ToList();50 List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-0.05m, 6.05m, 0.02m).Select(v => (double)v).ToList(); 51 51 List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData }; 52 52 var combinations = ValueGenerator.GenerateAllCombinationsOfValuesInLists(testData).ToList<IEnumerable<double>>();
Note: See TracChangeset
for help on using the changeset viewer.