File tree Expand file tree Collapse file tree 3 files changed +12
-15
lines changed
Expand file tree Collapse file tree 3 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -32,12 +32,7 @@ with g and h functions of y.
3232
3333- `(regularized::AbstractRegularized)(θ; kwargs...)`: return `ŷ(θ)`
3434- `compute_regularization(regularized, y)`: return `Ω(y)`
35-
36- # Available implementations
37-
38- - [`SoftArgmax`](@ref)
39- - [`SparseArgmax`](@ref)
40- - [`RegularizedFrankWolfe`](@ref)
35+ - `get_maximizer(regularized)`: return the associated `GeneralizedMaximizer` optimizer
4136"""
4237abstract type AbstractRegularizedGeneralizedMaximizer <: AbstractRegularized end
4338
@@ -48,16 +43,18 @@ Return the convex penalty `Ω(y)` associated with an `AbstractRegularized` layer
4843"""
4944function compute_regularization end
5045
46+ """
47+ get_maximizer(regularized)
48+
49+ Return the associated optimizer.
50+ """
51+ function get_maximizer end
52+
5153@required AbstractRegularized begin
5254 # (regularized::AbstractRegularized)(θ::AbstractArray; kwargs...)
5355 compute_regularization (:: AbstractRegularized , :: AbstractArray )
5456end
5557
56- """
57- TODO
58- """
59- function get_maximizer end
60-
6158@required AbstractRegularizedGeneralizedMaximizer begin
6259 get_maximizer (:: AbstractRegularizedGeneralizedMaximizer )
6360end
Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ Corresponds to regularized prediction on the probability simplex with entropic p
77"""
88struct SoftArgmax <: AbstractRegularized end
99
10- (:: SoftArgmax )(z; kwargs... ) = soft_argmax (z)
11- compute_regularization (:: SoftArgmax , y) = soft_argmax_regularization (y)
10+ (:: SoftArgmax )(z:: AbstractVector ; kwargs... ) = soft_argmax (z)
11+ compute_regularization (:: SoftArgmax , y:: AbstractVector ) = soft_argmax_regularization (y)
1212
1313function soft_argmax (z:: AbstractVector )
1414 s = exp .(z)
Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ Corresponds to regularized prediction on the probability simplex with square nor
77"""
88struct SparseArgmax <: AbstractRegularized end
99
10- (:: SparseArgmax )(z; kwargs... ) = sparse_argmax (z)
11- compute_regularization (:: SparseArgmax , y) = sparse_argmax_regularization (y)
10+ (:: SparseArgmax )(z:: AbstractVector ; kwargs... ) = sparse_argmax (z)
11+ compute_regularization (:: SparseArgmax , y:: AbstractVector ) = sparse_argmax_regularization (y)
1212
1313function sparse_argmax (z:: AbstractVector ; kwargs... )
1414 p, _ = simplex_projection_and_support (z)
You can’t perform that action at this time.
0 commit comments