private static void Predict(PredictionModel <ShakVector, ShakPrediction> model, ShakVector newVec) { ShakPrediction prediction = model.Predict(newVec); Console.WriteLine("Predicted fare: {0}", prediction.Rating); Console.ReadLine(); }
public static async Task Main(string[] args) { string arg; Console.WriteLine("enter #train, #eval or #predict"); arg = Console.ReadLine(); if (arg == "train") { PredictionModel <ShakVector, ShakPrediction> model = await Train(); System.Threading.Thread.Sleep(3000); } else if (arg == "eval") { PredictionModel <ShakVector, ShakPrediction> model = await PredictionModel.ReadAsync <ShakVector, ShakPrediction>(_modelpath); System.Threading.Thread.Sleep(3000); Evaluate(model); } else if (arg == "predict") { PredictionModel <ShakVector, ShakPrediction> model = await PredictionModel.ReadAsync <ShakVector, ShakPrediction>(_modelpath); System.Threading.Thread.Sleep(3000); Console.WriteLine("Write ingridiants:"); string Tomato, Onion, Garlic, BellPepper, Eggs, Pepper, Salt, BulgerianCheese, Paprika, Water, Resek, Cumun, Eggplant, Tofu, FryingTimeBeforeTomatosMinutes, CookingAfterTomatosMinutes, CookingAfterEggsMinutes; Tomato = Console.ReadLine(); Onion = Console.ReadLine(); Garlic = Console.ReadLine(); BellPepper = Console.ReadLine(); Eggs = Console.ReadLine(); Pepper = Console.ReadLine(); Salt = Console.ReadLine(); BulgerianCheese = Console.ReadLine(); Paprika = Console.ReadLine(); Water = Console.ReadLine(); Resek = Console.ReadLine(); Cumun = Console.ReadLine(); Eggplant = Console.ReadLine(); Tofu = Console.ReadLine(); FryingTimeBeforeTomatosMinutes = Console.ReadLine(); CookingAfterTomatosMinutes = Console.ReadLine(); CookingAfterEggsMinutes = Console.ReadLine(); ShakVector newVec = new ShakVector { TomatoAmount = float.Parse(Tomato), OnionAmount = float.Parse(Onion), GarlicAmount = float.Parse(Garlic), BellPepperAmount = float.Parse(BellPepper), EggsAmount = float.Parse(Eggs), PepperAmount = float.Parse(Pepper), SaltAmount = float.Parse(Salt), BulgerianCheeseAmount = float.Parse(BulgerianCheese), PaprikaAmount = float.Parse(Paprika), WaterAmount = float.Parse(Water), TomatoResekAmount = float.Parse(Resek), CuminAmount = float.Parse(Cumun), EggplantAmount = float.Parse(Eggplant), TofuAmount = float.Parse(Tofu), FryingTimeBeforeTomatosMinutes = float.Parse(FryingTimeBeforeTomatosMinutes), CookingAfterEggsMinutes = float.Parse(CookingAfterEggsMinutes), CookingAfterTomatosMinutes = float.Parse(CookingAfterTomatosMinutes) }; Predict(model, newVec); } }