From 8b127a353749cdb56e4561782b173d674d459e14 Mon Sep 17 00:00:00 2001 From: Wei-Sheng Chin Date: Tue, 26 Feb 2019 12:51:26 -0800 Subject: [PATCH] Remove IMultiStreamSource when path (type: string) exists --- .../DataLoadSave/Text/TextLoaderSaverCatalog.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/Microsoft.ML.Data/DataLoadSave/Text/TextLoaderSaverCatalog.cs b/src/Microsoft.ML.Data/DataLoadSave/Text/TextLoaderSaverCatalog.cs index d6cd3a2633..75b94e0e69 100644 --- a/src/Microsoft.ML.Data/DataLoadSave/Text/TextLoaderSaverCatalog.cs +++ b/src/Microsoft.ML.Data/DataLoadSave/Text/TextLoaderSaverCatalog.cs @@ -89,7 +89,6 @@ public static TextLoader CreateTextLoader(this DataOperationsCatalog cat /// The columns of the schema. /// The character used as separator between data points in a row. By default the tab character is used as separator. /// Whether the file has a header. - /// The optional location of a data sample. The sample can be used to infer column names and number of slots in each column. /// Whether the file can contain column defined by a quoted string. /// Remove trailing whitespace from lines /// Whether the file can contain numerical vectors in sparse format. @@ -99,7 +98,6 @@ public static IDataView ReadFromTextFile(this DataOperationsCatalog catalog, TextLoader.Column[] columns, char separatorChar = TextLoader.Defaults.Separator, bool hasHeader = TextLoader.Defaults.HasHeader, - IMultiStreamSource dataSample = null, bool allowQuoting = TextLoader.Defaults.AllowQuoting, bool trimWhitespace = TextLoader.Defaults.TrimWhitespace, bool allowSparse = TextLoader.Defaults.AllowSparse) @@ -116,7 +114,7 @@ public static IDataView ReadFromTextFile(this DataOperationsCatalog catalog, AllowSparse = allowSparse }; - var reader = new TextLoader(CatalogUtils.GetEnvironment(catalog), options: options, dataSample: dataSample); + var reader = new TextLoader(CatalogUtils.GetEnvironment(catalog), options: options); return reader.Read(new MultiFileSource(path)); } @@ -127,7 +125,6 @@ public static IDataView ReadFromTextFile(this DataOperationsCatalog catalog, /// The path to the file. /// Column separator character. Default is '\t' /// Does the file contains header? - /// The optional location of a data sample. The sample can be used to infer column names and number of slots in each column. /// Whether the input may include quoted values, /// which can contain separator characters, colons, /// and distinguish empty values from missing values. When true, consecutive separators @@ -142,7 +139,6 @@ public static IDataView ReadFromTextFile(this DataOperationsCatalog cata string path, char separatorChar = TextLoader.Defaults.Separator, bool hasHeader = TextLoader.Defaults.HasHeader, - IMultiStreamSource dataSample = null, bool allowQuoting = TextLoader.Defaults.AllowQuoting, bool trimWhitespace = TextLoader.Defaults.TrimWhitespace, bool allowSparse = TextLoader.Defaults.AllowSparse) @@ -152,7 +148,7 @@ public static IDataView ReadFromTextFile(this DataOperationsCatalog cata // REVIEW: it is almost always a mistake to have a 'trainable' text loader here. // Therefore, we are going to disallow data sample. return TextLoader.CreateTextReader(CatalogUtils.GetEnvironment(catalog), hasHeader, separatorChar, - allowQuoting, allowSparse, trimWhitespace, dataSample: dataSample).Read(new MultiFileSource(path)); + allowQuoting, allowSparse, trimWhitespace).Read(new MultiFileSource(path)); } /// @@ -161,19 +157,15 @@ public static IDataView ReadFromTextFile(this DataOperationsCatalog cata /// The catalog. /// Specifies a file from which to read. /// Defines the settings of the load operation. - /// The optional location of a data sample. The sample can be used to infer column names and number of slots in each column. public static IDataView ReadFromTextFile(this DataOperationsCatalog catalog, string path, - TextLoader.Options options = null, IMultiStreamSource dataSample = null) + TextLoader.Options options = null) { Contracts.CheckNonEmpty(path, nameof(path)); var env = catalog.GetEnvironment(); var source = new MultiFileSource(path); - if (dataSample == null) - return new TextLoader(env, options, source).Read(source); - else - return new TextLoader(env, options, dataSample).Read(source); + return new TextLoader(env, options, dataSample: source).Read(source); } ///