Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        private void Bind()
        {
            Formula f = FormulaFactory.Create(this.FormulaID);

            this.txtStationName.Text = f.Device.StationName;
            this.txtBegin.Text       = f.BeginString;
            this.txtEnd.Text         = f.EndString;
            this.txtFormula.Text     = f.FormulaString;
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private Formula GetFormula()
        {
            Formula f = null;

            if (IsEdit())
            {
                f = FormulaFactory.Create(this.FormulaID);
            }
            else
            {
                f        = new Formula();
                f.Device = GetDevice();
            }
            return(f);
        }
Exemplo n.º 3
0
    static void ItemItemStart()
    {
        FileReader fReader = new FileReader();
        Dictionary<int, UserPref> userList = fReader.GetData();
        Dictionary<string, float> fileMetaData = fReader.GetMetaData();

        FormulaFactory forFactory = new FormulaFactory();
        ItemComparer itemComparer = new ItemComparer(fReader.allProducts, userList);

        int targetUserID = 186;
        int targetProductID = 172;

        DateTime startTime = DateTime.Now;
        itemComparer.PredictRating(userList[targetUserID], targetProductID);
        // var x = itemComparer.PredictTopRatings(userList[targetUserID], 5);
        DateTime endTime = DateTime.Now;
        Console.WriteLine("Calculating the predicted rating took {0} ms",(endTime-startTime).Milliseconds);
        //itemComparer.AddNewRating(userList[3],105,4);
        //var y = itemComparer.PredictTopRatings(userList[targetUserID], 5);

        Console.Read();
    }
Exemplo n.º 4
0
    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();
    }
Exemplo n.º 5
0
 void Awake()
 {
     Instance = this;
 }