Exemplo n.º 1
0
        /// <summary>
        /// Export result for specific dataset based on trained model in the mlconfig file
        /// </summary>
        /// <param name="mlConfigPath"></param>
        /// <param name="resultPath"></param>
        public static void ExportResult(string mlConfigPath, string resultPath, DataSetType dsType)
        {
            var device = DeviceDescriptor.UseDefaultDevice();
            var task   = MLExport.ExportToCSV(mlConfigPath, device, resultPath, dsType);

            task.Wait();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Prints the performance analysis on the console
 /// </summary>
 /// <param name="mlConfigPath"></param>
 public static void PrintPerformance(string mlConfigPath)
 {
     try
     {
         //print evaluation result on console
         var performanceData = MLExport.PrintPerformance(mlConfigPath, DataSetType.Validation, DeviceDescriptor.UseDefaultDevice());
         performanceData.Wait();
         foreach (var s in performanceData.Result)
         {
             Console.WriteLine(s);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 3
0
        internal async Task <bool> ExportToCSV(string filepath)
        {
            try
            {
                if (string.IsNullOrEmpty(TrainingParameters.LastBestModel))
                {
                    MessageBox.Show("No trained model exist. The model result cannot be exported.");
                    return(false);
                }
                //Load ML configuration file
                var mlConfigPath = Project.GetMLConfigPath(Settings, Name);
                await MLExport.ExportToCSV(mlConfigPath, MLFactory.GetDevice(ProcessDevice.Default), filepath);

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            string root = "C:\\sc\\github\\anndotnet\\src\\tool\\";

            //transformDailyLevelVeanaLake();
            //return;

            //regression
            var mlConfigFile1 = $"{root}anndotnet.wnd\\Resources\\Concrete\\ConcreteSlumpProject\\FFNModel.mlconfig";

            //binary classification
            var mlConfigFile2 = $"{root}anndotnet.wnd\\Resources\\Titanic\\TitanicProject\\DNNModel.mlconfig";

            //Multi-class classification
            //Famous multi class classification datset: https://archive.ics.uci.edu/ml/datasets/iris
            var mlConfigFile3 = "./model_mlconfigs/iris.mlconfig";

            //run example
            var token2 = new CancellationToken();

            //train mlconfig
            var result = MachineLearning.Train(mlConfigFile3, trainingProgress, token2, null);

            //once the mode is trained you can write performance analysis of the model
            MachineLearning.PrintPerformance(mlConfigFile1);

            //evaluate model and export the result of testing
            MLExport.ExportToCSV(mlConfigFile2, DeviceDescriptor.UseDefaultDevice(), "./model_mlconfigs/iris_result.csv").Wait();

            //******run all configurations in the solution******
            //string strLocation1 = "C:\\sc\\github\\anndotnet\\src\\tool\\";
            //for (int i = 0; i < 10; i++)
            //    runAllml_configurations(strLocation1);


            //*****end of program*****
            Console.WriteLine("Press any key to continue!");
            Console.ReadKey();
        }