From 087b5cc493258190afdd23f2bf21f9590cc4878d Mon Sep 17 00:00:00 2001 From: Daniel Holstein Date: Wed, 1 May 2019 15:49:39 -0700 Subject: [PATCH] InferColumns API that consumes label column index -- Only rename label column to 'Label' for headerless files --- .../ColumnInference/ColumnInferenceApi.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.ML.AutoML/ColumnInference/ColumnInferenceApi.cs b/src/Microsoft.ML.AutoML/ColumnInference/ColumnInferenceApi.cs index 85f0c5d5d0..526570f796 100644 --- a/src/Microsoft.ML.AutoML/ColumnInference/ColumnInferenceApi.cs +++ b/src/Microsoft.ML.AutoML/ColumnInference/ColumnInferenceApi.cs @@ -17,9 +17,8 @@ public static ColumnInferenceResults InferColumns(MLContext context, string path var splitInference = InferSplit(context, sample, separatorChar, allowQuotedStrings, supportSparse); var typeInference = InferColumnTypes(context, sample, splitInference, hasHeader, labelColumnIndex, null); - // if no column is named label, - // rename label column to default ML.NET label column name - if (!typeInference.Columns.Any(c => c.SuggestedName == DefaultColumnNames.Label)) + // If no headers, suggest label column name as 'Label' + if (!hasHeader) { typeInference.Columns[labelColumnIndex].SuggestedName = DefaultColumnNames.Label; }