/// <summary>Compute similarity between one item and a collection of items</summary> /// <param name="item_id">the item ID</param> /// <param name="items">a collection of items</param> /// <param name="distances">the distance measure to use</param> /// <returns>the similarity between the item and the collection</returns> public static double Diversity(int item_id, ICollection<int> items, EuclideanMatrix distances) { double diversity = 0; foreach (int other_item_id in items){ //Console.WriteLine (other_item_id); //Console.WriteLine ("item: " + distances [item_id-1, other_item_id-1]); diversity += distances [item_id-1, other_item_id-1]; } return (double) diversity; }
/// <summary>Constructor</summary> /// <param name="item_correlation">the similarity measure to use for diversification</param> public LatentFeatureDiversfication(EuclideanMatrix distances) { Distances = distances; }