Beispiel #1
0
        static void Main(string[] args)
        {
            Userpreference up = new Userpreference();                                    //Introducing a new UserPreference objects, which will execute and calculate
            Dictionary <int, ArrayList> methodResult = up.ReadDataFile("userItem.data"); //Loading Data from text file
            ArrayList userIDs       = up.GetAllUserIds(methodResult);                    //Get all available user id's and store the result in a ArrayList
            int       userToCompare = CompareUsers();

            BasicOperation(up, methodResult, userToCompare);

            //Tuple<List<double>, List<double>> userSimilarities = up.FilterMissingTwoUsers(methodResult, usersToCompare[0], usersToCompare[1]); //Fixed users now, needs to be user input
            //double pearson = up.PearsonCalculation(userSimilarities); //Calculation of the pearson coefficient between two users
            //Console.WriteLine(pearson);
            ;
        }
Beispiel #2
0
        //functie maken voor missing items checken meerdere

        private static ArrayList CheckForMissingItems(int userToCompare)
        {
            Userpreference up = new Userpreference();
            Dictionary <int, ArrayList> methodResult = up.ReadDataFile("userItem.data");
            ArrayList userIDs = up.GetAllUserIds(methodResult);

            if (userIDs.Contains(userToCompare))
            {
                ArrayList missingItemsChosenUser = up.GetMissingItemIds(methodResult, userToCompare);
                Console.WriteLine("Item Id's with missing rating for this userid:" + userToCompare);
                if (missingItemsChosenUser.Count > 0)
                {
                    Console.WriteLine("Missing items for chosen user:"******"none");
                    return(null);
                }

                Console.ReadLine();
                return(null);

                //Andere beoordelingen zelfde item ophalen
                //Dictionary<int, ArrayList> sd = up.GetItemScoresOtherUsers(methodResult, 103);

                //foreach (KeyValuePair<int, ArrayList> itemId in sd)
                //{
                //    Console.WriteLine("item rating of other users:");
                //    Console.WriteLine(itemId.Key);
                //    Console.WriteLine(itemId.Value[0]);
                //    Console.WriteLine(itemId.Value[1]);

                //}
                //Console.ReadLine();
            }
            else
            {
                Console.WriteLine("User does not exist, try again...\n");
                CheckForMissingItems(userToCompare);
            }
            return(null);
        }
Beispiel #3
0
        private static int CompareUsers()
        {
            Userpreference up = new Userpreference();
            Dictionary <int, ArrayList> methodResult = up.ReadDataFile("userItem.data");
            ArrayList userIDs = up.GetAllUserIds(methodResult);

            Console.WriteLine("Select a User ID");

            for (int x = 0; x < userIDs.Count; x++)
            {
                Console.WriteLine(userIDs[x]);
            }
            int user = Convert.ToInt32(Console.ReadLine());

            return(user);
        }