@@ -12,14 +12,15 @@ namespace Microsoft.ML.Transforms
12
12
public static class SvmLightLoaderSaverCatalog
13
13
{
14
14
/// <summary>
15
- ///
15
+ /// Creates a loader that loads SVM-light format files. <see cref="SvmLightLoader"/>.
16
16
/// </summary>
17
- /// <param name="catalog"></param>
18
- /// <param name="inputSize"></param>
19
- /// <param name="numberOfRows"></param>
20
- /// <param name="zeroBased"></param>
21
- /// <param name="dataSample"></param>
22
- /// <returns></returns>
17
+ /// <param name="catalog">The <see cref="DataOperationsCatalog"/> catalog.</param>
18
+ /// <param name="inputSize">The number of features in the Features column. If 0 is specified, the
19
+ /// loader will determine it by looking at the file sample given in <paramref name="dataSample"/>.</param>
20
+ /// <param name="numberOfRows">The number of rows from the sample to be used for determining the number of features.</param>
21
+ /// <param name="zeroBased">If the file contains zero-based indices, this parameter should be set to true. If they are one-based
22
+ /// it should be set to false.</param>
23
+ /// <param name="dataSample">A data sample to be used for determining the number of features in the Features column.</param>
23
24
public static SvmLightLoader CreateSvmLightLoader ( this DataOperationsCatalog catalog ,
24
25
int inputSize = 0 ,
25
26
long ? numberOfRows = null ,
@@ -30,27 +31,27 @@ public static SvmLightLoader CreateSvmLightLoader(this DataOperationsCatalog cat
30
31
SvmLightLoader . FeatureIndices . ZeroBased : SvmLightLoader . FeatureIndices . OneBased } , dataSample ) ;
31
32
32
33
/// <summary>
33
- ///
34
+ /// Creates a loader that loads SVM-light like files, where features are specified by their names.
34
35
/// </summary>
35
- /// <param name="catalog"></param>
36
- /// <param name="numberOfRows"></param>
37
- /// <param name="dataSample"></param>
38
- /// <returns></returns>
36
+ /// <param name="catalog">The <see cref="DataOperationsCatalog"/> catalog.</param>
37
+ /// <param name="numberOfRows">The number of rows from the sample to be used for determining the set of feature names.</param>
38
+ /// <param name="dataSample">A data sample to be used for determining the set of features names.</param>
39
39
public static SvmLightLoader CreateSvmLightLoaderWithFeatureNames ( this DataOperationsCatalog catalog ,
40
40
long ? numberOfRows = null ,
41
41
IMultiStreamSource dataSample = null )
42
42
=> new SvmLightLoader ( CatalogUtils . GetEnvironment ( catalog ) , new SvmLightLoader . Options ( )
43
43
{ NumberOfRows = numberOfRows , FeatureIndices = SvmLightLoader . FeatureIndices . Names } , dataSample ) ;
44
44
45
45
/// <summary>
46
- ///
46
+ /// Load a <see cref="IDataView"/> from a text file using <see cref="SvmLightLoader"/>.
47
47
/// </summary>
48
- /// <param name="catalog"></param>
49
- /// <param name="path"></param>
50
- /// <param name="inputSize"></param>
51
- /// <param name="zeroBased"></param>
52
- /// <param name="numberOfRows"></param>
53
- /// <returns></returns>
48
+ /// <param name="catalog">The <see cref="DataOperationsCatalog"/> catalog.</param>
49
+ /// <param name="path">The path to the file.</param>
50
+ /// <param name="inputSize">The number of features in the Features column. If 0 is specified, the
51
+ /// loader will determine it by looking at the file given in <paramref name="path"/>.</param>
52
+ /// <param name="zeroBased">If the file contains zero-based indices, this parameter should be set to true. If they are one-based
53
+ /// it should be set to false.</param>
54
+ /// <param name="numberOfRows">The number of rows from the sample to be used for determining the number of features.</param>
54
55
public static IDataView LoadFromSvmLightFile ( this DataOperationsCatalog catalog ,
55
56
string path ,
56
57
int inputSize = 0 ,
@@ -65,12 +66,12 @@ public static IDataView LoadFromSvmLightFile(this DataOperationsCatalog catalog,
65
66
}
66
67
67
68
/// <summary>
68
- ///
69
+ /// Load a <see cref="IDataView"/> from a text file containing features specified by feature names,
70
+ /// using <see cref="SvmLightLoader"/>.
69
71
/// </summary>
70
- /// <param name="catalog"></param>
71
- /// <param name="path"></param>
72
- /// <param name="numberOfRows"></param>
73
- /// <returns></returns>
72
+ /// <param name="catalog">The <see cref="DataOperationsCatalog"/> catalog.</param>
73
+ /// <param name="path">The path to the file.</param>
74
+ /// <param name="numberOfRows">The number of rows from the sample to be used for determining the set of feature names.</param>
74
75
public static IDataView LoadFromSvmLightFileWithFeatureNames ( this DataOperationsCatalog catalog ,
75
76
string path ,
76
77
long ? numberOfRows = null )
@@ -82,6 +83,22 @@ public static IDataView LoadFromSvmLightFileWithFeatureNames(this DataOperations
82
83
return loader . Load ( file ) ;
83
84
}
84
85
86
+ /// <summary>
87
+ /// Save the <see cref="IDataView"/> in SVM-light format. Four columns can be saved: a label and a features column,
88
+ /// and optionally a group ID column and an example weight column.
89
+ /// </summary>
90
+ /// <param name="catalog">The <see cref="DataOperationsCatalog"/> catalog.</param>
91
+ /// <param name="data">The data view to save.</param>
92
+ /// <param name="stream">The stream to write to.</param>
93
+ /// <param name="zeroBasedIndexing">Whether to index the features starting at 0 or at 1.</param>
94
+ /// <param name="binaryLabel">If set to true, saves 1 for positive labels, -1 for non-positive labels and 0 for NaN.
95
+ /// Otherwise, saves the value of the label in the data view.</param>
96
+ /// <param name="labelColumnName">The name of the column to be saved as the label column.</param>
97
+ /// <param name="featureColumnName">The name of the column to be saved as the features column.</param>
98
+ /// <param name="rowGroupColumnName">The name of the column to be saved as the group ID column. If null, a group ID column
99
+ /// will not be saved.</param>
100
+ /// <param name="exampleWeightColumnName">The name of the column to be saved as the weight column. If null, a weight column
101
+ /// will not be saved.</param>
85
102
public static void SaveInSvmLightFormat ( this DataOperationsCatalog catalog ,
86
103
IDataView data ,
87
104
Stream stream ,
0 commit comments