Class for storing and computing the Jaccard index (Tanimoto coefficient)
The Jaccard index is often also called the Tanimoto coefficient. http://en.wikipedia.org/wiki/Jaccard_index
Inheritance: MyMediaLite.Correlation.BinaryDataSymmetricCorrelationMatrix
Example #1
0
 /// <summary>Creates a Jaccard index matrix from given data</summary>
 /// <param name="vectors">the boolean data</param>
 /// <returns>the similarity matrix based on the data</returns>
 public static CorrelationMatrix Create(IBooleanMatrix vectors)
 {
     BinaryDataCorrelationMatrix cm;
     int num_entities = vectors.NumberOfRows;
     try
     {
         cm = new Jaccard(num_entities);
     }
     catch (OverflowException)
     {
         Console.Error.WriteLine("Too many entities: " + num_entities);
         throw;
     }
     cm.ComputeCorrelations(vectors);
     return cm;
 }
Example #2
0
        /// <summary>Creates a Jaccard index matrix from given data</summary>
        /// <param name="vectors">the boolean data</param>
        /// <returns>the similarity matrix based on the data</returns>
        static public CorrelationMatrix Create(IBooleanMatrix vectors)
        {
            BinaryDataCorrelationMatrix cm;
            int num_entities = vectors.NumberOfRows;

            try
            {
                cm = new Jaccard(num_entities);
            }
            catch (OverflowException)
            {
                Console.Error.WriteLine("Too many entities: " + num_entities);
                throw;
            }
            cm.ComputeCorrelations(vectors);
            return(cm);
        }