Maps
Index
TransportMaps.ComposedMapTransportMaps.LaplaceMapTransportMaps.LinearMapTransportMaps.PolynomialMapTransportMaps.PolynomialMapComponentTransportMaps.conditional_densityTransportMaps.conditional_sampleTransportMaps.evaluateTransportMaps.getcoefficientsTransportMaps.getmultiindexsetsTransportMaps.inverseTransportMaps.multivariate_conditional_densityTransportMaps.multivariate_conditional_sampleTransportMaps.numbercoefficientsTransportMaps.numberdimensionsTransportMaps.pullbackTransportMaps.pushforwardTransportMaps.setcoefficients!TransportMaps.setparameters!
Types
TransportMaps.PolynomialMap Type
PolynomialMap <: AbstractTriangularMapTriangular transport map with polynomial basis.
Fields
components::Vector{PolynomialMapComponent{<:AbstractPolynomialBasis}}: Vector of map componentsreference::MapReferenceDensity: Reference density of the mapforwarddirection::Symbol::targetfor map from density,:referencefor map from samples
Constructors
PolynomialMap(dimension::Int,degree::Int, referencetype::Symbol=:normal, rectifier::AbstractRectifierFunction=Softplus(), basis::AbstractPolynomialBasis=LinearizedHermiteBasis(), map_type::Symbol=:total): Initialize polynomial map for map from density.DiagonalMap(dimension::Int, degree::Int, referencetype::Symbol=:normal, rectifier::AbstractRectifierFunction=Softplus(), basis::AbstractPolynomialBasis=LinearizedHermiteBasis()): Initialize diagonal map with diagonal structure.NoMixedMap(dimension::Int, degree::Int, referencetype::Symbol=:normal, rectifier::AbstractRectifierFunction=Softplus(), basis::AbstractPolynomialBasis=LinearizedHermiteBasis()): Initialize diagonal map without mixed terms.
TransportMaps.PolynomialMapComponent Type
PolynomialMapComponent{T<:AbstractPolynomialBasis} <: AbstractMapComponentA single component Mᵏ of a triangular transport map with polynomial basis.
Fields
basisfunctions::Vector{MultivariateBasis{T}}: Vector of multivariate basis functionscoefficients::Vector{Float64}: Coefficients for the basis functionsrectifier::AbstractRectifierFunction: Rectifier function applied to partial derivativesindex::Int: Index k indicating the component dimension
Constructors
PolynomialMapComponent(index::Int, degree::Int, rectifier::AbstractRectifierFunction=Softplus(), basis::AbstractPolynomialBasis=HermiteBasis(), map_type::Symbol=:total): Initialize component with specified degree and basis type.PolynomialMapComponent(index::Int, degree::Int, rectifier::AbstractRectifierFunction, basis::AbstractPolynomialBasis, density::Distributions.UnivariateDistribution, map_type::Symbol=:total): Initialize component using analytical reference density.PolynomialMapComponent(index::Int, degree::Int, rectifier::AbstractRectifierFunction, basis::AbstractPolynomialBasis, samples::AbstractMatrix{Float64}, map_type::Symbol=:total): Initialize component using sample data.PolynomialMapComponent(multi_indices::Vector{Vector{Int}}, rectifier::AbstractRectifierFunction, basis::AbstractPolynomialBasis, samples::AbstractMatrix{Float64}): Initialize component with custom multi-index sets from samples.PolynomialMapComponent(multi_indices::Vector{Vector{Int}}, rectifier::AbstractRectifierFunction, basis::AbstractPolynomialBasis, reference_density::Distributions.UnivariateDistribution): Initialize component with custom multi-index sets from density.
TransportMaps.LinearMap Type
LinearMap <: AbstractLinearMapA linear transformation map that standardizes data using mean and standard deviation.
Fields
μ::Vector{Float64}: Mean vector for each dimensionσ::Vector{Float64}: Standard deviation vector for each dimension
Constructors
LinearMap(samples::Matrix{Float64}): Compute empirical mean and standard deviation from samples.LinearMap(μ::Vector{Float64}, σ::Vector{Float64}): Construct linear map with explicit mean and standard deviation.
TransportMaps.LaplaceMap Type
LaplaceMap <: AbstractLinearMapA linear transport map based on the Laplace approximation of a target density.
The Laplace approximation assumes the target density is approximately Gaussian around its mode. The map is defined by a location parameter (mode) and a scale parameter (Cholesky factor of the covariance).
Fields
mode::Vector{Float64}: Mode or mean vector of the approximationchol::Matrix{Float64}: Lower Cholesky factor L of the covariance matrix (Σ = L * L')
Constructors
LaplaceMap(samples::Matrix{Float64}): Constructs a LaplaceMap from sample data by
computing the empirical mean and covariance.
LaplaceMap(density::MapTargetDensity, x0::Vector{Float64}; optimizer::Optim.AbstractOptimizer = LBFGS(), options::Optim.Options = Optim.Options()): Compute a Laplace approximation of a target density by finding the mode via optimization and computing the Hessian at the mode. Ifhessian_backendisnothing, uses the same backend as the density.
TransportMaps.ComposedMap Type
ComposedMap{T<:AbstractLinearMap} <: AbstractComposedMapA composed transport map consisting of a linear map followed by a polynomial map.
The composition is defined as S(x) = M(L(x)) where L is the linear map of type T and M is the polynomial map. The linear map can be a LinearMap or LaplaceMap.
Fields
linearmap<:T: The linear map componentpolynomialmap::PolynomialMap: The polynomial map component
Constructors
ComposedMap(lm::AbstractLinearMap, pm::PolynomialMap)
Functions
TransportMaps.evaluate Function
evaluate(mvb::MultivariateBasis{T}, z::Vector{<:Real}) where T<:AbstractPolynomialBasisEvaluate the multivariate basis function at point z.
sourceevaluate(map_component::PolynomialMapComponent, z::AbstractVector{<:Real})Evaluate the polynomial map component Mᵏ(z) at point z.
Computes Mᵏ(z) = f(z₁,...,zₖ₋₁,0) + ∫₀^{zₖ} g(∂f/∂xₖ) dxₖ, where g is the rectifier.
sourceevaluate(map_component::PolynomialMapComponent, Z::AbstractMatrix{<:Real})Evaluate the map component at multiple points (row-wise) using multithreading.
Returns a vector where element i is Mᵏ(Z[i,:]).
sourceevaluate(M::PolynomialMap, z::AbstractVector{<:Real})Evaluate the polynomial map at point z.
Returns a vector where each component i is Mⁱ(z₁,...,zᵢ).
sourceevaluate(M::PolynomialMap, Z::AbstractMatrix{<:Real})Evaluate the polynomial map at multiple points (row-wise) using multithreading.
Each row of Z is a point to evaluate. Returns a matrix where row i contains M(Z[i,:]).
sourceevaluate(L::LinearMap, x::AbstractVector{<:Real})Apply the linear transformation (x - μ) / σ to standardize the input.
sourceevaluate(L::LinearMap, X::AbstractMatrix{<:Real})Apply the linear transformation to multiple points (row-wise).
sourceevaluate(L::LaplaceMap, x::AbstractVector{<:Real})Apply the Laplace map transformation: L⁻¹(x - mode).
sourceevaluate(L::LaplaceMap, X::AbstractMatrix{<:Real})Apply the Laplace map transformation to multiple points (row-wise).
sourceevaluate(C::ComposedMap, x::AbstractVector{<:Real})Evaluate the composed map: S(x) = M(L(x)).
sourceevaluate(C::ComposedMap, X::AbstractMatrix{<:Real})Evaluate the composed map for multiple points (row-wise).
sourceTransportMaps.inverse Function
inverse(map_component::PolynomialMapComponent, zₖ₋₁::AbstractVector{<:Real}, xₖ::Real)Compute the inverse of the map component using one-dimensional root finding.
Given z[1:k-1] and the target value xₖ, finds zₖ such that Mᵏ(z) = xₖ.
sourceinverse(M::PolynomialMap, x::AbstractVector{<:Real}, k::Int=numberdimensions(M))Compute the inverse of the first k components of the map at point x.
Returns z such that M(z)[1:k] = x[1:k].
sourceinverse(M::PolynomialMap, X::AbstractMatrix{<:Real}, k::Int=numberdimensions(M))Compute the inverse at multiple points using multithreading.
Returns a matrix where row i contains M⁻¹(X[i,:])[1:k].
sourceinverse(L::LinearMap, y::AbstractVector{<:Real})Invert the linear transformation: y * σ + μ to recover the original scale.
sourceinverse(L::LinearMap, Y::AbstractMatrix{<:Real})Invert the transformation for multiple points (row-wise).
sourceinverse(L::LaplaceMap, y::AbstractVector{<:Real})Invert the Laplace map: L * y + mode.
sourceinverse(L::LaplaceMap, Y::AbstractMatrix{<:Real})Invert the transformation for multiple points (row-wise).
sourceinverse(C::ComposedMap, z::AbstractVector{<:Real})Invert the composed map: S⁻¹(z) = L⁻¹(M⁻¹(z)).
sourceinverse(C::ComposedMap, Z::AbstractMatrix{<:Real})Invert the composed map for multiple points (row-wise).
sourceTransportMaps.pushforward Function
pushforward(M::PolynomialMap, target::MapTargetDensity, z::AbstractVector{<:Real})Compute the pushforward density ρ(z) = π(M(z)) |det J_M(z)|.
Maps the target density back through M to the reference space.
sourcepushforward(M::PolynomialMap, target::MapTargetDensity, Z::AbstractMatrix{<:Real})Compute pushforward densities at multiple points using multithreading.
Returns a vector where element i is the pushforward density at Z[i,:].
sourceTransportMaps.pullback Function
pullback(M::PolynomialMap, x::AbstractVector{<:Real})Compute the pullback density π̂(x) = ρ(M⁻¹(x)) |det J_{M⁻¹}(x)|.
Maps the reference density through M to approximate the target density.
sourcepullback(M::PolynomialMap, X::AbstractMatrix{<:Real})Compute pullback densities at multiple points using multithreading.
Returns a vector where element i is the pullback density at X[i,:].
sourcepullback(C::ComposedMap, x::AbstractVector{<:Real})Compute the pullback density: π(S(x)) * |det(∇S(x))|.
sourcepullback(C::ComposedMap, X::AbstractMatrix{<:Real})Compute the pullback density for multiple points (row-wise).
sourceTransportMaps.setcoefficients! Function
setcoefficients!(map_component::PolynomialMapComponent, coefficients::AbstractVector{<:Real})Set the coefficients of the map component.
sourcesetcoefficients!(M::PolynomialMap, coefficients::AbstractVector{<:Real})Set all coefficients of the polynomial map.
Coefficients are ordered by component: [c₁₁, c₁₂, ..., c₂₁, c₂₂, ..., cᵈₙ].
sourceTransportMaps.getcoefficients Function
getcoefficients(map_component::PolynomialMapComponent)Get a copy of the coefficients from the map component.
sourcegetcoefficients(M::PolynomialMap)Get all coefficients from the polynomial map.
Returns a vector with coefficients ordered by component.
sourceTransportMaps.setparameters! Function
setparameters!(map::LinearMap, μ::AbstractVector{<:Real}, σ::AbstractVector{<:Real})Set the mean and standard deviation parameters of the linear map.
sourceTransportMaps.numbercoefficients Function
numbercoefficients(map_component::PolynomialMapComponent)Return the number of coefficients in the map component.
sourcenumbercoefficients(M::PolynomialMap)Return the total number of coefficients in the polynomial map.
sourceTransportMaps.numberdimensions Function
numberdimensions(M::PolynomialMap)Return the number of dimensions (components) of the polynomial map.
sourcenumberdimensions(L::LinearMap)Return the number of dimensions of the linear map.
sourcenumberdimensions(L::LaplaceMap)Return the number of dimensions of the Laplace map.
sourcenumberdimensions(C::ComposedMap)Return the number of dimensions of the composed map.
sourceTransportMaps.getmultiindexsets Function
getmultiindexsets(map_component::PolynomialMapComponent)Return the multi-indices as a matrix (one per row).
sourceTransportMaps.conditional_density Function
conditional_density(M::PolynomialMap, x_range::Real, x_given::AbstractVector{<:Real})Compute the conditional density π(xₖ | x₁, ..., xₖ₋₁) at x_range given x_given.
sourceconditional_density(M::PolynomialMap, x_range::AbstractVector{<:Real}, x_given::AbstractVector{<:Real})Compute conditional densities at multiple x_range values using multithreading.
sourceTransportMaps.conditional_sample Function
conditional_sample(M::PolynomialMap, x_given::AbstractVector{<:Real}, z_range::Real)Generate a sample from π(xₖ | x₁, ..., xₖ₋₁) by pushing forward z_range ~ ρ(z_range).
sourceconditional_sample(M::PolynomialMap, x_given::AbstractVector{<:Real}, z_range::AbstractVector{<:Real})Generate multiple samples from π(xₖ | x₁, ..., xₖ₋₁) using multithreading.
sourceTransportMaps.multivariate_conditional_density Function
multivariate_conditional_density(M::PolynomialMap, x::AbstractVector{<:Real})Compute the multivariate conditional density π(xⱼ, xⱼ₊₁, ..., xₖ | x₁, ..., xⱼ₋₁) as ∏ᵢ₌ⱼᵏ π(xᵢ | x₁, ..., xᵢ₋₁).
sourcemultivariate_conditional_density(M::PolynomialMap, x_range::AbstractVector{<:Real}, x_given::AbstractVector{<:Real})Compute the conditional density π(xⱼ, ..., xₖ | x₁, ..., xⱼ₋₁) where x_range = [xⱼ, ..., xₖ].
sourceTransportMaps.multivariate_conditional_sample Function
multivariate_conditional_sample(M::PolynomialMap, x_given::AbstractVector{<:Real}, z_range::AbstractVector{<:Real})Generate samples from π(xⱼ, ..., xₖ | x₁, ..., xⱼ₋₁) by sequentially pushing forward z_range values.
source