- Timestamp:
- 12/16/16 17:10:05 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/MemPRAlgorithm/HeuristicLab.Encodings.LinearLinkageEncoding/3.4/SimilarityCalculators/HammingSimilarityCalculator.cs
r14471 r14496 46 46 public static double CalculateSimilarity(LinearLinkage left, LinearLinkage right) { 47 47 if (left.Length != right.Length) throw new ArgumentException("Comparing encodings of unequal length"); 48 var dist= 0;48 var similarity = 0; 49 49 for (var i = 0; i < left.Length; i++) { 50 if (left[i] != right[i]) dist++;50 if (left[i] == right[i]) similarity++; 51 51 } 52 return dist/ (double)left.Length;52 return similarity / (double)left.Length; 53 53 } 54 54
Note: See TracChangeset
for help on using the changeset viewer.