Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/31/13 09:34:52 (11 years ago)
Author:
ascheibe
Message:

#1886 added method for converting similarity-based measures to euclidean distances

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/DistanceMatrixToPoints.cs

    r10097 r10098  
    136136      return points;
    137137    }
     138
     139    public static double[][] TransformToDistances(double[][] similarityMatrix) {
     140      double[][] dm = new double[similarityMatrix.Length][];
     141
     142      for (int i = 0; i < dm.Length; i++) {
     143        dm[i] = new double[similarityMatrix.Length];
     144        for (int j = 0; j < dm.Length; j++) {
     145          dm[i][j] = Math.Sqrt(similarityMatrix[i][i] + similarityMatrix[j][j] - 2 * similarityMatrix[i][j]);
     146        }
     147      }
     148
     149      return dm;
     150    }
    138151  }
    139152}
Note: See TracChangeset for help on using the changeset viewer.