#region License Information /* HeuristicLab * Copyright (C) 2002-2012 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 System.Linq; using HeuristicLab.Algorithms.DataAnalysis; using HeuristicLab.Random; namespace HeuristicLab.Problems.Instances.DataAnalysis { public class GaussianProcessSEIsoDependentNoise : ArtificialRegressionDataDescriptor { public override string Name { get { return "Gaussian Process SE iso with dependent noise"; } } public override string Description { get { return ""; } } protected override string TargetVariable { get { return "Y"; } } protected override string[] VariableNames { get { return new string[] { "X1", "Y" }; } } protected override string[] AllowedInputVariables { get { return new string[] { "X1" }; } } protected override int TrainingPartitionStart { get { return 0; } } protected override int TrainingPartitionEnd { get { return 250; } } protected override int TestPartitionStart { get { return 250; } } protected override int TestPartitionEnd { get { return 500; } } protected override List> GenerateValues() { List> data = new List>(); for (int i = 0; i < AllowedInputVariables.Count(); i++) { data.Add(ValueGenerator.GenerateSteps(0, 0.99, 0.01).ToList()); data[i].AddRange(ValueGenerator.GenerateSteps(0.005, 1, 0.01).ToList()); } var covarianceFunction = new CovarianceSum(); covarianceFunction.Terms.Add(new CovarianceSquaredExponentialIso()); var prod = new CovarianceProduct(); prod.Factors.Add(new CovarianceLinear()); prod.Factors.Add(new CovarianceNoise()); covarianceFunction.Terms.Add(prod); covarianceFunction.Terms.Add(new CovarianceNoise()); var hyp = new double[] { Math.Log(0.1), Math.Log(Math.Sqrt(1)), // SE iso Math.Log(Math.Sqrt(0.5)), // dependent noise Math.Log(Math.Sqrt(0.01)) // noise }; var cov = covarianceFunction.GetParameterizedCovarianceFunction(hyp, null); var mt = new MersenneTwister(31415); var target = Util.SampleGaussianProcess(mt, cov, data); data.Add(target); return data; } } }