|
132 | 132 |
|
133 | 133 |
|
134 | 134 |
|
135 | | -""" |
136 | | - $SIGNATURES |
137 | | -
|
138 | | -Print basic summary of graph to `logger=ConsoleLogger()`. |
139 | | -""" |
140 | | -function printGraphSummary(dfg::G, logger=ConsoleLogger())::Nothing where {G <: AbstractDFG} |
141 | | - vars = ls(dfg) |
142 | | - fcts = lsf(dfg) |
143 | | - |
144 | | - prio = lsfPriors(dfg) |
145 | | - |
146 | | - isinit = map(x->isInitialized(dfg,x), vars) |
147 | | - infdim = map(x->getVariableInferredDim(dfg, x), vars) |
148 | | - numedges = map(v->length(ls(dfg, v)), vars) |
149 | | - numfed = map(fc->length(ls(dfg, fc)), fcts) |
150 | | - vardims = map(v->getDimension(getVariable(dfg, v)), vars) |
151 | | - fctdims = map(v->getDimension(getFactor(dfg, v)), fcts) |
152 | | - priodims = map(v->getDimension(getFactor(dfg, v)), prio) |
153 | | - |
154 | | - with_logger(logger) do |
155 | | - @info "Distributed Factor Graph summary:" |
156 | | - @info " num variables: $(length(vars))" |
157 | | - @info " num factors: $(length(fcts)), w/ $(length(prio)) priors" |
158 | | - @info " var initialized: $(sum(isinit))" |
159 | | - @info "" |
160 | | - @info " var num edges: min. $(minimum(numedges)) | mean $(round(Statistics.mean(numedges),digits=2)) | 90% $(round(quantile(numedges,0.9),digits=2)) | max. $(maximum(numedges))" |
161 | | - @info " fct num edges: min. $(minimum(numfed)) | mean $(round(Statistics.mean(numfed),digits=2)) | 90% $(round(quantile(numfed,0.9),digits=2)) | max. $(maximum(numfed))" |
162 | | - @info " Variable dims: min. $(minimum(vardims)) | mean $(round(Statistics.mean(vardims),digits=2)) | 90% $(round(quantile(vardims,0.9),digits=2)) | max. $(maximum(vardims))" |
163 | | - @info " Factor dims: min. $(minimum(fctdims)) | mean $(round(Statistics.mean(fctdims),digits=2)) | 90% $(round(quantile(fctdims,0.9),digits=2)) | max. $(maximum(fctdims))" |
164 | | - @info " Prior dimens: min. $(minimum(priodims)) | mean $(round(Statistics.mean(priodims),digits=2)) | 90% $(round(quantile(priodims,0.9),digits=2)) | max. $(maximum(priodims))" |
165 | | - @info " var infr'dims: min. $(minimum(infdim)) | mean $(round(Statistics.mean(infdim),digits=2)) | 90% $(round(quantile(infdim,0.9),digits=2)) | max. $(maximum(infdim))" |
166 | | - end |
167 | | - nothing |
168 | | -end |
169 | | - |
170 | | -""" |
171 | | - $SIGNATURES |
172 | | -
|
173 | | -Print basic summary of graph to `logger=ConsoleLogger()`. |
174 | | -""" |
175 | | -function printSummary(dfg::G, logger=ConsoleLogger()) where G <: AbstractDFG |
176 | | - printGraphSummary(dfg, logger) |
177 | | -end |
178 | | - |
179 | | - |
180 | | -""" |
181 | | - $SIGNATURES |
182 | | -
|
183 | | -Build an approximate density `[Y|X,DX,.]=[X|Y,DX][DX|.]` as proposed by the conditional convolution. |
184 | | -
|
185 | | -Notes |
186 | | -- Assume both are on circular manifold, `manikde!(pts, (:Circular,))` |
187 | | -""" |
188 | | -function approxConvCircular(pX::ManifoldKernelDensity, |
189 | | - pDX::ManifoldKernelDensity; N::Int=100) |
190 | | - # |
191 | | - |
192 | | - # building basic factor graph |
193 | | - tfg = initfg() |
194 | | - addVariable!(tfg, :s1, Sphere1) |
195 | | - addVariable!(tfg, :s2, Sphere1) |
196 | | - addFactor!(tfg, [:s1;:s2], Sphere1Sphere1(pDX), graphinit=false) |
197 | | - initManual!(tfg,:s1, pX) |
198 | | - |
199 | | - # solve for outgoing proposal value |
200 | | - approxConv(tfg,:s1s2f1,:s2) |
201 | | -end |
202 | | - |
203 | | -function approxConvCircular(pX::ManifoldKernelDensity, |
204 | | - pDX::SamplableBelief; N::Int=100) |
205 | | - # |
206 | | - pts = reshape(rand(pDX, N), 1, :) |
207 | | - pC = manikde!(pts, Sphere1) |
208 | | - approxConvCircular(pX, pC) |
209 | | -end |
210 | | - |
211 | | - |
212 | | -function approxConvCircular(pX::SamplableBelief, |
213 | | - pDX::ManifoldKernelDensity; N::Int=100) |
214 | | - # |
215 | | - pts = reshape(rand(pX, N), 1, :) |
216 | | - pC = manikde!(pts, Sphere1) |
217 | | - approxConvCircular(pC, pDX) |
218 | | -end |
219 | | - |
220 | | - |
221 | 135 |
|
222 | 136 | # |
0 commit comments