@@ -24,20 +24,28 @@ public static ColumnInferenceResults InferColumns(MLContext context, string path
24
24
typeInference . Columns [ labelColumnIndex ] . SuggestedName = DefaultColumnNames . Label ;
25
25
}
26
26
27
- return InferColumns ( context , path , typeInference . Columns [ labelColumnIndex ] . SuggestedName ,
28
- hasHeader , splitInference , typeInference , trimWhitespace , groupColumns ) ;
27
+ var columnInfo = new ColumnInformation ( ) { LabelColumn = typeInference . Columns [ labelColumnIndex ] . SuggestedName } ;
28
+
29
+ return InferColumns ( context , path , columnInfo , hasHeader , splitInference , typeInference , trimWhitespace , groupColumns ) ;
30
+ }
31
+
32
+ public static ColumnInferenceResults InferColumns ( MLContext context , string path , string labelColumn ,
33
+ char ? separatorChar , bool ? allowQuotedStrings , bool ? supportSparse , bool trimWhitespace , bool groupColumns )
34
+ {
35
+ var columnInfo = new ColumnInformation ( ) { LabelColumn = labelColumn } ;
36
+ return InferColumns ( context , path , columnInfo , separatorChar , allowQuotedStrings , supportSparse , trimWhitespace , groupColumns ) ;
29
37
}
30
38
31
- public static ColumnInferenceResults InferColumns ( MLContext context , string path , string label ,
39
+ public static ColumnInferenceResults InferColumns ( MLContext context , string path , ColumnInformation columnInfo ,
32
40
char ? separatorChar , bool ? allowQuotedStrings , bool ? supportSparse , bool trimWhitespace , bool groupColumns )
33
41
{
34
42
var sample = TextFileSample . CreateFromFullFile ( path ) ;
35
43
var splitInference = InferSplit ( context , sample , separatorChar , allowQuotedStrings , supportSparse ) ;
36
- var typeInference = InferColumnTypes ( context , sample , splitInference , true , null , label ) ;
37
- return InferColumns ( context , path , label , true , splitInference , typeInference , trimWhitespace , groupColumns ) ;
44
+ var typeInference = InferColumnTypes ( context , sample , splitInference , true , null , columnInfo . LabelColumn ) ;
45
+ return InferColumns ( context , path , columnInfo , true , splitInference , typeInference , trimWhitespace , groupColumns ) ;
38
46
}
39
47
40
- public static ColumnInferenceResults InferColumns ( MLContext context , string path , string label , bool hasHeader ,
48
+ public static ColumnInferenceResults InferColumns ( MLContext context , string path , ColumnInformation columnInfo , bool hasHeader ,
41
49
TextFileContents . ColumnSplitResult splitInference , ColumnTypeInference . InferenceResult typeInference ,
42
50
bool trimWhitespace , bool groupColumns )
43
51
{
@@ -54,7 +62,6 @@ public static ColumnInferenceResults InferColumns(MLContext context, string path
54
62
var textLoader = context . Data . CreateTextLoader ( typedLoaderArgs ) ;
55
63
var dataView = textLoader . Read ( path ) ;
56
64
57
- var columnInfo = new ColumnInformation ( ) { LabelColumn = label } ;
58
65
var purposeInferenceResult = PurposeInference . InferPurposes ( context , dataView , columnInfo ) ;
59
66
60
67
// start building result objects
0 commit comments