Skip to content

Commit 324cb58

Browse files
committed
Rename outdated composition
1 parent 256d64a commit 324cb58

File tree

2 files changed

+13
-61
lines changed

2 files changed

+13
-61
lines changed

src/regularized/sparse_argmax.jl

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/utils/pushforward.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Pushforward{L,G}
33
4-
Differentiable composition of a probabilistic `layer` with an arbitrary function `post_processing`.
4+
Differentiable pushforward of a probabilistic `layer` with an arbitrary function `post_processing`.
55
66
`Pushforward` can be used for direct regret minimization (aka learning by experience) when the post-processing returns a cost.
77
@@ -16,38 +16,38 @@ struct Pushforward{L,P}
1616
post_processing::P
1717
end
1818

19-
function Base.show(io::IO, composition::Pushforward)
20-
(; layer, post_processing) = composition
19+
function Base.show(io::IO, pushforward::Pushforward)
20+
(; layer, post_processing) = pushforward
2121
return print(io, "Pushforward($layer, $post_processing)")
2222
end
2323

2424
"""
25-
compute_probability_distribution(composition, θ)
25+
compute_probability_distribution(pushforward, θ)
2626
27-
Output the distribution of `composition.post_processing(X)`, where `X` follows the distribution defined by `composition.layer` applied to `θ`.
27+
Output the distribution of `pushforward.post_processing(X)`, where `X` follows the distribution defined by `pushforward.layer` applied to `θ`.
2828
29-
This function is not differentiable if `composition.post_processing` isn't.
29+
This function is not differentiable if `pushforward.post_processing` isn't.
3030
3131
See also: [`apply_on_atoms`](@ref).
3232
"""
33-
function compute_probability_distribution(composition::Pushforward, θ; kwargs...)
34-
(; layer, post_processing) = composition
33+
function compute_probability_distribution(pushforward::Pushforward, θ; kwargs...)
34+
(; layer, post_processing) = pushforward
3535
probadist = compute_probability_distribution(layer, θ; kwargs...)
3636
post_processed_probadist = apply_on_atoms(post_processing, probadist; kwargs...)
3737
return post_processed_probadist
3838
end
3939

4040
"""
41-
(composition::Pushforward)(θ)
41+
(pushforward::Pushforward)(θ)
4242
43-
Output the expectation of `composition.post_processing(X)`, where `X` follows the distribution defined by `composition.layer` applied to `θ`.
43+
Output the expectation of `pushforward.post_processing(X)`, where `X` follows the distribution defined by `pushforward.layer` applied to `θ`.
4444
45-
Unlike [`compute_probability_distribution(composition, θ)`](@ref), this function is differentiable, even if `composition.post_processing` isn't.
45+
Unlike [`compute_probability_distribution(pushforward, θ)`](@ref), this function is differentiable, even if `pushforward.post_processing` isn't.
4646
4747
See also: [`compute_expectation`](@ref).
4848
"""
49-
function (composition::Pushforward)(θ::AbstractArray{<:Real}; kwargs...)
50-
(; layer, post_processing) = composition
49+
function (pushforward::Pushforward)(θ::AbstractArray{<:Real}; kwargs...)
50+
(; layer, post_processing) = pushforward
5151
probadist = compute_probability_distribution(layer, θ; kwargs...)
5252
return compute_expectation(probadist, post_processing; kwargs...)
5353
end

0 commit comments

Comments
 (0)