-
Notifications
You must be signed in to change notification settings - Fork 31
/
HingeLoss.xml
226 lines (219 loc) · 12.9 KB
/
HingeLoss.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<Type Name="HingeLoss" FullName="Microsoft.ML.Trainers.HingeLoss">
<TypeSignature Language="C#" Value="public sealed class HingeLoss : Microsoft.ML.Trainers.ILossFunction<float,float>, Microsoft.ML.Trainers.ISupportSdcaClassificationLoss" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit HingeLoss extends System.Object implements class Microsoft.ML.Trainers.IClassificationLoss, class Microsoft.ML.Trainers.ILossFunction`2<float32, float32>, class Microsoft.ML.Trainers.IScalarLoss, class Microsoft.ML.Trainers.ISupportSdcaClassificationLoss, class Microsoft.ML.Trainers.ISupportSdcaLoss" />
<TypeSignature Language="DocId" Value="T:Microsoft.ML.Trainers.HingeLoss" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class HingeLoss
Implements ILossFunction(Of Single, Single), ISupportSdcaClassificationLoss" />
<TypeSignature Language="F#" Value="type HingeLoss = class
 interface ISupportSdcaClassificationLoss
 interface ISupportSdcaLoss
 interface IScalarLoss
 interface ILossFunction<single, single>
 interface IClassificationLoss" />
<AssemblyInfo>
<AssemblyName>Microsoft.ML.Data</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>Microsoft.ML.Trainers.IClassificationLoss</InterfaceName>
</Interface>
<Interface>
<InterfaceName>Microsoft.ML.Trainers.ILossFunction<System.Single,System.Single></InterfaceName>
</Interface>
<Interface>
<InterfaceName>Microsoft.ML.Trainers.IScalarLoss</InterfaceName>
</Interface>
<Interface>
<InterfaceName>Microsoft.ML.Trainers.ISupportSdcaClassificationLoss</InterfaceName>
</Interface>
<Interface>
<InterfaceName>Microsoft.ML.Trainers.ISupportSdcaLoss</InterfaceName>
</Interface>
</Interfaces>
<Docs>
<summary>
Hinge Loss, commonly used in classification tasks.
</summary>
<remarks>
<format type="text/markdown"><![CDATA[
The Hinge Loss function is defined as:
$L(\hat{y}, y) = max(0, m - y\hat{y})$
where $\hat{y}$ is the predicted score, $y \in \\{-1, 1\\}$ is the true label, and $m$ is the margin parameter set to 1 by default.
Note that the labels used in this calculation are -1 and 1, unlike [Log Loss](xref:Microsoft.ML.Trainers.LogLoss), where the labels used are 0 and 1.
Also unlike [Log Loss](xref:Microsoft.ML.Trainers.LogLoss), $\hat{y}$ is the raw predicted score, not the predicted probability (which is calculated by applying a [sigmoid function](https://en.wikipedia.org/wiki/Sigmoid_function) to the predicted score).
While the hinge loss function is both convex and continuous, it is not smooth (that is not differentiable) at $y\hat{y} = m$.
Consequently, it cannot be used with gradient descent methods or stochastic gradient descent methods, which rely on differentiability over the entire domain.
For more, see [Hinge Loss for classification](https://en.wikipedia.org/wiki/Loss_functions_for_classification#Hinge_loss).
]]></format>
</remarks>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public HingeLoss (float margin = 1);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(float32 margin) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.ML.Trainers.HingeLoss.#ctor(System.Single)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (Optional margin As Single = 1)" />
<MemberSignature Language="F#" Value="new Microsoft.ML.Trainers.HingeLoss : single -> Microsoft.ML.Trainers.HingeLoss" Usage="new Microsoft.ML.Trainers.HingeLoss margin" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.ML.Data</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="margin" Type="System.Single" />
</Parameters>
<Docs>
<param name="margin">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="ComputeDualUpdateInvariant">
<MemberSignature Language="C#" Value="public float ComputeDualUpdateInvariant (float scaledFeaturesNormSquared);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance float32 ComputeDualUpdateInvariant(float32 scaledFeaturesNormSquared) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.ML.Trainers.HingeLoss.ComputeDualUpdateInvariant(System.Single)" />
<MemberSignature Language="VB.NET" Value="Public Function ComputeDualUpdateInvariant (scaledFeaturesNormSquared As Single) As Single" />
<MemberSignature Language="F#" Value="abstract member ComputeDualUpdateInvariant : single -> single
override this.ComputeDualUpdateInvariant : single -> single" Usage="hingeLoss.ComputeDualUpdateInvariant scaledFeaturesNormSquared" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:Microsoft.ML.Trainers.ISupportSdcaLoss.ComputeDualUpdateInvariant(System.Single)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>Microsoft.ML.Data</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Single</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="scaledFeaturesNormSquared" Type="System.Single" />
</Parameters>
<Docs>
<param name="scaledFeaturesNormSquared">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Derivative">
<MemberSignature Language="C#" Value="public float Derivative (float output, float label);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance float32 Derivative(float32 output, float32 label) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.ML.Trainers.HingeLoss.Derivative(System.Single,System.Single)" />
<MemberSignature Language="VB.NET" Value="Public Function Derivative (output As Single, label As Single) As Single" />
<MemberSignature Language="F#" Value="abstract member Derivative : single * single -> single
override this.Derivative : single * single -> single" Usage="hingeLoss.Derivative (output, label)" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:Microsoft.ML.Trainers.IScalarLoss.Derivative(System.Single,System.Single)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>Microsoft.ML.Data</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Single</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="output" Type="System.Single" />
<Parameter Name="label" Type="System.Single" />
</Parameters>
<Docs>
<param name="output">To be added.</param>
<param name="label">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="DualLoss">
<MemberSignature Language="C#" Value="public double DualLoss (float label, float dual);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance float64 DualLoss(float32 label, float32 dual) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.ML.Trainers.HingeLoss.DualLoss(System.Single,System.Single)" />
<MemberSignature Language="VB.NET" Value="Public Function DualLoss (label As Single, dual As Single) As Double" />
<MemberSignature Language="F#" Value="abstract member DualLoss : single * single -> double
override this.DualLoss : single * single -> double" Usage="hingeLoss.DualLoss (label, dual)" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:Microsoft.ML.Trainers.ISupportSdcaLoss.DualLoss(System.Single,System.Single)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>Microsoft.ML.Data</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Double</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="label" Type="System.Single" />
<Parameter Name="dual" Type="System.Single" />
</Parameters>
<Docs>
<param name="label">To be added.</param>
<param name="dual">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="DualUpdate">
<MemberSignature Language="C#" Value="public float DualUpdate (float output, float label, float alpha, float invariant, int maxNumThreads);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance float32 DualUpdate(float32 output, float32 label, float32 alpha, float32 invariant, int32 maxNumThreads) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.ML.Trainers.HingeLoss.DualUpdate(System.Single,System.Single,System.Single,System.Single,System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Function DualUpdate (output As Single, label As Single, alpha As Single, invariant As Single, maxNumThreads As Integer) As Single" />
<MemberSignature Language="F#" Value="abstract member DualUpdate : single * single * single * single * int -> single
override this.DualUpdate : single * single * single * single * int -> single" Usage="hingeLoss.DualUpdate (output, label, alpha, invariant, maxNumThreads)" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:Microsoft.ML.Trainers.ISupportSdcaLoss.DualUpdate(System.Single,System.Single,System.Single,System.Single,System.Int32)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>Microsoft.ML.Data</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Single</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="output" Type="System.Single" />
<Parameter Name="label" Type="System.Single" />
<Parameter Name="alpha" Type="System.Single" />
<Parameter Name="invariant" Type="System.Single" />
<Parameter Name="maxNumThreads" Type="System.Int32" />
</Parameters>
<Docs>
<param name="output">To be added.</param>
<param name="label">To be added.</param>
<param name="alpha">To be added.</param>
<param name="invariant">To be added.</param>
<param name="maxNumThreads">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Loss">
<MemberSignature Language="C#" Value="public double Loss (float output, float label);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance float64 Loss(float32 output, float32 label) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.ML.Trainers.HingeLoss.Loss(System.Single,System.Single)" />
<MemberSignature Language="VB.NET" Value="Public Function Loss (output As Single, label As Single) As Double" />
<MemberSignature Language="F#" Value="abstract member Loss : single * single -> double
override this.Loss : single * single -> double" Usage="hingeLoss.Loss (output, label)" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:Microsoft.ML.Trainers.ILossFunction`2.Loss(`0,`1)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>Microsoft.ML.Data</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Double</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="output" Type="System.Single" />
<Parameter Name="label" Type="System.Single" />
</Parameters>
<Docs>
<param name="output">To be added.</param>
<param name="label">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
</Members>
</Type>