예제 #1
0
        private static void AssignmentOnedotEight(Dictionary <int, Dictionary <int, double> > ratings, int targetUser, Similarity similarityType,
                                                  double threshold, int maxNeighhbours, int maxResults, int?minimumRatings)
        {
            Console.WriteLine("\n\n## Assignment 1.8");
            Console.WriteLine("------------------------------------------");
            Console.WriteLine("Rating predictions for user " + targetUser + " with a minimum of " + minimumRatings + " items rated");

            var neighbours  = new NearestNeighbour().FindNearestNeighbour(ratings, targetUser, threshold, maxNeighhbours, similarityType);
            var predictions = new PredictRating().PredictTopRatings(ratings, neighbours, targetUser,
                                                                    0.35, 25, 8, minimumRatings, similarityType);

            foreach (var prediction in predictions)
            {
                Console.WriteLine("\tUser " + targetUser + " will rate item " + prediction.Key + " with a rating of " + prediction.Value);
            }
        }
예제 #2
0
        private static void AssignmentOnedotFour(Dictionary <int, Dictionary <int, double> > ratings, int targetUser, Similarity similarityType)
        {
            Console.WriteLine("\n\n## Assignment 1.4");
            Console.WriteLine("------------------------------------------");
            Console.WriteLine("Rating predictions for user " + targetUser);

            List <int> items = new List <int>();

            items.Add(101);

            foreach (var item in items)
            {
                var prediction = new PredictRating().PredictRatingByNeighbours(ratings, targetUser, item, 0.35,
                                                                               3, similarityType);

                Console.WriteLine("\tUser " + targetUser + " will rate item " + item + " with a rating of " + prediction);
            }
        }