/// <summary>
        /// Predict samples using saved model
        /// </summary>
        /// <param name="outputModelPath">Model file path</param>
        /// <returns></returns>
        public static async Task TestPrediction(string outputModelPath = "product_month_fastTreeTweedie.zip")
        {
            Console.WriteLine("*********************************");
            Console.WriteLine("Testing Product Unit Sales Forecast model");

            // Read the model that has been previously saved by the method SaveModel
            var model = await PredictionModel.ReadAsync <ProductData, ProductUnitPrediction>(outputModelPath);

            Console.WriteLine("** Testing Product 1 **");

            // Build sample data
            ProductData dataSample = new ProductData()
            {
                productId = "263", month = 10, year = 2017, avg = 91, max = 370, min = 1,
                count     = 10, prev = 1675, units = 910
            };

            //model.Predict() predicts the nextperiod/month forecast to the one provided
            ProductUnitPrediction prediction = model.Predict(dataSample);

            Console.WriteLine($"Product: {dataSample.productId}, month: {dataSample.month+1}, year: {dataSample.year} - Real value (units): 551, Forecast Prediction (units): {prediction.Score}");

            dataSample = new ProductData()
            {
                productId = "263", month = 11, year = 2017, avg = 29, max = 221, min = 1,
                count     = 35, prev = 910, units = 551
            };

            //model.Predict() predicts the nextperiod/month forecast to the one provided
            prediction = model.Predict(dataSample);
            Console.WriteLine($"Product: {dataSample.productId}, month: {dataSample.month+1}, year: {dataSample.year} - Forecast Prediction (units): {prediction.Score}");

            Console.WriteLine(" ");

            Console.WriteLine("** Testing Product 2 **");

            dataSample = new ProductData()
            {
                productId = "988", month = 10, year = 2017, avg = 43, max = 220, min = 1,
                count     = 25, prev = 1036, units = 1094
            };

            prediction = model.Predict(dataSample);
            Console.WriteLine($"Product: {dataSample.productId}, month: {dataSample.month+1}, year: {dataSample.year} - Real Value (units): 1076, Forecasting (units): {prediction.Score}");

            dataSample = new ProductData()
            {
                productId = "988", month = 11, year = 2017, avg = 41, max = 225, min = 4,
                count     = 26, prev = 1094, units = 1076
            };

            prediction = model.Predict(dataSample);
            Console.WriteLine($"Product: {dataSample.productId}, month: {dataSample.month+1}, year: {dataSample.year} - Forecasting (units): {prediction.Score}");
        }
        /// <summary>
        /// Predict samples using saved model
        /// </summary>
        /// <param name="outputModelPath">Model file path</param>
        /// <returns></returns>
        public static void TestPrediction(string outputModelPath = "product_month_fastTreeTweedie.zip")
        {
            ConsoleWriteHeader("Testing Product Unit Sales Forecast model");

            // Read the model that has been previously saved by the method SaveModel
            var          env = new LocalEnvironment(seed: 1); //Seed set to any number so you have a deterministic environment
            ITransformer model;

            using (var file = File.OpenRead(outputModelPath))
            {
                model = TransformerChain
                        .LoadFrom(env, file);
            }

            var predictor = model.MakePredictionFunction <ProductData, ProductUnitPrediction>(env);

            Console.WriteLine("** Testing Product 1 **");

            // Build sample data
            ProductData dataSample = new ProductData()
            {
                productId = "263",
                month     = 10,
                year      = 2017,
                avg       = 91,
                max       = 370,
                min       = 1,
                count     = 10,
                prev      = 1675,
                units     = 910
            };

            //model.Predict() predicts the nextperiod/month forecast to the one provided
            ProductUnitPrediction prediction = predictor.Predict(dataSample);

            Console.WriteLine($"Product: {dataSample.productId}, month: {dataSample.month + 1}, year: {dataSample.year} - Real value (units): 551, Forecast Prediction (units): {prediction.Score}");

            dataSample = new ProductData()
            {
                productId = "263",
                month     = 11,
                year      = 2017,
                avg       = 29,
                max       = 221,
                min       = 1,
                count     = 35,
                prev      = 910,
                units     = 551
            };

            //model.Predict() predicts the nextperiod/month forecast to the one provided
            prediction = predictor.Predict(dataSample);
            Console.WriteLine($"Product: {dataSample.productId}, month: {dataSample.month + 1}, year: {dataSample.year} - Forecast Prediction (units): {prediction.Score}");

            Console.WriteLine(" ");

            Console.WriteLine("** Testing Product 2 **");

            dataSample = new ProductData()
            {
                productId = "988",
                month     = 10,
                year      = 2017,
                avg       = 43,
                max       = 220,
                min       = 1,
                count     = 25,
                prev      = 1036,
                units     = 1094
            };

            prediction = predictor.Predict(dataSample);
            Console.WriteLine($"Product: {dataSample.productId}, month: {dataSample.month + 1}, year: {dataSample.year} - Real Value (units): 1076, Forecasting (units): {prediction.Score}");

            dataSample = new ProductData()
            {
                productId = "988",
                month     = 11,
                year      = 2017,
                avg       = 41,
                max       = 225,
                min       = 4,
                count     = 26,
                prev      = 1094,
                units     = 1076
            };

            prediction = predictor.Predict(dataSample);
            Console.WriteLine($"Product: {dataSample.productId}, month: {dataSample.month + 1}, year: {dataSample.year} - Forecasting (units): {prediction.Score}");
        }
        /// <summary>
        /// Predict samples using saved model
        /// </summary>
        /// <param name="outputModelPath">Model file path</param>
        /// <returns></returns>
        public static void TestPrediction(MLContext mlContext, string outputModelPath = "product_month_fastTreeTweedie.zip")
        {
            ConsoleWriteHeader("Testing Product Unit Sales Forecast model");

            // Read the model that has been previously saved by the method SaveModel

            ITransformer trainedModel;

            using (var stream = File.OpenRead(outputModelPath))
            {
                trainedModel = mlContext.Model.Load(stream);
            }

            var predictionEngine = trainedModel.CreatePredictionEngine <ProductData, ProductUnitPrediction>(mlContext);

            Console.WriteLine("** Testing Product 1 **");

            // Build sample data
            ProductData dataSample = new ProductData()
            {
                productId = "263",
                month     = 10,
                year      = 2017,
                avg       = 91,
                max       = 370,
                min       = 1,
                count     = 10,
                prev      = 1675,
                units     = 910
            };

            // Predict the nextperiod/month forecast to the one provided
            ProductUnitPrediction prediction = predictionEngine.Predict(dataSample);

            Console.WriteLine($"Product: {dataSample.productId}, month: {dataSample.month + 1}, year: {dataSample.year} - Real value (units): 551, Forecast Prediction (units): {prediction.Score}");

            dataSample = new ProductData()
            {
                productId = "263",
                month     = 11,
                year      = 2017,
                avg       = 29,
                max       = 221,
                min       = 1,
                count     = 35,
                prev      = 910,
                units     = 551
            };

            // Predicts the nextperiod/month forecast to the one provided
            prediction = predictionEngine.Predict(dataSample);
            Console.WriteLine($"Product: {dataSample.productId}, month: {dataSample.month + 1}, year: {dataSample.year} - Forecast Prediction (units): {prediction.Score}");

            Console.WriteLine(" ");

            Console.WriteLine("** Testing Product 2 **");

            dataSample = new ProductData()
            {
                productId = "988",
                month     = 10,
                year      = 2017,
                avg       = 43,
                max       = 220,
                min       = 1,
                count     = 25,
                prev      = 1036,
                units     = 1094
            };

            prediction = predictionEngine.Predict(dataSample);
            Console.WriteLine($"Product: {dataSample.productId}, month: {dataSample.month + 1}, year: {dataSample.year} - Real Value (units): 1076, Forecasting (units): {prediction.Score}");

            dataSample = new ProductData()
            {
                productId = "988",
                month     = 11,
                year      = 2017,
                avg       = 41,
                max       = 225,
                min       = 4,
                count     = 26,
                prev      = 1094,
                units     = 1076
            };

            prediction = predictionEngine.Predict(dataSample);
            Console.WriteLine($"Product: {dataSample.productId}, month: {dataSample.month + 1}, year: {dataSample.year} - Forecasting (units): {prediction.Score}");
        }