Changeset 14872 for branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions
- Timestamp:
- 04/14/17 17:53:30 (8 years ago)
- 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 30 30 [StorableClass] 31 31 [Item("CircularKernel", "A circular kernel function")] 32 public class CircularKernel <T> : KernelBase<T>{32 public class CircularKernel : KernelBase { 33 33 34 34 #region HLConstructors & Boilerplate … … 37 37 [StorableHook(HookType.AfterDeserialization)] 38 38 private void AfterDeserialization() { } 39 protected CircularKernel(CircularKernel <T>original, Cloner cloner) : base(original, cloner) { }39 protected CircularKernel(CircularKernel original, Cloner cloner) : base(original, cloner) { } 40 40 public CircularKernel() { 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)));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))); 42 42 } 43 43 public override IDeepCloneable Clone(Cloner cloner) { 44 return new CircularKernel <T>(this, cloner);44 return new CircularKernel(this, cloner); 45 45 } 46 46 #endregion -
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/GaussianKernel.cs
r14386 r14872 30 30 [StorableClass] 31 31 [Item("GaussianKernel", "A kernel function that uses Gaussian function")] 32 public class GaussianKernel <T> : KernelBase<T>{32 public class GaussianKernel : KernelBase { 33 33 34 34 #region HLConstructors & Boilerplate … … 37 37 [StorableHook(HookType.AfterDeserialization)] 38 38 private void AfterDeserialization() { } 39 protected GaussianKernel(GaussianKernel <T>original, Cloner cloner) : base(original, cloner) { }39 protected GaussianKernel(GaussianKernel original, Cloner cloner) : base(original, cloner) { } 40 40 public GaussianKernel() { 41 41 Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The beta in the kernelfunction exp(-||x-c||/beta²)", new DoubleValue(2))); 42 42 } 43 43 public override IDeepCloneable Clone(Cloner cloner) { 44 return new GaussianKernel <T>(this, cloner);44 return new GaussianKernel(this, cloner); 45 45 } 46 46 #endregion -
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/InverseMultiquadraticKernel.cs
r14871 r14872 30 30 [StorableClass] 31 31 [Item("InverseMultiquadraticKernel", "A kernel function that uses the inverse multiquadratic function")] 32 public class InverseMultiquadraticKernel <T> : KernelBase<T>{32 public class InverseMultiquadraticKernel : KernelBase { 33 33 #region HLConstructors & Boilerplate 34 34 [StorableConstructor] … … 36 36 [StorableHook(HookType.AfterDeserialization)] 37 37 private void AfterDeserialization() { } 38 protected InverseMultiquadraticKernel(InverseMultiquadraticKernel <T>original, Cloner cloner) : base(original, cloner) { }38 protected InverseMultiquadraticKernel(InverseMultiquadraticKernel original, Cloner cloner) : base(original, cloner) { } 39 39 public InverseMultiquadraticKernel() { 40 Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The beta in the kernel functionsqrt(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))); 41 41 } 42 42 public override IDeepCloneable Clone(Cloner cloner) { 43 return new InverseMultiquadraticKernel <T>(this, cloner);43 return new InverseMultiquadraticKernel(this, cloner); 44 44 } 45 45 #endregion -
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/KernelBase.cs
r14386 r14872 31 31 namespace HeuristicLab.Algorithms.DataAnalysis { 32 32 [StorableClass] 33 public abstract class KernelBase <T> : ParameterizedNamedItem, IKernelFunction<T>{33 public abstract class KernelBase : ParameterizedNamedItem, ICovarianceFunction { 34 34 35 35 #region Parameternames … … 38 38 #endregion 39 39 #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>; } 43 42 } 44 43 45 public IFixedValueParameter<DoubleValue> BetaParameter 46 { 44 public IFixedValueParameter<DoubleValue> BetaParameter { 47 45 get { return Parameters[BetaParameterName] as FixedValueParameter<DoubleValue>; } 48 46 } … … 50 48 #endregion 51 49 #region Properties 52 public IDistance<T> Distance 53 { 50 public IDistance Distance { 54 51 get { return DistanceParameter.Value; } 55 52 } 56 53 57 public double Beta 58 { 54 public double Beta { 59 55 get { return BetaParameter.Value.Value; } 60 56 } … … 62 58 #endregion 63 59 64 #region HLConstructors & Boilerplate65 60 [StorableConstructor] 66 61 protected KernelBase(bool deserializing) : base(deserializing) { } … … 68 63 private void AfterDeserialization() { } 69 64 70 protected KernelBase(KernelBase <T>original, Cloner cloner)65 protected KernelBase(KernelBase original, Cloner cloner) 71 66 : base(original, cloner) { } 72 67 73 68 protected KernelBase() { 74 Parameters.Add(new ValueParameter<IDistance <T>>(DistanceParameterName, "The distance function used for kernel calculation"));75 DistanceParameter.Value = new Euclid ianDistance() as IDistance<T>;69 Parameters.Add(new ValueParameter<IDistance>(DistanceParameterName, "The distance function used for kernel calculation")); 70 DistanceParameter.Value = new EuclideanDistance(); 76 71 } 77 #endregion78 72 79 public double Get( T a, Tb) {73 public double Get(object a, object b) { 80 74 return Get(Distance.Get(a, b)); 81 75 } … … 93 87 public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, int[] columnIndices) { 94 88 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()); 96 90 myClone.BetaParameter.Value.Value = p[0]; 97 91 var cov = new ParameterizedCovarianceFunction { … … 107 101 protected double GetNorm(double[,] x, double[,] xt, int i, int j, int[] columnIndices) { 108 102 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"); 110 104 var r1 = new IndexedEnumerable(x, i, columnIndices); 111 105 var r2 = new IndexedEnumerable(xt, j, columnIndices); … … 142 136 } 143 137 144 public double Current 145 { 138 public double Current { 146 139 get { return data[row, column.Current]; } 147 140 } 148 141 149 object IEnumerator.Current 150 { 151 get 152 { 142 object IEnumerator.Current { 143 get { 153 144 return data[row, column.Current]; 154 145 } -
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/LaplacianKernel.cs
r14386 r14872 29 29 namespace HeuristicLab.Algorithms.DataAnalysis { 30 30 [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 { 35 33 [StorableConstructor] 36 34 protected LaplacianKernel(bool deserializing) : base(deserializing) { } 37 35 [StorableHook(HookType.AfterDeserialization)] 38 36 private void AfterDeserialization() { } 39 protected LaplacianKernel(LaplacianKernel <T>original, Cloner cloner) : base(original, cloner) { }37 protected LaplacianKernel(LaplacianKernel original, Cloner cloner) : base(original, cloner) { } 40 38 public LaplacianKernel() { 41 Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The beta in the kernel function 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))); 42 40 } 43 41 public override IDeepCloneable Clone(Cloner cloner) { 44 return new LaplacianKernel <T>(this, cloner);42 return new LaplacianKernel(this, cloner); 45 43 } 46 #endregion47 44 48 45 protected override double Get(double norm) { -
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/MultiquadraticKernel.cs
r14386 r14872 30 30 [StorableClass] 31 31 [Item("MultiquadraticKernel", "A kernel function that uses the multiquadratic function")] 32 public class MultiquadraticKernel <T> : KernelBase<T>{32 public class MultiquadraticKernel : KernelBase { 33 33 34 34 #region HLConstructors & Boilerplate … … 37 37 [StorableHook(HookType.AfterDeserialization)] 38 38 private void AfterDeserialization() { } 39 protected MultiquadraticKernel(MultiquadraticKernel <T>original, Cloner cloner)39 protected MultiquadraticKernel(MultiquadraticKernel original, Cloner cloner) 40 40 : base(original, cloner) { } 41 41 42 42 public MultiquadraticKernel() { 43 Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The beta in the kernel function 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))); 44 44 } 45 45 public override IDeepCloneable Clone(Cloner cloner) { 46 return new MultiquadraticKernel <T>(this, cloner);46 return new MultiquadraticKernel(this, cloner); 47 47 } 48 48 #endregion -
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/PolysplineKernel.cs
r14386 r14872 30 30 [StorableClass] 31 31 [Item("PolysplineKernel", "A kernel function that uses the multiquadratic function")] 32 public class PolysplineKernel <T> : KernelBase<T>{32 public class PolysplineKernel : KernelBase { 33 33 34 34 #region HLConstructors & Boilerplate … … 37 37 [StorableHook(HookType.AfterDeserialization)] 38 38 private void AfterDeserialization() { } 39 protected PolysplineKernel(PolysplineKernel <T>original, Cloner cloner)39 protected PolysplineKernel(PolysplineKernel original, Cloner cloner) 40 40 : base(original, cloner) { } 41 41 public PolysplineKernel() { … … 43 43 } 44 44 public override IDeepCloneable Clone(Cloner cloner) { 45 return new PolysplineKernel <T>(this, cloner);45 return new PolysplineKernel(this, cloner); 46 46 } 47 47 #endregion -
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/ThinPlatePolysplineKernel.cs
r14386 r14872 30 30 [StorableClass] 31 31 [Item("ThinPlatePolysplineKernel", "A kernel function that uses the ThinPlatePolyspline function")] 32 public class ThinPlatePolysplineKernel <T> : KernelBase<T>{32 public class ThinPlatePolysplineKernel : KernelBase { 33 33 #region HLConstructors & Boilerplate 34 34 [StorableConstructor] … … 36 36 [StorableHook(HookType.AfterDeserialization)] 37 37 private void AfterDeserialization() { } 38 protected ThinPlatePolysplineKernel(ThinPlatePolysplineKernel <T>original, Cloner cloner) : base(original, cloner) { }38 protected ThinPlatePolysplineKernel(ThinPlatePolysplineKernel original, Cloner cloner) : base(original, cloner) { } 39 39 public ThinPlatePolysplineKernel() { 40 40 Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The Beta in the kernelfunction ||x-c||^(2*Beta)*log(||x-c||^Beta)", new DoubleValue(1))); 41 41 } 42 42 public override IDeepCloneable Clone(Cloner cloner) { 43 return new ThinPlatePolysplineKernel <T>(this, cloner);43 return new ThinPlatePolysplineKernel(this, cloner); 44 44 } 45 45 #endregion
Note: See TracChangeset
for help on using the changeset viewer.