Skip to content

Commit f6cdf57

Browse files
authored
Improved documentation for LdSvmTrainer (dotnet#4934)
* Improved documentation for LdSvmTrainer * Minor rewording
1 parent c378772 commit f6cdf57

File tree

3 files changed

+51
-9
lines changed

3 files changed

+51
-9
lines changed

src/Microsoft.ML.StandardTrainers/LdSvm/LdSvmTrainer.cs

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,42 @@
2626
namespace Microsoft.ML.Trainers
2727
{
2828
/// <summary>
29-
/// Non-Linear SVM that implements Local Deep SVM based on paper :
30-
/// C. Jose, P. Goyal, P. Aggrwal, and M. Varma, Local deep
31-
/// kernel learning for efficient non-linear svm prediction, in ICML, 2013.
32-
/// http://research.microsoft.com/en-us/um/people/manik/code/LDKL/download.html
29+
/// The <see cref="IEstimator{TTransformer}"/> to predict a target using a non-linear binary classification model
30+
/// trained with Local Deep SVM.
3331
/// </summary>
32+
/// <remarks>
33+
/// <format type="text/markdown"><![CDATA[
34+
/// To create this trainer, use [LdSvm](xref:Microsoft.ML.StandardTrainersCatalog.LdSvm(BinaryClassificationCatalog.BinaryClassificationTrainers, string, string, string, int, int, bool, bool))
35+
/// or [LdSvm(Options)](xref:Microsoft.ML.StandardTrainersCatalog.LdSvm(BinaryClassificationCatalog.BinaryClassificationTrainers, LdSvmTrainer.Options)).
36+
///
37+
/// [!include[io](~/../docs/samples/docs/api-reference/io-columns-binary-classification-no-prob.md)]
38+
///
39+
/// ### Trainer Characteristics
40+
/// | | |
41+
/// | -- | -- |
42+
/// | Machine learning task | Binary classification |
43+
/// | Is normalization required? | Yes |
44+
/// | Is caching required? | No |
45+
/// | Required NuGet in addition to Microsoft.ML | None |
46+
/// | Exportable to ONNX | No |
47+
///
48+
/// ### Training Algorithm Details
49+
/// Local Deep SVM (LD-SVM) is a generalization of Localized Multiple Kernel Learning for non-linear SVM. Multiple kernel methods learn a different
50+
/// kernel, and hence a different classifier, for each point in the feature space. The prediction time cost for multiple kernal methods can be prohibitively
51+
/// expensive for large training sets because it is proportional to the number of support vectors, and these grow linearly with the size of the training
52+
/// set. LD-SVM reduces the prediction cost by learning a tree-based local feature embedding that is high dimensional and sparse, efficiently encoding
53+
/// non-linearities. Using LD-SVM, the prediction cost grows logarithmically with the size of the training set, rather than linearly, with a tolerable loss
54+
/// in classification accuracy.
55+
///
56+
/// Local Deep SVM is an implementation of the algorithm decribed in [C. Jose, P. Goyal, P. Aggrwal, and M. Varma, Local Deep
57+
/// Kernel Learning for Efficient Non-linear SVM Prediction, ICML, 2013](http://proceedings.mlr.press/v28/jose13.pdf).
58+
///
59+
/// Check the See Also section for links to usage examples.
60+
/// ]]>
61+
/// </format>
62+
/// </remarks>
63+
/// <seealso cref="StandardTrainersCatalog.LdSvm(BinaryClassificationCatalog.BinaryClassificationTrainers, LdSvmTrainer.Options)"/>
64+
/// <seealso cref="StandardTrainersCatalog.LdSvm(BinaryClassificationCatalog.BinaryClassificationTrainers, string, string, string, int, int, bool, bool)"/>
3465
public sealed class LdSvmTrainer : TrainerEstimatorBase<BinaryPredictionTransformer<LdSvmModelParameters>, LdSvmModelParameters>
3566
{
3667
internal const string LoadNameValue = "LDSVM";

src/Microsoft.ML.StandardTrainers/Standard/Online/LinearSvm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ namespace Microsoft.ML.Trainers
5252
/// That is the same as the sign of the feautures' weighted sum, i.e. $\sum_{i = 0}^{D-1} \left(w_i * f_i \right) + b$, where $w_0, w_1,..., w_{D-1}$
5353
/// are the weights computed by the algorithm, and $b$ is the bias computed by the algorithm.
5454
///
55-
/// This algorithm implemented is the PEGASOS method, which alternates between stochastic gradient descent steps and projection steps,
55+
/// Linear SVM implements the PEGASOS method, which alternates between stochastic gradient descent steps and projection steps,
5656
/// introduced in [this paper](http://ttic.uchicago.edu/~shai/papers/ShalevSiSr07.pdf) by Shalev-Shwartz, Singer and Srebro.
5757
///
5858
/// Check the See Also section for links to usage examples.

src/Microsoft.ML.StandardTrainers/StandardTrainersCatalog.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ public static LinearSvmTrainer LinearSvm(this BinaryClassificationCatalog.Binary
851851
}
852852

853853
/// <summary>
854-
/// Create <see cref="PriorTrainer"/>, which predict a target using a binary classification model.
854+
/// Create <see cref="PriorTrainer"/>, which predicts a target using a binary classification model.
855855
/// </summary>
856856
/// <remarks>
857857
/// This trainer uses the proportion of a label in the training set as the probability of that label.
@@ -875,15 +875,21 @@ public static PriorTrainer Prior(this BinaryClassificationCatalog.BinaryClassifi
875875
}
876876

877877
/// <summary>
878-
/// Create <see cref="LdSvmTrainer"/> with advanced options, which predicts a target using a Local Deep SVM model model.
878+
/// Create <see cref="LdSvmTrainer"/> with advanced options, which predicts a target using a Local Deep SVM model.
879879
/// </summary>
880880
/// <param name="catalog">The <see cref="BinaryClassificationCatalog"/>.</param>
881881
/// <param name="options">Trainer options.</param>
882+
/// <example>
883+
/// <format type="text/markdown">
884+
/// <![CDATA[
885+
/// [!code-csharp[LdSvm](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/LdSvmWithOptions.cs)]
886+
/// ]]></format>
887+
/// </example>
882888
public static LdSvmTrainer LdSvm(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, LdSvmTrainer.Options options)
883889
=> new LdSvmTrainer(catalog.GetEnvironment(), options);
884890

885891
/// <summary>
886-
/// Create <see cref="LdSvmTrainer"/>, which predicts a target using a Local Deep SVM model model.
892+
/// Create <see cref="LdSvmTrainer"/>, which predicts a target using a Local Deep SVM model.
887893
/// </summary>
888894
/// <param name="catalog">The <see cref="BinaryClassificationCatalog"/>.</param>
889895
/// <param name="labelColumnName">The name of the label column.</param>
@@ -893,7 +899,12 @@ public static LdSvmTrainer LdSvm(this BinaryClassificationCatalog.BinaryClassifi
893899
/// <param name="treeDepth">The depth of a Local Deep SVM tree.</param>
894900
/// <param name="useBias">Indicates if the model should have a bias term.</param>
895901
/// <param name="useCachedData">Indicates whether we should iterate over the data using a cache.</param>
896-
/// <returns></returns>
902+
/// <example>
903+
/// <format type="text/markdown">
904+
/// <![CDATA[
905+
/// [!code-csharp[LdSvm](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/LdSvm.cs)]
906+
/// ]]></format>
907+
/// </example>
897908
public static LdSvmTrainer LdSvm(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog,
898909
string labelColumnName = DefaultColumnNames.Label,
899910
string featureColumnName = DefaultColumnNames.Features,

0 commit comments

Comments
 (0)