Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/13/12 16:18:37 (12 years ago)
Author:
mkommend
Message:

#1081:

  • Added autoregressive target variable Symbol
  • Merged trunk changes into the branch.
Location:
branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis

  • branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEard.cs

    r8416 r8477  
    3636    [Storable]
    3737    private double sf2;
     38    public double Scale { get { return sf2; } }
     39
    3840    [Storable]
    3941    private double[] l;
     42    public double[] Length {
     43      get {
     44        if (l == null) return new double[0];
     45        var copy = new double[l.Length];
     46        Array.Copy(l, copy, copy.Length);
     47        return copy;
     48      }
     49    }
    4050
    4151    private double[,] sd;
     
    7686      this.l = hyp.Take(hyp.Length - 1).Select(Math.Exp).ToArray();
    7787      this.sf2 = Math.Exp(2 * hyp[hyp.Length - 1]);
    78       sf2 = Math.Min(10E6, sf2); // upper limit for the scale
     88      // sf2 = Math.Min(10E6, sf2); // upper limit for the scale
    7989
    8090      sd = null;
     
    99109    }
    100110
    101     public double[] GetGradient(int i, int j) {
    102       var res = new double[l.Length + 1];
    103       for (int k = 0; k < l.Length; k++) {
     111    public double GetGradient(int i, int j, int k) {
     112      if (k < l.Length) {
    104113        double sqrDist = Util.SqrDist(x[i, k] / l[k], xt[j, k] / l[k]);
    105 
    106         res[k] = sf2 * Math.Exp(-sd[i, j] / 2.0) * sqrDist;
     114        return sf2 * Math.Exp(-sd[i, j] / 2.0) * sqrDist;
     115      } else if (k == l.Length) {
     116        return 2.0 * sf2 * Math.Exp(-sd[i, j] / 2.0);
     117      } else {
     118        throw new ArgumentException("CovarianceSEard has dimension+1 hyperparameters.", "k");
    107119      }
    108       res[res.Length - 1] = 2.0 * sf2 * Math.Exp(-sd[i, j] / 2.0);
    109       return res;
    110120    }
    111121
Note: See TracChangeset for help on using the changeset viewer.