예제 #1
0
        static void Main(string[] args)
        {
            try {
                Parser.Default
                .ParseArguments <Options>(args)
                .WithParsed((Options options) => {
                    // Create an instance of the prediction engine factory and load a calibration model
                    IPredictor predictor = CreatePredictor(options.PredictionEngineFactoryPath, options.ModelPath);
                    if (options.Filenames == null ||
                        options.Filenames.Count() == 0)
                    {
                        // retrieve all possible results being returned when predicting data with the calibration model
                        IPredictionResult[]? preview = predictor.GetResultPreview();

                        // Show a preview of all prediction results for a given calibration model.
                        Console.WriteLine(ResultsToString(preview, options.ModelPath));
                        return;
                    }

                    // load the x,y data files
                    var data = LoadData(options.Filenames);

                    // Predict one or more files containing tab separated x,y data with the given calibration model.
                    Console.WriteLine(GetPredictionReport(predictor, data));
                });
            } catch (Exception e) {
                Console.WriteLine(e.Message);
            }
        }