Skip to content

Commit 4f01da3

Browse files
committed
Add comments to public API methods
1 parent 8122248 commit 4f01da3

File tree

2 files changed

+42
-25
lines changed

2 files changed

+42
-25
lines changed

src/Microsoft.ML.Transforms/SvmLight/SvmLightLoader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System.Collections.Generic;
99
using System.IO;
1010
using System.Linq;
11-
using System.Threading;
1211
using Microsoft.ML;
1312
using Microsoft.ML.CommandLine;
1413
using Microsoft.ML.Data;
@@ -97,6 +96,7 @@ public enum FeatureIndices
9796
OneBased,
9897
Names
9998
}
99+
100100
public sealed class Options
101101
{
102102
[Argument(ArgumentType.AtMostOnce, HelpText = "The size of the feature vectors.", ShortName = "size")]

src/Microsoft.ML.Transforms/SvmLight/SvmLightLoaderSaverCatalog.cs

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ namespace Microsoft.ML.Transforms
1212
public static class SvmLightLoaderSaverCatalog
1313
{
1414
/// <summary>
15-
///
15+
/// Creates a loader that loads SVM-light format files. <see cref="SvmLightLoader"/>.
1616
/// </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>
2324
public static SvmLightLoader CreateSvmLightLoader(this DataOperationsCatalog catalog,
2425
int inputSize = 0,
2526
long? numberOfRows = null,
@@ -30,27 +31,27 @@ public static SvmLightLoader CreateSvmLightLoader(this DataOperationsCatalog cat
3031
SvmLightLoader.FeatureIndices.ZeroBased : SvmLightLoader.FeatureIndices.OneBased }, dataSample);
3132

3233
/// <summary>
33-
///
34+
/// Creates a loader that loads SVM-light like files, where features are specified by their names.
3435
/// </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>
3939
public static SvmLightLoader CreateSvmLightLoaderWithFeatureNames(this DataOperationsCatalog catalog,
4040
long? numberOfRows = null,
4141
IMultiStreamSource dataSample = null)
4242
=> new SvmLightLoader(CatalogUtils.GetEnvironment(catalog), new SvmLightLoader.Options()
4343
{ NumberOfRows = numberOfRows, FeatureIndices = SvmLightLoader.FeatureIndices.Names }, dataSample);
4444

4545
/// <summary>
46-
///
46+
/// Load a <see cref="IDataView"/> from a text file using <see cref="SvmLightLoader"/>.
4747
/// </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>
5455
public static IDataView LoadFromSvmLightFile(this DataOperationsCatalog catalog,
5556
string path,
5657
int inputSize = 0,
@@ -65,12 +66,12 @@ public static IDataView LoadFromSvmLightFile(this DataOperationsCatalog catalog,
6566
}
6667

6768
/// <summary>
68-
///
69+
/// Load a <see cref="IDataView"/> from a text file containing features specified by feature names,
70+
/// using <see cref="SvmLightLoader"/>.
6971
/// </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>
7475
public static IDataView LoadFromSvmLightFileWithFeatureNames(this DataOperationsCatalog catalog,
7576
string path,
7677
long? numberOfRows = null)
@@ -82,6 +83,22 @@ public static IDataView LoadFromSvmLightFileWithFeatureNames(this DataOperations
8283
return loader.Load(file);
8384
}
8485

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>
85102
public static void SaveInSvmLightFormat(this DataOperationsCatalog catalog,
86103
IDataView data,
87104
Stream stream,

0 commit comments

Comments
 (0)