Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10757


Ignore:
Timestamp:
04/17/14 15:34:25 (11 years ago)
Author:
gkronber
Message:

#1967 removed obsolete classes and cleaned up the implementation. Added the ProblemInstanceProvider interface to allow loading of CSV files.

Location:
branches/HeuristicLab.Problems.GaussianProcessTuning/HeuristicLab.Problems.GaussianProcessTuning
Files:
7 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GaussianProcessTuning/HeuristicLab.Problems.GaussianProcessTuning

    • Property svn:ignore
      •  

        old new  
        22obj
        33bin
         4Plugin.cs
  • branches/HeuristicLab.Problems.GaussianProcessTuning/HeuristicLab.Problems.GaussianProcessTuning/BestSolutionAnalyzer.cs

    r8753 r10757  
    1717    private const string QualityParameterName = "Quality";
    1818    private const string SymbolicExpressionTreeParameterName = "GaussianProcessConfiguration";
    19     private const string BestSolutionParameterName = "Best solution";
    2019    private const string ResultsParameterName = "Results";
    2120    private const string ProblemDataParameterName = "ProblemData";
    2221    private const string InterpreterParameterName = "Interpreter";
    2322    private const string SolutionParameterName = "Solution";
     23    private const string TreeParameterName = "Covariance function";
    2424
    2525    public IScopeTreeLookupParameter<DoubleValue> QualityParameter {
     
    3131    public IScopeTreeLookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter {
    3232      get { return (IScopeTreeLookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
    33     }
    34     public ILookupParameter<Solution> BestSolutionParameter {
    35       get { return (ILookupParameter<Solution>)Parameters[BestSolutionParameterName]; }
    3633    }
    3734    public ILookupParameter<ResultCollection> ResultParameter {
     
    5552      Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The Gaussian process configuration to evaluate represented as symbolic expression tree."));
    5653      Parameters.Add(new ScopeTreeLookupParameter<IGaussianProcessSolution>(SolutionParameterName, "The solution of the Gaussian process algorithm."));
    57       Parameters.Add(new LookupParameter<Solution>(BestSolutionParameterName, "The best Gaussian process configuration."));
    5854      Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The result collection of the algorithm."));
    5955      Parameters.Add(new LookupParameter<IRegressionProblemData>(ProblemDataParameterName, ""));
     
    8581      }
    8682      var cloner = new Cloner();
    87       var problemData = cloner.Clone(ProblemDataParameter.ActualValue);
    88       var interpreter = cloner.Clone(InterpreterParameter.ActualValue);
    8983      bestTree = cloner.Clone(bestTree);
    90       var bestModel = new GaussianProcessRegressionModel(bestTree, problemData, interpreter);
    91       var bestSolutionConfiguration = new Solution(bestModel, problemData);
    92 
    93       BestSolutionParameter.ActualValue = bestSolutionConfiguration;
    9484
    9585      var resultCollection = ResultParameter.ActualValue;
    96       if (!resultCollection.ContainsKey(BestSolutionParameterName)) {
    97         resultCollection.Add(new Result(BestSolutionParameterName, "The best Gaussian process solution", bestSolutionConfiguration));
     86      if (!resultCollection.ContainsKey(SolutionParameterName)) {
    9887        resultCollection.Add(new Result(SolutionParameterName, "The Gaussian process algorithm solution", bestSolution));
     88        resultCollection.Add(new Result(TreeParameterName, "The best covariance function", bestTree));
    9989      } else {
    100         resultCollection[BestSolutionParameterName].Value = bestSolutionConfiguration;
    10190        resultCollection[SolutionParameterName].Value = bestSolution;
     91        resultCollection[TreeParameterName].Value = bestTree;
    10292      }
    10393
  • branches/HeuristicLab.Problems.GaussianProcessTuning/HeuristicLab.Problems.GaussianProcessTuning/Evaluator.cs

    r9562 r10757  
    2020    private const string ProblemDataParameterName = "ProblemData";
    2121    private const string SolutionParameterName = "Solution";
     22    private const string IterationsParameterName = "Iterations";
    2223
    2324    public ILookupParameter<DoubleValue> QualityParameter {
     
    3637      get { return (ILookupParameter<IRegressionProblemData>)Parameters[ProblemDataParameterName]; }
    3738    }
     39    public ILookupParameter<IntValue> IterationsParameter {
     40      get { return (ILookupParameter<IntValue>)Parameters[IterationsParameterName]; }
     41    }
    3842
    3943    [StorableConstructor]
     
    4650      Parameters.Add(new LookupParameter<DoubleValue>(QualityParameterName, "The solution quality of the Gaussian process configuration."));
    4751      Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(GaussianProcessConfigurationParameterName, "The Gaussian process configuration to evaluate represented as symbolic expression tree."));
     52      Parameters.Add(new LookupParameter<IntValue>(IterationsParameterName, "Number of LM-BFGS iterations for hyper-parameter optimization."));
    4853      Parameters.Add(new LookupParameter<Interpreter>(InterpreterParameterName, "The interpreter to use for evaluating Gaussian process configurations represented as trees."));
    4954      Parameters.Add(new LookupParameter<IRegressionProblemData>(ProblemDataParameterName, "To regression problem data for which to learn a Gaussian process."));
     
    6368      double quality;
    6469      IGaussianProcessSolution solution;
    65       InterpreterParameter.ActualValue.EvaluateGaussianProcessConfiguration(tree, ProblemDataParameter.ActualValue, out quality, out solution);
     70      InterpreterParameter.ActualValue.EvaluateGaussianProcessConfiguration(tree, ProblemDataParameter.ActualValue, IterationsParameter.ActualValue.Value, out quality, out solution);
    6671
    6772      if (double.IsInfinity(quality) || double.IsNaN(quality)) quality = 1E6; // a large value
  • branches/HeuristicLab.Problems.GaussianProcessTuning/HeuristicLab.Problems.GaussianProcessTuning/GaussianProcessTuning.csproj

    r9562 r10757  
    123123      <Private>False</Private>
    124124    </Reference>
     125    <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     126      <SpecificVersion>False</SpecificVersion>
     127      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
     128    </Reference>
    125129    <Reference Include="HeuristicLab.Random-3.3">
    126130      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
     
    141145  <ItemGroup>
    142146    <Compile Include="BestSolutionAnalyzer.cs" />
    143     <Compile Include="GaussianProcessRegressionModel.cs" />
    144147    <Compile Include="Interpreter.cs">
    145148      <SubType>Code</SubType>
    146149    </Compile>
    147     <Compile Include="Parameters.cs" />
    148     <Compile Include="Provider.cs" />
    149     <Compile Include="Solution.cs" />
    150150    <Compile Include="Grammar.cs" />
    151151    <Compile Include="Problem.cs" />
     
    159159    <None Include="Plugin.cs.frame" />
    160160    <None Include="Properties\AssemblyInfo.cs.frame" />
    161   </ItemGroup>
    162   <ItemGroup>
    163     <ProjectReference Include="..\HeuristicLab.Algorithms.DataAnalysis.Experimental\HeuristicLab.Algorithms.DataAnalysis.Experimental.csproj">
    164       <Project>{6142B24E-9C86-410B-A65A-1DE65C8C2349}</Project>
    165       <Name>HeuristicLab.Algorithms.DataAnalysis.Experimental</Name>
    166     </ProjectReference>
    167161  </ItemGroup>
    168162  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/HeuristicLab.Problems.GaussianProcessTuning/HeuristicLab.Problems.GaussianProcessTuning/Grammar.cs

    r9562 r10757  
    4242    private void Initialize() {
    4343      // create all symbols
     44      var meanZero = new MeanZero();
    4445      //var meanOne = new MeanOne();
    45       var meanConst = new MeanConst();
    46       var meanLinear = new MeanLinear(Dimension);
     46      //var meanConst = new MeanConst();
     47      //var meanLinear = new MeanLinear(Dimension);
    4748      //var meanScale = new MeanScale();
    48       var meanSum = new MeanSum();
    49       var meanProd = new MeanProd();
     49      //var meanSum = new MeanSum();
     50      //var meanProd = new MeanProd();
    5051      //var meanPow2 = new MeanPow(2) { Name = "MeanPow2" };
    5152      //var meanPow3 = new MeanPow(3) { Name = "MeanPow3" };
     
    7071      var covPeriodic1 = new CovPeriodic(1.0);
    7172      covPeriodic1.Name = "CovPeriodic(1.0)";
    72       var covPeriodicCO = new CovPeriodic(0.021817864467425927);
    73       covPeriodicCO.Name = "CovPeriodicCO";
     73      //var covPeriodicCO = new CovPeriodic(0.021817864467425927);
     74      //covPeriodicCO.Name = "CovPeriodicCO";
    7475      var covNoise = new CovNoise();
    7576      var covScale = new CovScale();
     
    8384      var meanSymbols = new List<ISymbol>()
    8485                         {
    85                             meanConst,
    86                             meanLinear,
    87                             meanSum, 
    88                             meanProd,
     86                           meanZero,
     87                            //meanConst,
     88                            //meanLinear,
     89                            //meanSum, 
     90                            //meanProd,
    8991                            //meanPow2,
    9092                            //meanPow3,
     
    108110                            covPeriodic,
    109111                            covPeriodic1,
    110                             covPeriodicCO,
     112                            //covPeriodicCO,
    111113                            covNoise,
    112114                            covScale,
     
    137139        AddAllowedChildSymbol(configurationStartSymbol, likSymbol, 2);
    138140      }
    139       foreach (var meanFunctionSymbol in new ISymbol[] { meanSum, meanProd }) {
    140         foreach (var meanSymbol in meanSymbols) {
    141           for (int i = 0; i < meanFunctionSymbol.MaximumArity; i++) {
    142             AddAllowedChildSymbol(meanFunctionSymbol, meanSymbol, i);
    143           }
    144         }
    145       }
     141      //foreach (var meanFunctionSymbol in new ISymbol[] { meanSum, meanProd }) {
     142      //  foreach (var meanSymbol in meanSymbols) {
     143      //    for (int i = 0; i < meanFunctionSymbol.MaximumArity; i++) {
     144      //      AddAllowedChildSymbol(meanFunctionSymbol, meanSymbol, i);
     145      //    }
     146      //  }
     147      //}
    146148
    147149      foreach (var covFunctionSymbol in new ISymbol[] { covSum, covProd, covScale }) {
     
    171173                            covPeriodic,
    172174                            covPeriodic1,
    173                             covPeriodicCO,
     175                            //covPeriodicCO,
    174176                         }) {
    175177        for (int i = 0; i < covMask.MaximumArity; i++) {
  • branches/HeuristicLab.Problems.GaussianProcessTuning/HeuristicLab.Problems.GaussianProcessTuning/Interpreter.cs

    r9562 r10757  
    2626    }
    2727
    28     public void EvaluateGaussianProcessConfiguration(ISymbolicExpressionTree tree, IRegressionProblemData problemData, out double negLogLikelihood, out IGaussianProcessSolution solution) {
     28    public void EvaluateGaussianProcessConfiguration(ISymbolicExpressionTree tree, IRegressionProblemData problemData, int iterations, out double negLogLikelihood, out IGaussianProcessSolution solution) {
    2929      var meanFunction = GetMeanFunction(tree);
    3030      var covFunction = GetCovFunction(tree);
     
    3636      gprAlg.GaussianProcessModelCreatorParameter.Value =
    3737        gprAlg.GaussianProcessModelCreatorParameter.ValidValues.First(
    38           v => v is EigenGaussianProcessRegressionModelCreator);
    39       gprAlg.MinimizationIterations = 50;
     38          v => v is GaussianProcessRegressionModelCreator);
     39      gprAlg.MinimizationIterations = iterations;
    4040
    4141      var signal = new AutoResetEvent(false);
  • branches/HeuristicLab.Problems.GaussianProcessTuning/HeuristicLab.Problems.GaussianProcessTuning/Plugin.cs.frame

    r9338 r10757  
    1717  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    1818  [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")]
     19  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
    1920  [PluginDependency("HeuristicLab.Random", "3.3")]
    2021  [PluginDependency("HeuristicLab.Selection", "3.3")]
  • branches/HeuristicLab.Problems.GaussianProcessTuning/HeuristicLab.Problems.GaussianProcessTuning/Problem.cs

    r8753 r10757  
    1010using HeuristicLab.PluginInfrastructure;
    1111using HeuristicLab.Problems.DataAnalysis;
     12using HeuristicLab.Problems.Instances;
    1213
    1314namespace HeuristicLab.Problems.GaussianProcessTuning {
     
    1516  [Creatable("Problems")]
    1617  [Item("Gaussian Process Configuration Problem", "The Gaussian process configuration problem for genetic programming.")]
    17   public class Problem : SingleObjectiveHeuristicOptimizationProblem<Evaluator, ISymbolicExpressionTreeCreator> {
     18  public class Problem : SingleObjectiveHeuristicOptimizationProblem<Evaluator, ISymbolicExpressionTreeCreator>,
     19    IProblemInstanceConsumer<IRegressionProblemData>, IProblemInstanceExporter<IRegressionProblemData> {
    1820    private const string GaussianProcessConfigurationParameterName = "GaussianProcessConfiguration";
    1921    private const string MaxGaussianProcessConfigurationLengthParameterName = "MaxConfigurationLength";
     
    2325    private const string InterpreterParameterName = "Interpreter";
    2426    private const string ProblemDataParameterName = "ProblemData";
     27    private const string IterationsParameterName = "Iterations";
    2528
    2629
     
    4346      get { return (IValueParameter<IRegressionProblemData>)Parameters[ProblemDataParameterName]; }
    4447    }
     48    public IFixedValueParameter<IntValue> IterationsParameter {
     49      get { return (IFixedValueParameter<IntValue>)Parameters[IterationsParameterName]; }
     50    }
    4551
    4652    [StorableConstructor]
     
    5561      : base(new Evaluator(), new ProbabilisticTreeCreator()) {
    5662      Parameters.Add(new ValueParameter<Interpreter>(InterpreterParameterName, "The interpreter for Gaussian process configurations represented as trees.", new Interpreter()));
    57       Parameters.Add(new FixedValueParameter<IntValue>(DimensionParameterName, "The dimension parameter for the Gaussian process configuration.", new IntValue(10)));
    58       Parameters.Add(new FixedValueParameter<IntValue>(MaxGaussianProcessConfigurationParameterName, "Maximal depth of the Gaussian process configuration.", new IntValue(6)));
    59       Parameters.Add(new FixedValueParameter<IntValue>(MaxGaussianProcessConfigurationLengthParameterName, "Maximal length of the Gaussian process configuration.", new IntValue(15)));
     63      Parameters.Add(new FixedValueParameter<IntValue>(DimensionParameterName, "The dimension parameter for the Gaussian process configuration.", new IntValue(1)));
     64      Parameters.Add(new FixedValueParameter<IntValue>(MaxGaussianProcessConfigurationParameterName, "Maximal depth of the Gaussian process configuration.", new IntValue(7)));
     65      Parameters.Add(new FixedValueParameter<IntValue>(MaxGaussianProcessConfigurationLengthParameterName, "Maximal length of the Gaussian process configuration.", new IntValue(25)));
    6066      Parameters.Add(new ValueParameter<Grammar>(GaussianProcessConfigurationGrammarParameterName, "Grammar for the Gaussian process configuration.",
    6167                     new Grammar()));
    6268      Parameters.Add(new ValueParameter<IRegressionProblemData>(ProblemDataParameterName, "The problem data to learn a Gaussian process for.", new RegressionProblemData()));
     69      Parameters.Add(new FixedValueParameter<IntValue>(IterationsParameterName, "The number of LM-BFGS iterations for hyper-parameter tuning.", new IntValue(50)));
    6370      Maximization.Value = false;
    6471      InitializeOperators();
     
    167174      }
    168175    }
     176
     177    public void Load(IRegressionProblemData data) {
     178      Name = data.Name;
     179      Description = data.Description;
     180      ProblemDataParameter.Value = data;
     181    }
     182
     183    public IRegressionProblemData Export() {
     184      return ProblemDataParameter.Value;
     185    }
    169186  }
    170187}
  • branches/HeuristicLab.Problems.GaussianProcessTuning/HeuristicLab.Problems.GaussianProcessTuning/Properties

    • Property svn:ignore set to
      AssemblyInfo.cs
Note: See TracChangeset for help on using the changeset viewer.