Chad Scherrer
Chad Scherrer
It's like a Val with proper subtyping and arithmetic methods, so more can be computed statically. Great trick for pushing work to compile time.
I think it will still be type-stable. When we call ```julia productmeasure(::AbstractArray{T,N}) ``` the rule can fire or not depending on `issingletontype(T)`. I think it's enough for it to be...
Currently (in #120) we have ```julia _generic_productmeasure_impl(mar::AbstractArray) = ProductMeasure(asmeasure.(mar)) ``` We could change this to ```julia function _generic_productmeasure_impl(mar::AbstractArray{T}) where {T} if Base.issingletontype(T) first(mar) ^ size(mar) else ProductMeasure(asmeasure.(mar)) end end ```
I guess we could even make it ```julia if Base.issingletontype(T) || allequal(mar) ``` This requires walking through `mar`, and the fallback `asmeasure.(mar)` will require another traversal. It'd be better if...
Keeping it simple for now. Added this as a test: ```julia julia> productmeasure(fill(Lebesgue(), 5)) isa PowerMeasure true ```
Good idea! Done.
I think I have at least a partial approach that may help. First, we enforce laws ```julia # Law 1 logdensity_def(μ, x) == logdensity_rel(μ, basemeasure(μ), x) # Law 2 logdensity_rel(pushfwd(f,...
For later reference: https://math.stackexchange.com/questions/4412857/radon-nikodym-derivative-and-push-forward-of-measures
Oh great idea! I hadn't thought of StatsModels. I've played with connecting MLJ, but to really do it the right way it needs support for correlated weights: https://github.com/alan-turing-institute/MLJ.jl/issues/552
Oh good, looks like this is already fixed by https://github.com/JuliaMath/MeasureBase.jl/pull/120