@@ -1451,224 +1451,8 @@ function _dbgSaveDFG(dfg::AbstractDFG,
1451
1451
folder* filename
1452
1452
end
1453
1453
1454
- # #==============================================================================
1455
- # # Delete at end v0.15.x
1456
- # #==============================================================================
1457
-
1458
-
1459
- @deprecate putCliqueMsgDown! (cdata:: BayesTreeNodeData , msg:: LikelihoodMessage ; from:: Symbol = :nothing ) putMsgDwnThis! (cdata, msg, from= from)
1460
-
1461
- # """
1462
- # $SIGNATURES
1463
-
1464
- # Initialization downward message passing is different from regular inference since
1465
- # it is possible that none of the child cliq variables have been initialized.
1466
-
1467
- # Notes
1468
- # - init upward msgs are individually stored in child cliques (pull model good).
1469
- # - fresh product of overlapping beliefs are calculated on each function call.
1470
- # - Assumed that `prnt` of siblings
1471
-
1472
- # Dev Notes
1473
- # - This should be the initialization cycle of parent, build up bit by bit...
1474
- # """
1475
- # function prepCliqInitMsgsDown!(fgl::AbstractDFG,
1476
- # tree::AbstractBayesTree,
1477
- # prnt::TreeClique,
1478
- # cliq::TreeClique;
1479
- # logger=ConsoleLogger() )
1480
- # #
1481
- # # tt = split(string(now()), 'T')[end]
1482
- # # with_logger(logger) do
1483
- # # @info "$(tt) prnt $(prnt.index), prepCliqInitMsgsDown! -- with cliq $(cliq.index)"
1484
- # # end
1485
-
1486
- # # FIXME use only LikelihoodMessage
1487
- # # check if any msgs should be multiplied together for the same variable
1488
- # # msgspervar = LikelihoodMessage() # or maybe Dict{Int, LikelihoodMessage}()
1489
- # msgspervar = getMsgInitDwnParent(tree, cliq, logger=logger)
1490
- # # reference to default dict location
1491
- # #JT 459 products = getMsgDwnThisInit(prnt)
1492
- # products = getfetchCliqueInitMsgDown(prnt.data, from=:getMsgDwnThisInit) |> deepcopy
1493
-
1494
- # ## TODO use parent factors too
1495
- # # intersect with the asking clique's separator variables
1496
- # condenseDownMsgsProductPrntFactors!(fgl, products, msgspervar, prnt, cliq, logger)
1497
-
1498
- # # with_logger(logger) do
1499
- # # @info "cliq $(prnt.index), prepCliqInitMsgsDown! -- vars fw/ down msgs=$(collect(keys(msgspervar)))"
1500
- # # end
1501
- # # flush(logger.stream)
1502
-
1503
- # # remove msgs that have no data
1504
- # rmlist = Symbol[]
1505
- # for (prsym,belmsg) in products.belief
1506
- # if belmsg.inferdim < 1e-10
1507
- # # no information so remove
1508
- # push!(rmlist, prsym)
1509
- # end
1510
- # end
1511
- # with_logger(logger) do
1512
- # @info "cliq $(prnt.index), prepCliqInitMsgsDown! -- rmlist, no inferdim, keys=$(rmlist)"
1513
- # end
1514
- # for pr in rmlist
1515
- # delete!(products.belief, pr)
1516
- # end
1517
-
1518
- # with_logger(logger) do
1519
- # @info "cliq $(prnt.index), prepCliqInitMsgsDown! -- product keys=$(collect(keys(products.belief)))"
1520
- # end
1521
-
1522
- # # now put the newly computed message in the appropriate container
1523
- # # FIXME THIS IS A PUSH MODEL, see #674 -- make pull model
1524
- # putCliqueInitMsgDown!(getCliqueData(prnt), products)
1525
-
1526
- # return products
1527
- # end
1528
-
1529
-
1530
- # used during nonparametric CK preparation, when information from multiple siblings must be shared together
1531
- # const IntermediateSiblingMessagesTB{T} = Vector{TreeBelief{T}}
1532
- # const IntermediateMultiSiblingMessagesTB{T} = Dict{Symbol, Vector{TreeBelief{T}}}
1533
-
1534
-
1535
- # FIXME , better standardize intermediate types
1536
- # can be replaced by Vector{TreeBelief}
1537
- # const IntermediateSiblingMessages = Vector{Tuple{BallTreeDensity,Float64}}
1538
- # const IntermediateMultiSiblingMessages = Dict{Symbol, IntermediateSiblingMessages}
1539
-
1540
-
1541
- # Helper function for prepCliqInitMsgsDown!
1542
- # populate products with products of upward messages
1543
- function condenseDownMsgsProductOnly! (fgl:: AbstractDFG ,
1544
- products:: LikelihoodMessage ,
1545
- msgspervar:: Dict{Symbol, <:AbstractVector} )
1546
- #
1547
- error (" condenseDownMsgsProductOnly!(::AbstractDFG,::LikelihoodMessage, ::IntermediateMultiSiblingMessages) is obsolete" )
1548
- # multiply multiple messages together
1549
- for (msgsym, msgsBo) in msgspervar
1550
- # check if this particular down message requires msgsym
1551
- if exists (fgl, msgsym) # DFG.hasVariable(fgl, msgsym)
1552
- if length (msgspervar[msgsym]) > 1
1553
- msgs = getindex .(msgsBo, 1 )
1554
- haspars = 0.0
1555
- for mb in msgsBo, val in mb[2 ]
1556
- haspars += val
1557
- end
1558
- products[msgsym] = (manifoldProduct (msgs, getManifolds (fgl, msgsym)), haspars)
1559
- else
1560
- # transfer if only have a single belief
1561
- products[msgsym] = (msgsBo[1 ][1 ], msgsBo[1 ][2 ])
1562
- end
1563
- else
1564
- # not required, therefore remove from message to avoid confusion
1565
- if haskey (products, msgsym)
1566
- delete! (products, msgsym)
1567
- end
1568
- end
1569
- end
1570
- nothing
1571
- end
1572
-
1573
- @deprecate getfetchCliqueMsgDown (cdata:: BayesTreeNodeData ; from:: Symbol = :nothing ) getfetchCliqueInitMsgDown (cdata, from= from)
1574
-
1575
- export getIdx
1576
-
1577
- """
1578
- $SIGNATURES
1579
-
1580
- Return interger index of desired variable element.
1581
-
1582
- Example
1583
- -------
1584
- ```julia
1585
- pp = RoME.Point2()
1586
- getIdx(pp, :posY) # = 2
1587
- ```
1588
-
1589
- Internal Notes
1590
- --------------
1591
- - uses number i < 100 for index number, and
1592
- - uses +100 offsets to track the minibatch number of the requested dimension
1593
- """
1594
- function getIdx (pp:: Tuple ,
1595
- sym:: Symbol ,
1596
- i:: Int = 0 )
1597
- #
1598
- error (" getIdx is obsolete, use DistributedFactorGraphs objects/methods instead." )
1599
- i-= 100
1600
- for p in pp
1601
- i,j = getIdx (p, sym, i)
1602
- if i > 0
1603
- return i, j
1604
- end
1605
- end
1606
- return i,- 1
1607
- end
1608
- getIdx (pp:: Symbol , sym:: Symbol , i:: Int = 0 ) = pp== sym ? (abs (i)% 100 + 1 , div (abs (i)- 100 ,100 )) : (i- 1 , div (abs (i)- 100 ,100 ))
1609
- function getIdx (pp:: InferenceVariable , sym:: Symbol , i:: Int = 0 )
1610
- return getIdx (pp. dimtype, sym)
1611
- end
1612
-
1613
-
1614
- # """
1615
- # $SIGNATURES
1616
-
1617
- # Get the latest down message from the parent node (without calculating anything).
1618
-
1619
- # Notes
1620
- # - Different from down initialization messages that do calculate new values -- see `prepCliqInitMsgsDown!`.
1621
- # - Basically converts function `getDwnMsgs` from `Dict{Symbol,BallTreeDensity}` to `Dict{Symbol,Vector{BallTreeDensity}}`.
1622
-
1623
- # Related
1624
-
1625
- # getMsgInitDwnParent
1626
- # """
1627
- # function getMsgDwnParent(treel::AbstractBayesTree, cliq::TreeClique)
1628
- # downmsgs = IntermediateMultiSiblingMessages()
1629
- # prnts = getParent(treel, cliq)
1630
- # if 0 < length(prnts)
1631
- # prnt = prnts[1]
1632
- # prntmsgs = getDwnMsgs(prnt)
1633
- # for (key, bel) in prntmsgs
1634
- # if !haskey(downmsgs, key)
1635
- # downmsgs[key] = IntermediateSiblingMessages()
1636
- # end
1637
- # # TODO insert true inferred dim
1638
- # push!(downmsgs[key], bel)
1639
- # end
1640
- # end
1641
-
1642
- # return downmsgs
1643
- # end
1644
-
1645
-
1646
- # function getMsgDwnThisInit(cdat::BayesTreeNodeData)
1647
- # iifdepwarn("#459 replace with getfetchCliqueMsgDown", :getMsgDwnThisInit)
1648
- # return cdat.downInitMsg
1649
- # end
1650
1454
1651
- @deprecate fetchDataElement (dfg:: AbstractDFG , varsym:: Symbol , lbl:: Symbol ) fetchDataJSON (dfg, varsym, lbl)
1652
-
1653
-
1654
- function addMsgFactors! (subfg:: AbstractDFG ,
1655
- msgs:: Dict{Symbol, <:AbstractVector} ) # Dict{Symbol, Vector{Tuple{BallTreeDensity, Float64}}} )
1656
- # msgs::
1657
- # add messages as priors to this sub factor graph
1658
- @warn " Tuple{KDE,Floa64} specific version of addMsgFactors! is deprecated, use LikelihoodMessage version instead."
1659
- msgfcts = DFGFactor[]
1660
- svars = DFG. listVariables (subfg)
1661
- for (msym, dms) in msgs
1662
- for treebelief in dms
1663
- if msym in svars
1664
- # TODO should be on manifold prior, not just generic euclidean prior -- okay since variable on manifold, but not for long term
1665
- fc = addFactor! (subfg, [msym], MsgPrior (manikde! (treebelief), treebelief. inferdim), graphinit= false )
1666
- push! (msgfcts, fc)
1667
- end
1668
- end
1669
- end
1670
- return msgfcts
1671
- end
1672
1455
1673
1456
1674
1457
1458
+ #
0 commit comments