コード例 #1
0
        public async void RunPrediction()
        {
            var predictor = PredictorManager.GetPredictor(_arguments.Predictor);

            if (predictor == null)
            {
                Console.WriteLine($"{_arguments.Predictor} predictor was not found in the Library");

                Console.WriteLine(string.Empty);

                Console.WriteLine("Available Predictors:");

                foreach (var availablePredictor in PredictorManager.Predictors)
                {
                    Console.WriteLine($"{availablePredictor.PredictorName} ({availablePredictor.PredictorPrettyName})");
                }

                return;
            }

            if (_arguments.Evaluate)
            {
                var metrics = await predictor.RunEvaluationAsync(_arguments.PredictionDataFileName);

                if (metrics.IsNullOrError)
                {
                    Console.WriteLine("Could not run evaluation due to an error");

                    return;
                }

                Console.WriteLine($"L1: {metrics.Value.L1}");
                Console.WriteLine($"L2: {metrics.Value.L2}");
                Console.WriteLine($"LossFn: {metrics.Value.LossFn}");

                Console.WriteLine(Environment.NewLine);
            }
            else
            {
                var result = await predictor.RunPredictorAsync(_arguments.PredictionDataFileName, _arguments.TrainingDataFileName);

                if (result.IsNullOrError)
                {
                    Console.WriteLine("Failed to run model");

                    return;
                }

                Console.WriteLine(result.Value);
            }
        }
コード例 #2
0
        public void PredictorManager_ValidRetrieval()
        {
            var result = PredictorManager.GetPredictor(new WarriorsPredictor().PredictorName);

            Assert.IsNotNull(result);
        }
コード例 #3
0
        public void PredictorManager_NullRetrieval()
        {
            var result = PredictorManager.GetPredictor(null);

            Assert.IsNull(result);
        }
コード例 #4
0
 private void Initializate()
 {
     db       = new BusStopsDataBaseEntities();
     stations = db.Stations.ToList();
     manager  = new PredictorManager();
 }