public Automator() { Util.LoadJsonFromLocation(configPath, ref config); // Create an Instance of AnacondaSettings which will also Load Json in Constructor anacondaSettings = new AnacondaSettings(); // Create our Logger, it'll do a prilimary check to make sure folders exist researchTracker = new ResearchTracker(); // Creates the Instance for Trainer which loads Json and will also generate new Trainning Data if (!int.TryParse(config["STEPS"], out int steps)) { steps = 5; Util.PrintConsoleMessage(ConsoleColor.Yellow, $"Failed to parse config.json for Steps, STEPS = 5"); } if (!bool.TryParse(config["SKIPSAMETRAINER"], out bool skipSameTrainers)) { skipSameTrainers = true; Util.PrintConsoleMessage(ConsoleColor.Yellow, $"Failed to parse config.json for SkipSameTrainer, SKIPSAMETRAINER = true"); } trainerGenerator = new TrainerGenerator(researchTracker, steps, skipSameTrainers); Util.PrintConsoleMessage(ConsoleColor.Green, $"All Configs Loaded."); }
public TrainerGenerator(ResearchTracker tracker, int steps, bool skipSameTrainer = true) { researchTracker = tracker; trainingSteps = steps; skipSameTrainers = skipSameTrainer; Util.PrintConsoleMessage(ConsoleColor.Green, $"TrainerGenerator using {steps} step{ (steps > 1 ? "s" : string.Empty)} for training"); // Load our JSON files into dictionaries so that we can manipulate these when generating new Trainning Data. Util.LoadJsonFromLocation(trainingDefaultsPath, ref trainingDefaultConfig); Util.LoadJsonFromLocation(trainingMaxPath, ref trainingMaxConfig); // Read contents of file to our Yaml. regexYamlString = Util.ReadFile(regexYamlTrainerPath); // How many times we train at the current 'base' value with the combination of configurations SessionsPerStep = trainingMaxConfig.Count + 1; trainningIterationValues = new Dictionary <string, float>(); foreach (var item in trainingMaxConfig.Keys) { // We know how many Steps we need to train, so we can generate the value we can quickly multiply instead of doing ((Max-Default)/Sessions) each session trainningIterationValues.Add(item, ((float.Parse(trainingMaxConfig[item]) - float.Parse(trainingDefaultConfig[item])) / (trainingSteps - 1))); } }