#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 KornsFunctionSix : RegressionToyBenchmark { public KornsFunctionSix() { Name = "Korn 6 y = 1.3 + (0.13 * sqrt(X0))"; Description = "Paper: Accuracy in Symbolic Regression" + Environment.NewLine + "Authors: Michael F. Korns" + Environment.NewLine + "Function: y = 1.3 + (0.13 * sqrt(X0))" + 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.\"" + Environment.NewLine + Environment.NewLine + "Note: Because of the square root only non-negatic values are created for the input variables!"; 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 x0; List results = new List(); for (int i = 0; i < data[0].Count; i++) { x0 = data[0][i]; results.Add(1.3 + (0.13 * Math.Sqrt(x0))); } return results; } protected override List> GenerateInput() { List> dataList = new List>(); DoubleRange range = new DoubleRange(0, 50); for (int i = 0; i < inputVariables.Count; i++) { dataList.Add(RegressionBenchmark.GenerateUniformDistributedValues(testPartition.End, range)); } return dataList; } } }