Exemple #1
0
        private void CategorizeMeal(Recipe recipe, CategorizationResult result)
        {
            IRecipeClassification trainedRecipe = this.analyzer.GetTrainedRecipe(recipe.Id);

            if (trainedRecipe != null)
            {
                result.MealBreakfast = trainedRecipe.IsBreakfast;
                result.MealLunch     = trainedRecipe.IsLunch;
                result.MealDinner    = trainedRecipe.IsDinner;
                result.MealDessert   = trainedRecipe.IsDessert;
            }
            else
            {
                var analysis = this.analyzer.GetPrediction(recipe);

                result.MealBreakfast = analysis.FirstPlace.Equals(Category.Breakfast) || analysis.SecondPlace.Equals(Category.Breakfast);
                result.MealLunch     = analysis.FirstPlace.Equals(Category.Lunch) || analysis.SecondPlace.Equals(Category.Lunch);
                result.MealDinner    = analysis.FirstPlace.Equals(Category.Dinner) || analysis.SecondPlace.Equals(Category.Dinner);
                result.MealDessert   = analysis.FirstPlace.Equals(Category.Dessert) || analysis.SecondPlace.Equals(Category.Dessert);
            }
        }
 public bool CheckIfTrained(Guid recipeId, out IRecipeClassification trainedRecipe)
 {
     return this.trainingData.TryGetValue(recipeId, out trainedRecipe);
 }
Exemple #3
0
 public bool CheckIfTrained(Guid recipeId, out IRecipeClassification ret)
 {
     return(trainingData.TryGetValue(recipeId, out ret));
 }