private string GeneratePredictProgramCSFileContent(string namespaceValue) { var sampleData = Utils.GenerateSampleData(_settings.TrainDataset, _columnInferenceResult); PredictProgram predictProgram = new PredictProgram() { TaskType = _settings.MlTask.ToString(), LabelName = _settings.LabelName, Namespace = namespaceValue, HasHeader = _columnInferenceResult.TextLoaderOptions.HasHeader, Separator = _columnInferenceResult.TextLoaderOptions.Separators.FirstOrDefault(), AllowQuoting = _columnInferenceResult.TextLoaderOptions.AllowQuoting, AllowSparse = _columnInferenceResult.TextLoaderOptions.AllowSparse, Target = _settings.Target, SampleData = sampleData, }; return(predictProgram.TransformText()); }
public void TestPredictProgram_WithSampleData() { var predictProgram = new PredictProgram() { SampleData = new Dictionary <string, string>() { { "key1", "\"key1\"" }, { "key2", "\"key2\"" }, { "key3", "\"key\\\"3\"" }, }, TaskType = "null", Features = new List <string>(), Namespace = "Namespace", LabelName = "LabelName", Separator = ',' }; Approvals.Verify(predictProgram.TransformText()); }
private string GeneratePredictProgramCSFileContent(string namespaceValue) { var columns = _columnInferenceResult.TextLoaderOptions.Columns; var featuresList = columns.Where((str) => str.Name != _settings.LabelName).Select((str) => str.Name).ToList(); PredictProgram predictProgram = new PredictProgram() { TaskType = _settings.MlTask.ToString(), LabelName = _settings.LabelName, Namespace = namespaceValue, TestDataPath = _settings.TestDataset, TrainDataPath = _settings.TrainDataset, HasHeader = _columnInferenceResult.TextLoaderOptions.HasHeader, Separator = _columnInferenceResult.TextLoaderOptions.Separators.FirstOrDefault(), AllowQuoting = _columnInferenceResult.TextLoaderOptions.AllowQuoting, AllowSparse = _columnInferenceResult.TextLoaderOptions.AllowSparse, Features = featuresList, Target = _settings.Target, }; return(predictProgram.TransformText()); }