tests/full_gradient_test3a_com_OUTPUT.R

# > w.test
# [1] -0.4689827 -0.2557522  0.1457067  0.8164156 -0.5966361  0.7967794  0.8893505  0.3215956  0.2582281 -0.8764275
# [11] -0.5880509 -0.6468865

#-----------------------------------------------------------------------------------

# Before mrf.exact.nll(w.test, com, samps, infer.exact)

# node/edge pots 1

# > com$par.stat <- mrf.stat(com, samps)
# > com$par.stat
# [1] 42 11 10 41  6  3 39  6 10 39  2  1
# > com$gradient
# [1] 0 0 0 0 0 0 0 0 0 0 0 0
# > com$nll
# [1] 0
# > com$par
# [1] 0 0 0 0 0 0 0 0 0 0 0 0

#-----------------------------------------------------------------------------------

# After mrf.exact.nll(w.test, com, samps, infer.exact)

# > com$par.stat
# [1] 42 11 10 41  6  3 39  6 10 39  2  1
# > com$gradient
#  [1] -24.9023954   7.9999483  21.7773959  -8.1601513   1.1372617  18.0397088 -24.9948916   8.0676550   0.3381746
# [10] -29.4391696  15.9373933   2.3201487
# > com$nll
# [1] 141.5314
# > com$par
#  [1] -0.4689827 -0.2557522  0.1457067  0.8164156 -0.5966361  0.7967794  0.8893505  0.3215956  0.2582281 -0.8764275
# [11] -0.5880509 -0.6468865

# > com$node.pot
# [,1] [,2]
# [1,] 0.6256384    1
# [2,] 0.7743338    1
# [3,] 1.1568569    1
# [4,] 2.2623760    1

# > com$edge.pot
# [[1]]
# [,1]     [,2]
# [1,] 0.5506609 1.000000
# [2,] 1.0000000 2.218385
#
# [[2]]
# [,1]     [,2]
# [1,] 2.433549 1.000000
# [2,] 1.000000 1.379327
#
# [[3]]
# [,1]      [,2]
# [1,] 1.294634 1.0000000
# [2,] 1.000000 0.4162674
#
# [[4]]
# [,1]      [,2]
# [1,] 0.5554088 1.0000000
# [2,] 1.0000000 0.5236737


# > infer.exact(com)
# $node.bel
# [,1]      [,2]
# [1,] 0.3419521 0.6580479
# [2,] 0.3799990 0.6200010
# [3,] 0.6355479 0.3644521
# [4,] 0.6567970 0.3432030
#
# $edge.bel
# $edge.bel[[1]]
# [,1]      [,2]
# [1,] 0.1427452 0.1992069
# [2,] 0.2372537 0.4207942
#
# $edge.bel[[2]]
# [,1]       [,2]
# [1,] 0.2801022 0.06184992
# [2,] 0.3766948 0.28135310
#
# $edge.bel[[3]]
# [,1]      [,2]
# [1,] 0.2067635 0.1732355
# [2,] 0.4287844 0.1912166
#
# $edge.bel[[4]]
# [,1]       [,2]
# [1,] 0.3587479 0.27680005
# [2,] 0.2980491 0.06640297
#
#
# $logZ
# [1] 3.119087

#No change in node/edge pots


#-----------------------------------------------------------------------------------


# Re-scale potentials:
# > mrf.update(com) # Rescales potentials
# > com$node.pot
# [,1]      [,2]
# [1,] 0.6256384 1.0000000
# [2,] 0.7743338 1.0000000
# [3,] 1.0000000 0.8644112
# [4,] 1.0000000 0.4420132
# > com$edge.pot
# [[1]]
# [,1]      [,2]
# [1,] 0.2482260 0.4507784
# [2,] 0.4507784 1.0000000
#
# [[2]]
# [,1]      [,2]
# [1,] 1.0000000 0.4109225
# [2,] 0.4109225 0.5667965
#
# [[3]]
# [,1]      [,2]
# [1,] 1.000000 0.7724190
# [2,] 0.772419 0.3215329
#
# [[4]]
# [,1]      [,2]
# [1,] 0.5554088 1.0000000
# [2,] 1.0000000 0.5236737


# Beliefs from re-scaled pots:
# > infer.exact(com)
# $node.bel
# [,1]      [,2]
# [1,] 0.3419521 0.6580479
# [2,] 0.3799990 0.6200010
# [3,] 0.6355479 0.3644521
# [4,] 0.6567970 0.3432030
#
# $edge.bel
# $edge.bel[[1]]
# [,1]      [,2]
# [1,] 0.1427452 0.1992069
# [2,] 0.2372537 0.4207942
#
# $edge.bel[[2]]
# [,1]       [,2]
# [1,] 0.2801022 0.06184992
# [2,] 0.3766948 0.28135310
#
# $edge.bel[[3]]
# [,1]      [,2]
# [1,] 0.2067635 0.1732355
# [2,] 0.4287844 0.1912166
#
# $edge.bel[[4]]
# [,1]       [,2]
# [1,] 0.3587479 0.27680005
# [2,] 0.2980491 0.06640297
#
#
# $logZ
# [1] 0.2126063
npetraco/CRFutil documentation built on Nov. 23, 2023, 11:30 a.m.