Skip to content

Commit 3e439c9

Browse files
Fix CompositeDataSet constructor
1 parent 4611149 commit 3e439c9

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

ext/InformationGeometryProfileLikelihoodJLext.jl

+5-7
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,16 @@ using Optimization: AbstractADType
1515
Constructs `LikelihoodProblem` struct from given `DataModel`.
1616
"""
1717
function ProfileLikelihood.LikelihoodProblem(DM::AbstractDataModel, Mle::AbstractVector=MLE(DM);
18-
adtype::AbstractADType=Optimization.AutoForwardDiff(), Domain::Union{HyperCube,Nothing}=GetDomain(DM),
19-
syms::AbstractVector{<:Symbol}=Pnames(DM), maxval::Real=1e5,
18+
adtype::AbstractADType=Optimization.AutoForwardDiff(), maxval::Real=1e5, Domain::Union{HyperCube,Nothing}=GetDomain(DM)FullDomain(length(Mle),maxval),
19+
syms::AbstractVector{<:Symbol}=Pnames(DM), LogLikelihooodFn::Function=InformationGeometry.loglikelihood(DM),
2020
lb=(!isnothing(Domain) ? Domain.L : fill(-maxval,length(Mle))), ub=(!isnothing(Domain) ? Domain.U : fill(maxval,length(Mle))),
2121
cons=nothing, lcons=nothing, ucons=nothing, f_kwargs=NamedTuple(), prob_kwargs=NamedTuple(), kwargs...)
2222

23-
L = InformationGeometry.loglikelihood(DM)
24-
2523
f_kwargs = (; adtype=adtype, cons=cons, f_kwargs...)
2624
# any(isfinite, lb) && any(isfinite, lb) &&
2725
prob_kwargs = (; lb=lb, ub=ub, prob_kwargs...)
2826

29-
ProfileLikelihood.LikelihoodProblem((p,x)->L(p), Mle; syms, f_kwargs=f_kwargs, prob_kwargs=prob_kwargs, kwargs...)
27+
ProfileLikelihood.LikelihoodProblem((p,x)->LogLikelihooodFn(p), Mle; syms, f_kwargs=f_kwargs, prob_kwargs=prob_kwargs, kwargs...)
3028
end
3129

3230

@@ -35,7 +33,7 @@ end
3533
Computes profiles for given `idxs` up to given confidence threshold `Confnum` in units of `σ` via the `ProfileLikelihood.jl` package.
3634
"""
3735
function ProfileLikelihood.profile(DM::AbstractDataModel, Confnum::Real=1; idxs=1:pdim(DM), N::Int=31, meth=Optim.LBFGS(), OptimMeth=meth, alg=OptimMeth,
38-
parallel::Bool=true, resolution=N, Domain::Union{HyperCube,Nothing}=GetDomain(DM), maxval::Real=1e5, Mle::AbstractVector=MLE(DM),
36+
parallel::Bool=true, resolution=N, maxval::Real=1e5, Mle::AbstractVector=MLE(DM), Domain::Union{HyperCube,Nothing}=GetDomain(DM)FullDomain(length(Mle),maxval),
3937
lb=(!isnothing(Domain) ? Domain.L : fill(-maxval,length(Mle))), ub=(!isnothing(Domain) ? Domain.U : fill(maxval,length(Mle))), kwargs...)
4038
prob = ProfileLikelihood.LikelihoodProblem(DM; Domain, maxval, lb, ub)
4139
sol = ProfileLikelihood.mle(prob, alg)
@@ -49,7 +47,7 @@ end
4947
Computes bivariate profiles for given `idxs` up to given confidence threshold `Confnum` in units of `σ`, where pairs of parameters are fixed at different values and the remaining parameters are re-optimized.
5048
"""
5149
function ProfileLikelihood.bivariate_profile(DM::AbstractDataModel, Confnum::Real=1; idxs=nothing, N::Int=31, meth=Optim.LBFGS(), OptimMeth=meth, alg=OptimMeth,
52-
parallel::Bool=true, resolution=N, Domain::Union{HyperCube,Nothing}=GetDomain(DM), maxval::Real=1e5, Mle::AbstractVector=MLE(DM),
50+
parallel::Bool=true, resolution=N, maxval::Real=1e5, Mle::AbstractVector=MLE(DM), Domain::Union{HyperCube,Nothing}=GetDomain(DM)FullDomain(length(Mle),maxval),
5351
lb=(!isnothing(Domain) ? Domain.L : fill(-maxval,length(Mle))), ub=(!isnothing(Domain) ? Domain.U : fill(maxval,length(Mle))), kwargs...)
5452
prob = ProfileLikelihood.LikelihoodProblem(DM; Domain, maxval, lb, ub)
5553
sol = ProfileLikelihood.mle(prob, alg)

src/DataStructures/CompositeDataSet.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ InvCov::AbstractMatrix=Diagonal([1,2.]),
138138
logdetInvCov::Real=-Inf,
139139
WoundX::AbstractVector=[0.],
140140
SharedYdim::Val=Val(true),
141-
name::StringOrSymb=Symbol()) = CompositeDataSet(DSs, logdetInvCov, WoundX, SharedYdim, name)
141+
name::StringOrSymb=Symbol()) = CompositeDataSet(DSs, InvCov, logdetInvCov, WoundX, SharedYdim, name)
142142

143143

144144
Data(CDS::CompositeDataSet) = CDS.DSs

src/Subspaces.jl

+4-3
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,10 @@ Base.BigFloat(C::HyperCube) = HyperCube(BigFloat.(C.L), BigFloat.(C.U))
436436
intersect(Cubes::AbstractVector{<:HyperCube}) -> HyperCube
437437
Returns new `HyperCube` which is the intersection of the given `HyperCube`s.
438438
"""
439-
function Base.intersect(A::HyperCube, B::HyperCube)
440-
HyperCube(map(max, A.L, B.L), map(min, A.U, B.U))
441-
end
439+
Base.intersect(A::HyperCube, B::HyperCube) = HyperCube(map(max, A.L, B.L), map(min, A.U, B.U))
440+
Base.intersect(N::Nothing, C::HyperCube) = C
441+
Base.intersect(C::HyperCube, N::Nothing) = C
442+
442443
function Base.intersect(Cubes::AbstractVector{<:HyperCube})
443444
LowerMatrix = [Cubes[i].L for i in eachindex(Cubes)] |> Unpack
444445
UpperMatrix = [Cubes[i].U for i in eachindex(Cubes)] |> Unpack

0 commit comments

Comments
 (0)