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; }