Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/01/12 19:02:47 (11 years ago)
Author:
gkronber
Message:

#1902: removed class HyperParameter and changed implementations of covariance and mean functions to remove the parameter value caching and event handlers for parameter caching. Instead it is now possible to create the actual covariance and mean functions as Func from templates and specified parameter values. The instances of mean and covariance functions configured in the GUI are actually templates where the structure and fixed parameters can be specified.

File:
1 edited

Legend:

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

    r8931 r8982  
    4848    }
    4949
    50     public void SetParameter(double[] hyp) {
    51       if (hyp.Length > 0) throw new ArgumentException("No hyperparameters are allowed for the linear covariance function.");
     50    public void SetParameter(double[] p) {
     51      if (p.Length > 0) throw new ArgumentException("No parameters are allowed for the linear covariance function.");
    5252    }
    5353
    54     public double GetCovariance(double[,] x, int i, int j, IEnumerable<int> columnIndices) {
    55       return Util.ScalarProd(x, i, j, 1, columnIndices);
    56     }
    57 
    58     public IEnumerable<double> GetGradient(double[,] x, int i, int j, IEnumerable<int> columnIndices) {
    59       yield break;
    60     }
    61 
    62     public double GetCrossCovariance(double[,] x, double[,] xt, int i, int j, IEnumerable<int> columnIndices) {
    63       return Util.ScalarProd(x, i, xt, j, 1.0 , columnIndices);
     54    public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, IEnumerable<int> columnIndices) {
     55      if (p.Length > 0) throw new ArgumentException("No parameters are allowed for the linear covariance function.");
     56      // create functions
     57      var cov = new ParameterizedCovarianceFunction();
     58      cov.Covariance = (x, i, j) => Util.ScalarProd(x, i, j, 1, columnIndices);
     59      cov.CrossCovariance = (x, xt, i, j) =>  Util.ScalarProd(x, i, xt, j, 1.0 , columnIndices);
     60      cov.CovarianceGradient = (x, i, j) => Enumerable.Empty<double>();
     61      return cov;
    6462    }
    6563  }
Note: See TracChangeset for help on using the changeset viewer.