Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/14/17 17:53:30 (8 years ago)
Author:
gkronber
Message:

#2699: made a number of changes mainly to RBF regression model

Location:
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions
Files:
7 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/CicularKernel.cs

    r14386 r14872  
    3030  [StorableClass]
    3131  [Item("CircularKernel", "A circular kernel function")]
    32   public class CircularKernel<T> : KernelBase<T> {
     32  public class CircularKernel : KernelBase {
    3333
    3434    #region HLConstructors & Boilerplate
     
    3737    [StorableHook(HookType.AfterDeserialization)]
    3838    private void AfterDeserialization() { }
    39     protected CircularKernel(CircularKernel<T> original, Cloner cloner) : base(original, cloner) { }
     39    protected CircularKernel(CircularKernel original, Cloner cloner) : base(original, cloner) { }
    4040    public CircularKernel() {
    41       Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The beta in the kernelfunction 2*pi*(acos(-d)-d*(1-n²)^(0.5)) where n = ||x-c|| and d = n/beta", new DoubleValue(2)));
     41      Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The beta in the kernel function 2*pi*(acos(-d)-d*(1-n²)^(0.5)) where n = ||x-c|| and d = n/beta", new DoubleValue(2)));
    4242    }
    4343    public override IDeepCloneable Clone(Cloner cloner) {
    44       return new CircularKernel<T>(this, cloner);
     44      return new CircularKernel(this, cloner);
    4545    }
    4646    #endregion
  • branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/GaussianKernel.cs

    r14386 r14872  
    3030  [StorableClass]
    3131  [Item("GaussianKernel", "A kernel function that uses Gaussian function")]
    32   public class GaussianKernel<T> : KernelBase<T> {
     32  public class GaussianKernel : KernelBase {
    3333
    3434    #region HLConstructors & Boilerplate
     
    3737    [StorableHook(HookType.AfterDeserialization)]
    3838    private void AfterDeserialization() { }
    39     protected GaussianKernel(GaussianKernel<T> original, Cloner cloner) : base(original, cloner) { }
     39    protected GaussianKernel(GaussianKernel original, Cloner cloner) : base(original, cloner) { }
    4040    public GaussianKernel() {
    4141      Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The beta in the kernelfunction exp(-||x-c||/beta²)", new DoubleValue(2)));
    4242    }
    4343    public override IDeepCloneable Clone(Cloner cloner) {
    44       return new GaussianKernel<T>(this, cloner);
     44      return new GaussianKernel(this, cloner);
    4545    }
    4646    #endregion
  • branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/InverseMultiquadraticKernel.cs

    r14871 r14872  
    3030  [StorableClass]
    3131  [Item("InverseMultiquadraticKernel", "A kernel function that uses the inverse multiquadratic function")]
    32   public class InverseMultiquadraticKernel<T> : KernelBase<T> {
     32  public class InverseMultiquadraticKernel : KernelBase {
    3333    #region HLConstructors & Boilerplate
    3434    [StorableConstructor]
     
    3636    [StorableHook(HookType.AfterDeserialization)]
    3737    private void AfterDeserialization() { }
    38     protected InverseMultiquadraticKernel(InverseMultiquadraticKernel<T> original, Cloner cloner) : base(original, cloner) { }
     38    protected InverseMultiquadraticKernel(InverseMultiquadraticKernel original, Cloner cloner) : base(original, cloner) { }
    3939    public InverseMultiquadraticKernel() {
    40       Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The beta in the kernelfunction sqrt(1+||x-c||^2/beta)", new DoubleValue(2)));
     40      Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The beta in the kernel function 1 / sqrt(1+||x-c||^2/beta)", new DoubleValue(2)));
    4141    }
    4242    public override IDeepCloneable Clone(Cloner cloner) {
    43       return new InverseMultiquadraticKernel<T>(this, cloner);
     43      return new InverseMultiquadraticKernel(this, cloner);
    4444    }
    4545    #endregion
  • branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/KernelBase.cs

    r14386 r14872  
    3131namespace HeuristicLab.Algorithms.DataAnalysis {
    3232  [StorableClass]
    33   public abstract class KernelBase<T> : ParameterizedNamedItem, IKernelFunction<T> {
     33  public abstract class KernelBase : ParameterizedNamedItem, ICovarianceFunction {
    3434
    3535    #region Parameternames
     
    3838    #endregion
    3939    #region Parameterproperties
    40     public ValueParameter<IDistance<T>> DistanceParameter
    41     {
    42       get { return Parameters[DistanceParameterName] as ValueParameter<IDistance<T>>; }
     40    public ValueParameter<IDistance> DistanceParameter {
     41      get { return Parameters[DistanceParameterName] as ValueParameter<IDistance>; }
    4342    }
    4443
    45     public IFixedValueParameter<DoubleValue> BetaParameter
    46     {
     44    public IFixedValueParameter<DoubleValue> BetaParameter {
    4745      get { return Parameters[BetaParameterName] as FixedValueParameter<DoubleValue>; }
    4846    }
     
    5048    #endregion
    5149    #region Properties
    52     public IDistance<T> Distance
    53     {
     50    public IDistance Distance {
    5451      get { return DistanceParameter.Value; }
    5552    }
    5653
    57     public double Beta
    58     {
     54    public double Beta {
    5955      get { return BetaParameter.Value.Value; }
    6056    }
     
    6258    #endregion
    6359
    64     #region HLConstructors & Boilerplate
    6560    [StorableConstructor]
    6661    protected KernelBase(bool deserializing) : base(deserializing) { }
     
    6863    private void AfterDeserialization() { }
    6964
    70     protected KernelBase(KernelBase<T> original, Cloner cloner)
     65    protected KernelBase(KernelBase original, Cloner cloner)
    7166      : base(original, cloner) { }
    7267
    7368    protected KernelBase() {
    74       Parameters.Add(new ValueParameter<IDistance<T>>(DistanceParameterName, "The distance function used for kernel calculation"));
    75       DistanceParameter.Value = new EuclidianDistance() as IDistance<T>;
     69      Parameters.Add(new ValueParameter<IDistance>(DistanceParameterName, "The distance function used for kernel calculation"));
     70      DistanceParameter.Value = new EuclideanDistance();
    7671    }
    77     #endregion
    7872
    79     public double Get(T a, T b) {
     73    public double Get(object a, object b) {
    8074      return Get(Distance.Get(a, b));
    8175    }
     
    9387    public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, int[] columnIndices) {
    9488      if (p == null || p.Length != 1) throw new ArgumentException("Illegal parametrization");
    95       var myClone = (KernelBase<T>)Clone(new Cloner());
     89      var myClone = (KernelBase)Clone(new Cloner());
    9690      myClone.BetaParameter.Value.Value = p[0];
    9791      var cov = new ParameterizedCovarianceFunction {
     
    107101    protected double GetNorm(double[,] x, double[,] xt, int i, int j, int[] columnIndices) {
    108102      var dist = Distance as IDistance<IEnumerable<double>>;
    109       if (dist == null) throw new ArgumentException("The Distance needs to apply to double-Vectors");
     103      if (dist == null) throw new ArgumentException("The distance needs to apply to double vectors");
    110104      var r1 = new IndexedEnumerable(x, i, columnIndices);
    111105      var r2 = new IndexedEnumerable(xt, j, columnIndices);
     
    142136      }
    143137
    144       public double Current
    145       {
     138      public double Current {
    146139        get { return data[row, column.Current]; }
    147140      }
    148141
    149       object IEnumerator.Current
    150       {
    151         get
    152         {
     142      object IEnumerator.Current {
     143        get {
    153144          return data[row, column.Current];
    154145        }
  • branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/LaplacianKernel.cs

    r14386 r14872  
    2929namespace HeuristicLab.Algorithms.DataAnalysis {
    3030  [StorableClass]
    31   [Item("LaplacianKernel", "A kernel function that uses an exponential function.\nIt is equvalent to the Gaussiankernel but less suseptible to improper values of beta")]
    32   public class LaplacianKernel<T> : KernelBase<T> {
    33 
    34     #region HLConstructors & Boilerplate
     31  [Item("LaplacianKernel", "A kernel function that uses an exponential function.\nIt is equvalent to the Gaussian kernel but less susceptible to improper values of beta")]
     32  public class LaplacianKernel : KernelBase {
    3533    [StorableConstructor]
    3634    protected LaplacianKernel(bool deserializing) : base(deserializing) { }
    3735    [StorableHook(HookType.AfterDeserialization)]
    3836    private void AfterDeserialization() { }
    39     protected LaplacianKernel(LaplacianKernel<T> original, Cloner cloner) : base(original, cloner) { }
     37    protected LaplacianKernel(LaplacianKernel original, Cloner cloner) : base(original, cloner) { }
    4038    public LaplacianKernel() {
    41       Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The beta in the kernelfunction exp(-||x-c||/beta)", new DoubleValue(2)));
     39      Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The beta in the kernel function exp(-||x-c||/beta)", new DoubleValue(2)));
    4240    }
    4341    public override IDeepCloneable Clone(Cloner cloner) {
    44       return new LaplacianKernel<T>(this, cloner);
     42      return new LaplacianKernel(this, cloner);
    4543    }
    46     #endregion
    4744
    4845    protected override double Get(double norm) {
  • branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/MultiquadraticKernel.cs

    r14386 r14872  
    3030  [StorableClass]
    3131  [Item("MultiquadraticKernel", "A kernel function that uses the multiquadratic function")]
    32   public class MultiquadraticKernel<T> : KernelBase<T> {
     32  public class MultiquadraticKernel : KernelBase {
    3333
    3434    #region HLConstructors & Boilerplate
     
    3737    [StorableHook(HookType.AfterDeserialization)]
    3838    private void AfterDeserialization() { }
    39     protected MultiquadraticKernel(MultiquadraticKernel<T> original, Cloner cloner)
     39    protected MultiquadraticKernel(MultiquadraticKernel original, Cloner cloner)
    4040                : base(original, cloner) { }
    4141
    4242    public MultiquadraticKernel() {
    43       Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The beta in the kernelfunction sqrt(1+||x-c||²/beta)", new DoubleValue(2)));
     43      Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The beta in the kernel function sqrt(1+||x-c||²/beta)", new DoubleValue(2)));
    4444    }
    4545    public override IDeepCloneable Clone(Cloner cloner) {
    46       return new MultiquadraticKernel<T>(this, cloner);
     46      return new MultiquadraticKernel(this, cloner);
    4747    }
    4848    #endregion
  • branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/PolysplineKernel.cs

    r14386 r14872  
    3030  [StorableClass]
    3131  [Item("PolysplineKernel", "A kernel function that uses the multiquadratic function")]
    32   public class PolysplineKernel<T> : KernelBase<T> {
     32  public class PolysplineKernel : KernelBase {
    3333
    3434    #region HLConstructors & Boilerplate
     
    3737    [StorableHook(HookType.AfterDeserialization)]
    3838    private void AfterDeserialization() { }
    39     protected PolysplineKernel(PolysplineKernel<T> original, Cloner cloner)
     39    protected PolysplineKernel(PolysplineKernel original, Cloner cloner)
    4040                : base(original, cloner) { }
    4141    public PolysplineKernel() {
     
    4343    }
    4444    public override IDeepCloneable Clone(Cloner cloner) {
    45       return new PolysplineKernel<T>(this, cloner);
     45      return new PolysplineKernel(this, cloner);
    4646    }
    4747    #endregion
  • branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/ThinPlatePolysplineKernel.cs

    r14386 r14872  
    3030  [StorableClass]
    3131  [Item("ThinPlatePolysplineKernel", "A kernel function that uses the ThinPlatePolyspline function")]
    32   public class ThinPlatePolysplineKernel<T> : KernelBase<T> {
     32  public class ThinPlatePolysplineKernel : KernelBase {
    3333    #region HLConstructors & Boilerplate
    3434    [StorableConstructor]
     
    3636    [StorableHook(HookType.AfterDeserialization)]
    3737    private void AfterDeserialization() { }
    38     protected ThinPlatePolysplineKernel(ThinPlatePolysplineKernel<T> original, Cloner cloner) : base(original, cloner) { }
     38    protected ThinPlatePolysplineKernel(ThinPlatePolysplineKernel original, Cloner cloner) : base(original, cloner) { }
    3939    public ThinPlatePolysplineKernel() {
    4040      Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The Beta in the kernelfunction ||x-c||^(2*Beta)*log(||x-c||^Beta)", new DoubleValue(1)));
    4141    }
    4242    public override IDeepCloneable Clone(Cloner cloner) {
    43       return new ThinPlatePolysplineKernel<T>(this, cloner);
     43      return new ThinPlatePolysplineKernel(this, cloner);
    4444    }
    4545    #endregion
Note: See TracChangeset for help on using the changeset viewer.