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

Feature/update variable estimates #421

Merged
merged 19 commits into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
27 changes: 14 additions & 13 deletions src/CliqStateMachineUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -638,28 +638,29 @@ function areSiblingsRemaingNeedDownOnly(tree::BayesTree,
return true
end

function setVariablePosteriorEstimates!(var::DFG.DFGVariable )::Nothing

function setVariablePosteriorEstimates!(subfg::G,
sym::Symbol )::Nothing where G <: AbstractDFG
#

var = getVariable(subfg, sym)
bel = getKDE(var)
ops = buildHybridManifoldCallbacks(getManifolds(var))

@show varMax = getKDEMax(bel, addop=ops[1], diffop=ops[2])
@show varMean = getKDEMean(bel)
# TODO: We need to populate PPE.
@show varPpe = deepcopy(varMax) #TODO
varMax = getKDEMax(bel, addop=ops[1], diffop=ops[2])
varMean = getKDEMean(bel)
# TODO: We need to populate varModeMeans.
# varModeMeans = ...

var.estimateDict[:default] = Dict{Symbol, VariableEstimate}(
:max => VariableEstimate(:default, :max, varMax),
:mean => VariableEstimate(:default, :mean, varMean),
:ppe => VariableEstimate(:default, :ppe, varPpe))
defaultestdict = get!(var.estimateDict, :default, Dict{Symbol, VariableEstimate}())
defaultestdict[:max] = VariableEstimate(:default, :max, varMax)
defaultestdict[:mean] = VariableEstimate(:default, :mean, varMean)
#FIXME defaultestdict[:mode_means] = VariableEstimate(:default, softtype, varModeMeans)

return nothing
end

function setVariablePosteriorEstimates!(subfg::AbstractDFG,
sym::Symbol )::Nothing
setVariablePosteriorEstimates!(getVariable(subfg, sym))
end

"""
$SIGNATURES

Expand Down
2 changes: 2 additions & 0 deletions src/FactorGraph01.jl
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,8 @@ function doautoinit!(dfg::T,
end
pts,inferdim = predictbelief(dfg, vsym, useinitfct, logger=logger)
setValKDE!(xi, pts, true, inferdim)
#TODO test
setVariablePosteriorEstimates!(xi)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dehann, I think adding extra data breaks compare test, but I haven't had time to dig into the details.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these compare functions recently moved to DFG, so we should just tie up there too -- thanks!

didinit = true
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/FactorGraphTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ end

Initialize an empty in-memory DistributedFactorGraph `::DistributedFactorGraph` object.
"""
function initfg(dfg::T=GraphsDFG{SolverParams}(params=SolverParams());
function initfg(dfg::T=InMemDFGType(params=SolverParams());
sessionname="NA",
robotname="",
username="",
Expand Down