public double SharedWordRatio(WeightedItemVector <T> other) { var topThis = this._itemWeights.OrderByDescending(n => n.Value).Select(n => n.Key).Take(5); var topOther = other._itemWeights.OrderByDescending(n => n.Value).Select(n => n.Key).Take(5); return(topThis.Intersect(topOther).Count() / (double)topThis.Union(topOther).Count()); }
public double DotProduct(WeightedItemVector <T> b) { return(this * b); }