コード例 #1
0
        static void PropogateDataAndModels()
        {
            SetUp start = new SetUp();

            start.RunSetup(out List <string> modelPaths, out Dictionary <string, bool> visualizationStatuses);

            GetClassifiersFromPaths(modelPaths,
                                    out List <AbstractClassifier> models);

            GetVisualizers(visualizationStatuses, out Visualizers);

            string      configPath = null;
            XmlDocument config;
            bool        outputStandardModels;

            if (start.FindConfigPath(ref configPath))
            {
                config = new XmlDocument();
                config.Load(configPath);
                outputStandardModels = Convert.ToBoolean(config.DocumentElement.SelectSingleNode("settings").SelectSingleNode("outputStandardisedModels").FirstChild.Value);
            }
            else
            {
                throw new Exception("Config path not found.");
            }

            if (outputStandardModels)
            {
                OutputStandardisedModels(config, models);
            }

            if (start.GetDataPath(config, out string dataPath) == true)
            {
                warehouse = new DataWarehouse(dataPath);
            }
            else
            {
                throw new Exception("No data found.");
            }

            if (start.GetTranslatorPath(config, out string translatorPath) == true)
            {
                Console.ForegroundColor = ConsoleColor.Black;
                Console.BackgroundColor = ConsoleColor.Green;
                Console.WriteLine("Translator file found: " + translatorPath);
                Console.ResetColor();
                translator = DataTranslator.LoadTranslatorFromFile(translatorPath);
            }
            else
            {
                translator = new DataTranslator();
            }

            start.GetVisualizationDirectory(config, out VisualizerOutputDir);

            cm = new ClassifierManager(models.ToArray());
        }