- Timestamp:
- 03/27/17 12:35:03 (8 years ago)
- Location:
- branches/TSNE/HeuristicLab.Algorithms.DataAnalysis/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/TSNE/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj
r14767 r14784 422 422 <Compile Include="TSNE\Distances\DistanceBase.cs" /> 423 423 <Compile Include="TSNE\Distances\DataPointDistance.cs" /> 424 <Compile Include="TSNE\Distances\Euclid ianDistance.cs" />424 <Compile Include="TSNE\Distances\EuclideanDistance.cs" /> 425 425 <Compile Include="TSNE\Distances\InnerProductDistance.cs" /> 426 <Compile Include="TSNE\TSNEAnalysis.cs" />427 426 <Compile Include="TSNE\PriorityQueue.cs" /> 428 427 <Compile Include="TSNE\SPtree.cs" /> 429 428 <Compile Include="TSNE\TSNE.cs" /> 429 <Compile Include="TSNE\TSNEStatic.cs" /> 430 430 <Compile Include="TSNE\TSNEUtils.cs" /> 431 431 <Compile Include="TSNE\VPTree.cs" /> -
branches/TSNE/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/Distances/EuclideanDistance.cs
r14783 r14784 29 29 namespace HeuristicLab.Algorithms.DataAnalysis { 30 30 [StorableClass] 31 [Item("Euclid ianNorm", "A norm function that uses Euclidean distance")]32 public class Euclid ianDistance : DistanceBase<IEnumerable<double>> {31 [Item("EuclideanDistance", "A norm function that uses Euclidean distance")] 32 public class EuclideanDistance : DistanceBase<IEnumerable<double>> { 33 33 34 34 #region HLConstructors & Boilerplate 35 35 [StorableConstructor] 36 protected Euclid ianDistance(bool deserializing) : base(deserializing) { }37 protected Euclid ianDistance(EuclidianDistance original, Cloner cloner) : base(original, cloner) { }38 public override IDeepCloneable Clone(Cloner cloner) { return new Euclid ianDistance(this, cloner); }39 public Euclid ianDistance() { }36 protected EuclideanDistance(bool deserializing) : base(deserializing) { } 37 protected EuclideanDistance(EuclideanDistance original, Cloner cloner) : base(original, cloner) { } 38 public override IDeepCloneable Clone(Cloner cloner) { return new EuclideanDistance(this, cloner); } 39 public EuclideanDistance() { } 40 40 #endregion 41 41 42 #region statics43 42 public static double GetDistance(double[] point1, double[] point2) { 44 43 if (point1.Length != point2.Length) throw new ArgumentException("Euclidean distance not defined on vectors of different length"); 45 44 return Math.Sqrt(point1.Zip(point2, (a1, b1) => (a1 - b1) * (a1 - b1)).Sum()); 46 45 } 47 #endregion48 46 49 47 public override double Get(IEnumerable<double> a, IEnumerable<double> b) {
Note: See TracChangeset
for help on using the changeset viewer.