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/Util.cs

    r8933 r8982  
    106106    public static IEnumerable<double> GetRow(double[,] x, int r) {
    107107      int cols = x.GetLength(1);
    108       return Enumerable.Range(0, cols).Select(c => x[r, c]);
     108      return GetRow(x, r, Enumerable.Range(0, cols));
     109    }
     110    public static IEnumerable<double> GetRow(double[,] x, int r, IEnumerable<int> columnIndices) {
     111      return columnIndices.Select(c => x[r, c]);
    109112    }
    110113    public static IEnumerable<double> GetCol(double[,] x, int c) {
     
    112115      return Enumerable.Range(0, rows).Select(r => x[r, c]);
    113116    }
    114 
    115 
    116     public static void AttachValueChangeHandler<T, U>(IValueParameter<T> parameter, Action action)
    117       where T : ValueTypeValue<U>
    118       where U : struct {
    119       parameter.ValueChanged += (sender, args) => {
    120         if (parameter.Value != null) {
    121           parameter.Value.ValueChanged += (s, a) => action();
    122           action();
    123         }
    124       };
    125       if (parameter.Value != null) {
    126         parameter.Value.ValueChanged += (s, a) => action();
    127       }
    128     }
    129 
    130     public static void AttachArrayChangeHandler<T, U>(IValueParameter<T> parameter, Action action)
    131       where T : ValueTypeArray<U>
    132       where U : struct {
    133       parameter.ValueChanged += (sender, args) => {
    134         if (parameter.Value != null) {
    135           parameter.Value.ItemChanged += (s, a) => action();
    136           parameter.Value.Reset += (s, a) => action();
    137           action();
    138         }
    139       };
    140       if (parameter.Value != null) {
    141         parameter.Value.ItemChanged += (s, a) => action();
    142         parameter.Value.Reset += (s, a) => action();
    143       }
    144     }
    145117  }
    146118}
Note: See TracChangeset for help on using the changeset viewer.