#region License Information
/* HeuristicLab
* Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System;
using System.Collections.Generic;
using HeuristicLab.Data;
namespace HeuristicLab.Problems.DataAnalysis.Benchmarks {
public class KornFunctionTen : RegressionToyBenchmark {
public KornFunctionTen() {
Name = "Korn 10 y = 0.81 + (24.3 * (((2.0 * X1) + (3.0 * square(X2))) / ((4.0 * cube(X3)) + (5.0 * quart(X4)))))";
Description = "Paper: Accuracy in Symbolic Regression" + Environment.NewLine
+ "Authors: Michael F. Korns" + Environment.NewLine
+ "Function: y = 0.81 + (24.3 * (((2.0 * X1) + (3.0 * square(X2))) / ((4.0 * cube(X3)) + (5.0 * quart(X4)))))" + Environment.NewLine
+ "Real Numbers: 3.45, -.982, 100.389, and all other real constants" + Environment.NewLine
+ "Row Features: x1, x2, x9, and all other features" + Environment.NewLine
+ "Binary Operators: +, -, *, /" + Environment.NewLine
+ "Unary Operators: sqrt, square, cube, cos, sin, tan, tanh, log, exp" + Environment.NewLine
+ "\"Our testing regimen uses only statistical best practices out-of-sample testing techniques. "
+ "We test each of the test cases on matrices of 10000 rows by 1 to 5 columns with no noise. "
+ "For each test a training matrix is filled with random numbers between -50 and +50. The test case "
+ "target expressions are limited to one basis function whose maximum depth is three grammar nodes.\"";
targetVariable = "Y";
inputVariables = new List() { "X0", "X1", "X2", "X3", "X4" };
trainingPartition = new IntRange(0, 5000);
testPartition = new IntRange(5001, 10000);
}
protected override List GenerateTarget(List> data) {
double x1, x2, x3, x4;
List results = new List();
for (int i = 0; i < data[0].Count; i++) {
x1 = data[1][i];
x2 = data[2][i];
x3 = data[3][i];
x4 = data[4][i];
results.Add(0.81 + (24.3 * (((2.0 * x1) + (3.0 * Math.Pow(x2, 2))) / ((4.0 * Math.Pow(x3, 3)) + (5.0 * Math.Pow(x4, 4))))));
}
return results;
}
protected override List> GenerateInput() {
List> dataList = new List>();
DoubleRange range = new DoubleRange(-50, 50);
for (int i = 0; i < inputVariables.Count; i++) {
dataList.Add(RegressionBenchmark.GenerateUniformDistributedValues(testPartition.End, range));
}
return dataList;
}
}
}