public static List <Sweep> GenerateCandidates(IHostEnvironment env, string dataFile, string schemaDefinitionFile) { var patterns = new List <Sweep>(); string loaderSettings; Type predictorType; TransformInference.InferenceResult inferenceResult; // Get the initial recipes for this data. RecipeInference.SuggestedRecipe[] recipes = RecipeInference.InferRecipesFromData(env, dataFile, schemaDefinitionFile, out predictorType, out loaderSettings, out inferenceResult); //get all the trainers for this task, and generate the initial set of candidates. // Exclude the hidden learners, and the metalinear learners. var trainers = env.ComponentCatalog.GetAllDerivedClasses(typeof(ITrainer), predictorType).Where(cls => !cls.IsHidden); if (!string.IsNullOrEmpty(loaderSettings)) { StringBuilder sb = new StringBuilder(); CmdQuoter.QuoteValue(loaderSettings, sb, true); loaderSettings = sb.ToString(); } string loader = $" loader=TextLoader{loaderSettings}"; // REVIEW: there are more learners than recipes atm. // Flip looping through recipes, then through learners if the cardinality changes. foreach (ComponentCatalog.LoadableClassInfo cl in trainers) { string learnerSettings; TrainerSweeper trainerSweeper = new TrainerSweeper(); trainerSweeper.Parameters.AddRange(RecipeInference.GetLearnerSettingsAndSweepParams(env, cl, out learnerSettings)); foreach (var recipe in recipes) { RecipeInference.SuggestedRecipe.SuggestedLearner learner = new RecipeInference.SuggestedRecipe.SuggestedLearner { LoadableClassInfo = cl, Settings = learnerSettings }; Pattern pattern = new Pattern(recipe.Transforms, learner, loader); Sweep sweep = new Sweep(pattern, trainerSweeper); patterns.Add(sweep); } } return(patterns); }
internal Sweep(Pattern pattern, TrainerSweeper trainerSweeper) { Pattern = pattern; TrainerSweeper = trainerSweeper; }