Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/31/12 18:26:03 (12 years ago)
Author:
gkronber
Message:

#1902: worked on Gaussian Process algorithm

Location:
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess
Files:
7 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceLinear.cs

    r8366 r8371  
    44using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    55
    6 namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
     6namespace HeuristicLab.Algorithms.DataAnalysis {
    77  [StorableClass]
    88  [Item(Name = "CovarianceLinear", Description = "Linear covariance function with for Gaussian processes.")]
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEard.cs

    r8323 r8371  
    55using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    66
    7 namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
     7namespace HeuristicLab.Algorithms.DataAnalysis {
    88  [StorableClass]
    99  [Item(Name = "CovarianceSEard", Description = "Squared exponential covariance function with automatic relevance determination for Gaussian processes.")]
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEiso.cs

    r8323 r8371  
    55using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    66
    7 namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
     7namespace HeuristicLab.Algorithms.DataAnalysis {
    88  [StorableClass]
    99  [Item(Name = "CovarianceSEiso",
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs

    r8366 r8371  
    2828using HeuristicLab.Problems.DataAnalysis;
    2929
    30 namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
     30namespace HeuristicLab.Algorithms.DataAnalysis {
    3131  /// <summary>
    3232  /// Represents a Gaussian process model.
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegression.cs

    r8325 r8371  
    2121#endregion
    2222
     23using System;
    2324using System.Collections.Generic;
    2425using System.Linq;
     
    2728using HeuristicLab.Core;
    2829using HeuristicLab.Data;
     30using HeuristicLab.Operators;
    2931using HeuristicLab.Optimization;
    3032using HeuristicLab.Parameters;
     
    3436using HeuristicLab.Random;
    3537
    36 namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
     38namespace HeuristicLab.Algorithms.DataAnalysis {
    3739  /// <summary>
    3840  ///Gaussian process regression data analysis algorithm.
     
    4143  [Creatable("Data Analysis")]
    4244  [StorableClass]
    43   public sealed class GaussianProcessRegression : FixedDataAnalysisAlgorithm<IRegressionProblem> {
     45  public sealed class GaussianProcessRegression : EngineAlgorithm, IStorableContent {
     46    public string Filename { get; set; }
     47
     48    public override Type ProblemType { get { return typeof(IRegressionProblem); } }
     49    public new IRegressionProblem Problem {
     50      get { return (IRegressionProblem)base.Problem; }
     51      set { base.Problem = value; }
     52    }
     53
    4454    private const string MeanFunctionParameterName = "MeanFunction";
    4555    private const string CovarianceFunctionParameterName = "CovarianceFunction";
    46     private const string MinimizationIterationsParameterName = "MinimizationIterations";
    47     private const string NegativeLogLikelihoodTableParameterName = "NegativeLogLikelihoodTable";
    48     private const string HyperParametersTableParameterName = "HyperParametersTable";
     56    private const string MinimizationIterationsParameterName = "Iterations";
     57    //private const string NegativeLogLikelihoodTableParameterName = "NegativeLogLikelihoodTable";
     58    //private const string HyperParametersTableParameterName = "HyperParametersTable";
    4959
    5060    #region parameter properties
     
    95105      Parameters.Add(new ConstrainedValueParameter<ICovarianceFunction>(CovarianceFunctionParameterName, "The covariance function to use.",
    96106        new ItemSet<ICovarianceFunction>(covFunctions), covFunctions.First()));
    97       Parameters.Add(new ValueParameter<IntValue>(MinimizationIterationsParameterName, "The number of iterations for likelihood optimization.", new IntValue(20)));
     107      Parameters.Add(new ValueParameter<IntValue>(MinimizationIterationsParameterName, "The number of iterations for likelihood optimization with BFGS.", new IntValue(20)));
    98108      //Parameters.Add(new LookupParameter<DataTable>(NegativeLogLikelihoodTableParameterName, "The negative log likelihood values over the whole run."));
    99109      //Parameters.Add(new LookupParameter<DataTable>(HyperParametersTableParameterName, "The values of the hyper-parameters over the whole run."));
     110
     111      var setParameterLength = new GaussianProcessSetHyperparameterLength();
     112      var initializer = new BFGSInitializer();
     113      var makeStep = new BFGSMakeStep();
     114      var branch = new ConditionalBranch();
     115      var modelCreator = new GaussianProcessRegressionModelCreator();
     116      var updateResults = new BFGSUpdateResults();
     117
     118      OperatorGraph.InitialOperator = setParameterLength;
     119
     120      setParameterLength.CovarianceFunctionParameter.ActualName = CovarianceFunctionParameterName;
     121      setParameterLength.MeanFunctionParameter.ActualName = MeanFunctionParameterName;
     122      setParameterLength.ProblemDataParameter.ActualName = Problem.ProblemDataParameter.Name;
     123      setParameterLength.Successor = initializer;
     124
     125      initializer.IterationsParameter.ActualName = MinimizationIterationsParameterName;
     126      initializer.NumberOfHyperparameterParameter.ActualName = setParameterLength.NumberOfHyperparameterParameter.Name;
     127      initializer.Successor = makeStep;
     128
     129      makeStep.BFGSStateParameter.ActualName = initializer.BFGSStateParameter.Name;
     130      makeStep.HyperparameterParameter.ActualName = initializer.NumberOfHyperparameterParameter.Name;
     131      makeStep.Successor = branch;
     132
     133      branch.ConditionParameter.ActualName = makeStep.TerminationCriterionParameter.Name;
     134      branch.FalseBranch = modelCreator;
     135
     136      modelCreator.ProblemDataParameter.ActualName = Problem.ProblemDataParameter.Name;
     137      modelCreator.MeanFunctionParameter.ActualName = MeanFunctionParameterName;
     138      modelCreator.CovarianceFunctionParameter.ActualName = CovarianceFunctionParameterName;
     139      modelCreator.HyperparameterParameter.ActualName = initializer.HyperparameterParameter.Name;
     140      modelCreator.Successor = updateResults;
     141
     142      updateResults.BFGSStateParameter.ActualName = initializer.BFGSStateParameter.Name;
     143      updateResults.FunctionValueParameter.ActualName = modelCreator.NegativeLogLikelihoodParameter.Name;
     144      updateResults.HyperparameterGradientsParameter.ActualName = modelCreator.HyperparameterGradientsParameter.Name;
     145      updateResults.Successor = makeStep;
     146
    100147    }
    101148    [StorableHook(HookType.AfterDeserialization)]
     
    105152      return new GaussianProcessRegression(this, cloner);
    106153    }
    107 
     154    /*
    108155    #region Gaussian process regression
    109156    protected override void Run() {
     
    215262
    216263    #endregion
     264     */
    217265  }
    218266}
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolution.cs

    r8323 r8371  
    2525using HeuristicLab.Problems.DataAnalysis;
    2626
    27 namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
     27namespace HeuristicLab.Algorithms.DataAnalysis {
    2828  /// <summary>
    2929  /// Represents a Gaussian process solution for a regression problem which can be visualized in the GUI.
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/ICovarianceFunction.cs

    r8323 r8371  
    33using HeuristicLab.Core;
    44
    5 namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
     5namespace HeuristicLab.Algorithms.DataAnalysis {
    66  public interface ICovarianceFunction : IItem {
    77    int GetNumberOfParameters(int numberOfVariables);
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/IMeanFunction.cs

    r8366 r8371  
    22using HeuristicLab.Core;
    33
    4 namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
     4namespace HeuristicLab.Algorithms.DataAnalysis {
    55  public interface IMeanFunction : IItem {
    66    int GetNumberOfParameters(int numberOfVariables);
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanConst.cs

    r8366 r8371  
    66using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    77
    8 namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
     8namespace HeuristicLab.Algorithms.DataAnalysis {
    99  [StorableClass]
    1010  [Item(Name = "MeanConst", Description = "Constant mean function for Gaussian processes.")]
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanLinear.cs

    r8368 r8371  
    66using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    77
    8 namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
     8namespace HeuristicLab.Algorithms.DataAnalysis {
    99  [StorableClass]
    1010  [Item(Name = "MeanLinear", Description = "Linear mean function for Gaussian processes.")]
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanZero.cs

    r8366 r8371  
    66using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    77
    8 namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
     8namespace HeuristicLab.Algorithms.DataAnalysis {
    99  [StorableClass]
    1010  [Item(Name = "MeanZero", Description = "Constant zero mean function for Gaussian processes.")]
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/Util.cs

    r8366 r8371  
    55using System.Linq;
    66
    7 namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
     7namespace HeuristicLab.Algorithms.DataAnalysis {
    88  public static class Util {
    99    public static double ScalarProd(IEnumerable<double> v, IEnumerable<double> u) {
     
    1717
    1818    public static double SqrDist(IEnumerable<double> x, IEnumerable<double> y) {
    19       return Math.Max(x.Zip(y, (a, b) => (a - b) * (a - b)).Sum(), 0);
     19      return x.Zip(y, SqrDist).Sum();
    2020    }
    2121
Note: See TracChangeset for help on using the changeset viewer.