コード例 #1
0
ファイル: Program.cs プロジェクト: xjeroen/recomSystem
    static void UserItemStart()
    {
        FileReader fReader = new FileReader();
        Dictionary<int, UserPref> userList = fReader.GetData();
        Dictionary<string, float> fileMetaData = fReader.GetMetaData();

        FormulaFactory forFactory = new FormulaFactory();
        NeighbourFinder nFinder = new NeighbourFinder(forFactory.GetFormula(fileMetaData));

        int targetUserID = 186;
        Dictionary<int, double> neighbourList = nFinder.FindNeighbours(targetUserID, userList);

        foreach (var neighbour in neighbourList)
        {
            Console.WriteLine("Neighbour {0} has a similarity of {1}", neighbour.Key, neighbour.Value);
        }

        RatingPredictor rPredictor = new RatingPredictor();
        rPredictor.PredictRatings(userList, targetUserID, neighbourList);
        rPredictor.GetTopPredictedRatings(8);

        Console.Read();
    }