コード例 #1
0
        private static void LogNormalize(int userCount, string playcountsFile, string saveFile)
        {
            var rating = RatingProvider.Load(playcountsFile);

            rating.LogNormalize(userCount);
            RatingProvider.Save(saveFile, rating);
        }
コード例 #2
0
        private static void ConvertToLogEqualWidthFiveScale(int userCount, string playcountsFile, string saveFile)
        {
            var ratings = RatingProvider.Load(playcountsFile);

            ratings.ConvertToLogEqualWidthFiveScale(userCount);
            RatingProvider.Save(saveFile, ratings);
        }
コード例 #3
0
        private static void LoadAndSaveRatings(string playcountsFile, List <IUser> users, List <string> artistLut)
        {
            var userLut = users.GetLookupTable();
            var ratings = RatingProvider.ImportFromDataset(DataFiles.RatingDataset, userLut, artistLut);

            users.PopulateWithRatings(ratings, true);
            ratings.ExtractFromUsers(users);
            RatingProvider.Save(playcountsFile, ratings);
        }
コード例 #4
0
        private static int LoadFromDataset()
        {
            Console.WriteLine("Loading users from dataset... {0}", DateTime.Now.ToLongTimeString());
            List <string> userLut,
                          artistLut;
            var users = UserProvider.ImportFromDataset(DataFiles.UserDataset, out userLut);

            UserProvider.Save(DataFiles.Users, users);
            GC.Collect();
            Console.WriteLine("Loading artists from dataset... {0}", DateTime.Now.ToLongTimeString());
            var artists = ArtistProvider.ImportFromDataset(DataFiles.RatingDataset, out artistLut);

            ArtistProvider.Save(DataFiles.Artists, artists);
            Console.WriteLine("Loading ratings from dataset... {0}", DateTime.Now.ToLongTimeString());
            var ratings = RatingProvider.ImportFromDataset(DataFiles.RatingDataset, userLut, artistLut);

            Console.WriteLine("Populating users with ratings... {0}", DateTime.Now.ToLongTimeString());
            users.PopulateWithRatings(ratings, true);
            GC.Collect();
            Console.WriteLine("Extracting ratings from users... {0}", DateTime.Now.ToLongTimeString());
            ratings.ExtractFromUsers(users, false);
            RatingProvider.Save(DataFiles.Playcounts, ratings);
            return(users.Count);
        }