public double Predict(string itemName, Dictionary <string, double> userAssessments) { if (userAssessments.ContainsKey(itemName)) { return(userAssessments[itemName]); } var pairs = _matrix.GetSlice(itemName) .Select( keyedValue => new { Similarity = keyedValue.Value, Rating = _normalizer.Normalize(userAssessments[keyedValue.Key]) }) .ToList(); var normalizedResult = pairs.Sum(pair => pair.Similarity * pair.Rating) / pairs.Sum(p => p.Similarity.ToAbsolute()); return(_normalizer.Denormalize(normalizedResult)); }