Exemplo n.º 1
0
 public double GetDecision(CurrentObservation obs)
 {
     try
     {
         var input = new double[] { obs.ConditionCode, obs.Temp, obs.WindChill, obs.WindMph, obs.WindGustMph };
         return tree.Compute(input);
     }
     catch (Exception ex)
     {
         //if this situation occurs if something is wrong with the tree.
         //TODO: come up with an answer somehow...
         return -5;
     }
 }
Exemplo n.º 2
0
        public void AddUserObservation(CurrentObservation obs)
        {
            //get rid of any potentially ridiculous entries.
            //there could be extreme cases where it's sunny but the wind is blowing too hard to go, but I'm simplifying things for now.
            //TODO: look into this more carefully.
            if (obs.ConditionCode == 0 && obs.GoFunston == -1) return;
            if (obs.ConditionCode == 2 && obs.GoFunston == 1) return;
            //TODO: need to get rid of any duplicate observations...or maybe figure out a way to add weight to a given observation

            obs.IsObservedByUser = true;
            //repoService.AddObservation(obs);
            //re-initialize the tree...
            //TODO: this should happen offline as a background job.
            InitDecisionTree();
        }