Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MKD helpers now ignore partial if full #137

Merged
merged 1 commit into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/API.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,13 @@ function manifoldProduct( ff::AbstractVector{<:ManifoldKernelDensity},
for msk in partialDimMask
otherDims .|= msk
end
# error(otherDims)

# build new output ManifoldKernelDensity
bws[:] = getKDEManifoldBandwidths(pGM, manif)
bel = kde!(pGM, bws, addopT, diffopT)

# FIXME u0 might not be representative of the partial information
if sum(otherDims) == ndims
return ManifoldKernelDensity(mani, bel, nothing, ff[1]._u0)
else
return ManifoldKernelDensity(mani, bel, (1:ndims)[otherDims], ff[1]._u0)
end
return ManifoldKernelDensity(mani, bel, otherDims, ff[1]._u0)
end


Expand Down
26 changes: 24 additions & 2 deletions src/services/ManifoldKernelDensity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,33 @@ export calcMean

ManifoldKernelDensity(mani::M,
bel::B,
partial::L=nothing,
::Nothing=nothing,
u0::P=zeros(manifold_dimension(mani));
infoPerCoord::AbstractVector{<:Real}=ones(getNumberCoords(mani, u0)) ) where {M <: MB.AbstractManifold, B <: BallTreeDensity, L, P} = ManifoldKernelDensity{M,B,L,P}(mani,bel,partial,u0,infoPerCoord)
infoPerCoord::AbstractVector{<:Real}=ones(getNumberCoords(mani, u0)) ) where {M <: MB.AbstractManifold, B <: BallTreeDensity, P} = ManifoldKernelDensity{M,B,Nothing,P}(mani,bel,nothing,u0,infoPerCoord)
#

function ManifoldKernelDensity( mani::M,
bel::B,
partial::L,
u0::P=zeros(manifold_dimension(mani));
infoPerCoord::AbstractVector{<:Real}=ones(getNumberCoords(mani, u0)) ) where {M <: MB.AbstractManifold, B <: BallTreeDensity, L<:AbstractVector{<:Integer}, P}
#
if length(partial) != manifold_dimension(mani)
# call the constructor direct
return ManifoldKernelDensity{M,B,L,P}(mani,bel,partial,u0,infoPerCoord)
else
# full manifold, therefore equivalent to L::Nothing
return ManifoldKernelDensity(mani,bel,nothing,u0;infoPerCoord=infoPerCoord)
end
end

ManifoldKernelDensity(mani::M,
bel::B,
pl_mask::Union{<:BitVector,<:AbstractVector{<:Bool}},
u0::P=zeros(manifold_dimension(mani));
infoPerCoord::AbstractVector{<:Real}=ones(getNumberCoords(mani, u0)) ) where {M <: MB.AbstractManifold, B <: BallTreeDensity, P} = ManifoldKernelDensity(mani,bel,(1:manifold_dimension(mani))[pl_mask],u0;infoPerCoord=infoPerCoord)


function ManifoldKernelDensity( M::MB.AbstractManifold,
vecP::AbstractVector{P},
u0=vecP[1];
Expand Down