Code: Select all

```
# Save the obtain probabilities for the signals:
signals <- net$getNodeValue("Signal")
# Save the mean:
mean_sig <- sum(signals*states)
mean_state <- sum(statesss*signal_norm)
# Set the evidence at the real stimulus value
# (that is set 0 for construction of the angles):
net$setContEvidence("Signal", 0)
# Update the network:
net$updateBeliefs()
# Clear the evidence of the real signal:
net$clearEvidence("Signal")
```

I want to retain and update the posterior probabilities of the nodes after each trial, allowing them to learn in the absence of the actual signal (net$setContEvidence("Signal", 0)). Then, in the subsequent trial, I intend to start with the updated probabilities, but with the signal status unknown.

I've attempted to store the probabilities of the nodes before clearing the evidence of the signal. However, I'm encountering difficulties in correctly resetting the probabilities to their previous values in the subsequent trial.

Code: Select all

```
# Save the probs of the nodes that are deleted by the following clearEvidence:
prob <- net$getNodeValue("Difficulty")
# Clear the evidence of the real signal:
net$clearEvidence("Signal")
net$setVirtualEvidence("Difficulty", prob)
```

UPDATE

I solved it by saving the probabilities before clearing the evidence and re-define the nodes with the previously updated probabilities.

I was wondering if there is a clever way to do it.