1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using HeuristicLab.Data;
|
---|
25 |
|
---|
26 | namespace HeuristicLab.Problems.DataAnalysis.Benchmarks {
|
---|
27 | public class RationalPolynomial : RegressionToyBenchmark {
|
---|
28 |
|
---|
29 | public RationalPolynomial() {
|
---|
30 | Name = "Vladislavleva RatPol3D";
|
---|
31 | Description = "Paper: Order of Nonlinearity as a Complexity Measure for Models Generated by Symbolic Regression via Pareto Genetic Programming " + Environment.NewLine
|
---|
32 | + "Authors: Ekaterina J. Vladislavleva, Member, IEEE, Guido F. Smits, Member, IEEE, and Dick den Hertog" + Environment.NewLine
|
---|
33 | + "Function: F5(X1, X2, X3) = 30 * ((X1 - 1) * (X3 -1)) / (X2^2 * (X1 - 10))" + Environment.NewLine
|
---|
34 | + "Training Data: 300 points X1, X3 = Rand(0.05, 2), X2 = Rand(1, 2)" + Environment.NewLine
|
---|
35 | + "Test Data: 2701 points X1, X3 = (-0.05:0.15:2.1), X2 = (0.95:0.1:2.05)" + Environment.NewLine
|
---|
36 | + "Function Set: +, -, *, /, sqaure, x^real, x + real, x + real";
|
---|
37 | targetVariable = "Y";
|
---|
38 | inputVariables = new List<string>() { "X1", "X2", "X3" };
|
---|
39 | trainingPartition = new IntRange(0, 300);
|
---|
40 | testPartition = new IntRange(1000, 3700);
|
---|
41 | }
|
---|
42 |
|
---|
43 | protected override List<double> GenerateTarget(List<List<double>> data) {
|
---|
44 | double x1, x2, x3;
|
---|
45 | List<double> results = new List<double>();
|
---|
46 | for (int i = 0; i < data[0].Count; i++) {
|
---|
47 | x1 = data[0][i];
|
---|
48 | x2 = data[1][i];
|
---|
49 | x3 = data[2][i];
|
---|
50 | results.Add(30 * ((x1 - 1) * (x3 - 1)) / (Math.Pow(x2, 2) * (x1 - 10)));
|
---|
51 | }
|
---|
52 | return results;
|
---|
53 | }
|
---|
54 |
|
---|
55 | protected override List<List<double>> GenerateInput() {
|
---|
56 | List<List<double>> dataList = new List<List<double>>();
|
---|
57 | int amountOfPoints = 1000;
|
---|
58 | dataList.Add(RegressionBenchmark.GenerateUniformDistributedValues(amountOfPoints, new DoubleRange(0.05, 2)));
|
---|
59 | dataList.Add(RegressionBenchmark.GenerateUniformDistributedValues(amountOfPoints, new DoubleRange(1, 2)));
|
---|
60 | dataList.Add(RegressionBenchmark.GenerateUniformDistributedValues(amountOfPoints, new DoubleRange(0.05, 2)));
|
---|
61 |
|
---|
62 | List<List<double>> testData = new List<List<double>>() {
|
---|
63 | RegressionBenchmark.GenerateSteps(new DoubleRange(-0.05, 2.1), 0.15),
|
---|
64 | RegressionBenchmark.GenerateSteps(new DoubleRange( 0.95, 2.05), 0.1),
|
---|
65 | RegressionBenchmark.GenerateSteps(new DoubleRange(-0.05, 2.1), 0.15)
|
---|
66 | };
|
---|
67 |
|
---|
68 | testData = RegressionBenchmark.GenerateAllCombinationsOfValuesInLists(testData);
|
---|
69 |
|
---|
70 | for (int i = 0; i < InputVariable.Count; i++) {
|
---|
71 | dataList[i].AddRange(testData[i]);
|
---|
72 | }
|
---|
73 |
|
---|
74 | return dataList;
|
---|
75 | }
|
---|
76 | }
|
---|
77 | }
|
---|