Skip to content

Commit

Permalink
fixed error with get_surprise when there are missing inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
PTWaade committed Aug 5, 2024
1 parent 9fc5ced commit b883ee3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/utils/get_surprise.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ Equation:
"""
function get_surprise(node::ContinuousInputNode)

#If there was no input
if ismissing(node.states.input_value)
#Return no surprise
return 0
end

#Sum the predictions of the vaue parents
parents_prediction_mean = 0
for parent in node.edges.observation_parents
Expand All @@ -85,6 +91,12 @@ Calculate the surprise of a binary input node on seeing the last input.

function get_surprise(node::BinaryInputNode)

#If there was no input
if ismissing(node.states.input_value)
#Return no surprise
return 0
end

#Sum the predictions of the vaue parents
parents_prediction_mean = 0
for parent in node.edges.observation_parents
Expand Down Expand Up @@ -137,6 +149,12 @@ Calculate the surprise of a categorical input node on seeing the last input.
"""
function get_surprise(node::CategoricalInputNode)

#If there was no input
if ismissing(node.states.input_value)
#Return no surprise
return 0
end

#Get value parent
parent = node.edges.observation_parents[1]

Expand Down

0 comments on commit b883ee3

Please sign in to comment.