Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
PRIMO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Social Cognitive Systems
PRIMO
Commits
1ac60d24
Commit
1ac60d24
authored
10 years ago
by
Hendrik Buschmeier
Browse files
Options
Downloads
Patches
Plain Diff
Allowing soft-evidence to be used when unrolling the DBN.
parent
888d5084
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
primo/networks.py
+17
-4
17 additions, 4 deletions
primo/networks.py
with
17 additions
and
4 deletions
primo/networks.py
+
17
−
4
View file @
1ac60d24
...
...
@@ -320,12 +320,22 @@ class TwoTBN(BayesianNetwork):
cpd
.
add_variable
(
node
)
node
.
set_cpd
(
cpd
)
if
not
initial
:
node
.
set_probability
(
1.
,
[(
node
,
state
[
node_t
])])
if
isinstance
(
state
[
node_t
],
basestring
):
node
.
set_probability
(
1.
,
[(
node
,
state
[
node_t
])])
else
:
# Set soft evidence
#print "from twotbn: setting " + str(node) + " cpt to " + str(state[node_t])
node
.
get_cpd
().
set_probability_table
(
state
[
node_t
])
else
:
for
node0
in
state
:
if
node0
.
name
==
node
.
name
:
node
.
set_probability
(
1.
,
[(
node
,
state
[
node0
])])
continue
if
node0
.
name
==
node_t
.
name
:
if
isinstance
(
state
[
node0
],
basestring
):
node
.
set_probability
(
1.
,
[(
node
,
state
[
node0
])])
else
:
# Set soft evidence
#print "from b0: setting " + str(node) + " cpt to " + str(state[node0])
node
.
get_cpd
().
set_probability_table
(
state
[
node0
])
break
return
self
...
...
@@ -354,6 +364,9 @@ class TwoTBN(BayesianNetwork):
node1
=
self
.
get_node
(
node_name_t
)
self
.
__initial_nodes
.
append
((
node0
,
node1
))
def
get_initial_nodes
(
self
):
return
self
.
__initial_nodes
def
has_initial_node_by_name
(
self
,
node_name
):
'''
Check if this instance has an inital node with name node_name.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment