Changeset 14500 for branches/RBFRegression
- Timestamp:
- 12/18/16 17:11:23 (8 years ago)
- Location:
- branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4
- Files:
-
- 1 added
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj
r14386 r14500 371 371 <Compile Include="RadialBasisFunctions\Distances\DistanceBase.cs" /> 372 372 <Compile Include="RadialBasisFunctions\Distances\EuclidianDistance.cs" /> 373 <Compile Include="RadialBasisFunctions\Distances\Manhatt enDistance.cs" />373 <Compile Include="RadialBasisFunctions\Distances\ManhattanDistance.cs" /> 374 374 <Compile Include="RadialBasisFunctions\Interfaces\IDistance.cs" /> 375 375 <Compile Include="RadialBasisFunctions\Interfaces\IKernelFunction.cs" /> -
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/Distances/ManhattanDistance.cs
r14499 r14500 29 29 namespace HeuristicLab.Algorithms.DataAnalysis { 30 30 [StorableClass] 31 [Item("Manhatt enDistance", "A distance function that uses Block distance")]32 public class Manhatt enDistance : DistanceBase<IEnumerable<double>> {31 [Item("ManhattanDistance", "A distance function that uses block distance")] 32 public class ManhattanDistance : DistanceBase<IEnumerable<double>> { 33 33 34 34 #region HLConstructors & Boilerplate 35 35 [StorableConstructor] 36 protected Manhatt enDistance(bool deserializing) : base(deserializing) { }36 protected ManhattanDistance(bool deserializing) : base(deserializing) { } 37 37 [StorableHook(HookType.AfterDeserialization)] 38 38 private void AfterDeserialization() { } 39 protected Manhatt enDistance(ManhattenDistance original, Cloner cloner)39 protected ManhattanDistance(ManhattanDistance original, Cloner cloner) 40 40 : base(original, cloner) { } 41 public Manhatt enDistance() { }41 public ManhattanDistance() { } 42 42 public override IDeepCloneable Clone(Cloner cloner) { 43 return new Manhatt enDistance(this, cloner);43 return new ManhattanDistance(this, cloner); 44 44 } 45 45 #endregion 46 46 47 47 public static double GetDistance(double[] point1, double[] point2) { 48 if (point1.Length != point2.Length) throw new ArgumentException("Manhatt en distance not defined on vectors of different length");48 if (point1.Length != point2.Length) throw new ArgumentException("Manhattan distance not defined on vectors of different length"); 49 49 return point1.Zip(point2, (a1, b1) => Math.Abs(a1 - b1)).Sum(); 50 50 }
Note: See TracChangeset
for help on using the changeset viewer.