Formalization and simulation
Testing a program does not end with the correct calculation of one example. Two sets of parameters may produce similar results, and different models may be indistinguishable in the chosen environment. In this chapter we formally separate the generator, available observations, forecast and measurement. Then we will perform the restoration of parameters and models on artificial data, where the generating mechanism is known. This is the preparation of an analysis that will later work with an unknown cause.
Formalization makes commitments visible
The verbal model allows for useful ambiguity early on. But to test it you will need to decide what exactly happens between the two events. Is history preserved while the source is missing? Does the probability of the underlying cause change every moment or only with a new observation? Does the contradiction update one record or the entire system? These decisions can change the prediction, although the brief description of the model remains the same.
Formalization does not necessarily mean making mathematics more complex, but rather eliminating such ambiguities. The input, state, transition, and measurement must form a procedure that another researcher can reproduce. The program helps you check the consequences of the rules. However, the agreement between the code and the specification and the suitability of the specification for explaining the experience remain distinct issues.
Define the learning environment separately from the model
Let's expand the example of two sources A and B. Each has a hidden binary state: a common cause or different causes. In a learning environment, the state of the source is preserved with probability 0.9 the next time it is accessed. The observed positive sign appears with probability 0.75 for a common cause and 0.25 for different causes. This is a constructed environment, not a description of a physiological mechanism.
The experimenter sets hidden states and observations. The model receives only the source and the feature. Therefore, the prediction of the next symptom and the assessment of the underlying cause can be measured separately. If the model sees the hidden cause directly, the filtering task will disappear. The separation of the environment and the observer must be maintained even when they are written in the same file.
The retention rate of 0.9 corresponds to the retention rate of 0.8 from chapter 25. After a possible change in reason, the previous belief shifts to 0.5 according to the rule that we have already used. Now this rule has a certain meaning in the data generator. A different environment might require different dynamics.
Determining the Predicted Outcome
The belief 0.8 means the probability of a common cause. It is not equal to the probability of the next positive sign. If 0.75 is reliable, the next sign may turn out to be negative even with a common cause. The prediction of a positive sign is obtained by mixing two possibilities: the probability of a common cause is multiplied by 0.75, the probability of different causes is multiplied by 0.25; the results add up.
def predict_positive(prior_common, reliability=0.75):
return (
prior_common * reliability
+ (1.0 - prior_common) * (1.0 - reliability)
)
Given the belief 0.8, the prediction of a positive sign is 0.65. This is a verifiable numerical difference. If one compares a belief about a cause with a trait's frequency directly, the model may erroneously appear to be poorly calibrated. Therefore, the name of each output number must indicate the event whose probability it represents.
The human assessment of belonging will add another layer. It is neither a true causal cue nor a subsequent sensory cue. The connection between the internal state and such an assessment requires its own measurement model. Formalization helps to notice these transitions before analyzing the results.
Record the model time
In our simple M2, retention is applied the next time a particular source is accessed. If A remains absent for a long time, its record does not weaken at each intervening event from B. This is a convenient rule for a teaching calculation. A hypothesis about human memory, however, may require dependence on elapsed time.
The second version will attenuate the recording for each time step. With the coefficient 0.8 and two skipped steps, the influence of the previous deviation will be successively multiplied by 0.8 twice. Now the duration of absence will become an independent predictor. The two versions can be compared by presenting the same number of events at different intervals.
Don't quietly correct the first version after seeing an inconvenient result. Changing the model time means a new hypothesis. Keep the old rules, describe the reason for the revision and get new predictions. This is especially important for connection with experience: subjective continuity should not be explained by an arbitrarily changing concept of time.
Figure 82. Two clearly different models of memory timing. Accurate training calculation when initially recording 0.75 and holding 0.8. The saved state is shown during the absence of A, before a new access and before a new observation: in two skipped steps, the temporary version comes to 0.66, and the access version stores 0.75.
Check parameter values
Two mechanisms can produce the same final number. Belief 0.75, if the positive attribute 0.75 is reliable, is updated to 0.9. The initial belief 0.5 with the reliability of 0.9 is also updated to 0.9. Whether a high value is due to a strong story or strong new evidence cannot be determined from a single summary response.
To distinguish the parameters, other conditions are needed. You can independently evaluate the discrimination of the current feature, change the length of the history, and add contradictory events. Then check whether the different sets of parameters remain practically indistinguishable. Parameter uncertainty is a result of the analysis, not an obstacle to be hidden by choosing one nice set.
Try recovery on artificial data. Set the parameters, generate the sequence, then have the analysis find them without access to the original values. If a procedure routinely confuses retention with reliability, human subjects research will face the same predicament. Increasing the number of similar events may not eliminate structural ambiguity.
Check model recovery
Now generate separate datasets with M0, M1, and M2, adding the predefined variability in observation. The analysis must compare every model for each dataset. Ideally, it will favor the mechanism that generated the data, but this cannot be assumed. The conditions may barely distinguish the competing models, or the selection rule may systematically favor the more flexible model.
Reconstruction of parameters and models is discussed in the methodological work of Wilson and Collins. Our specific generators and sequences serve as a stand-alone tutorial on this logic. A successful test here demonstrates the ability of the assay to perform under known conditions; it does not prove that real data is generated by one of the models considered. [43]
It is useful to add a fourth generator that does not match any candidate. Then you can see how the procedure selects the best of the incorrect models. Even a convincing victory in a limited set of competitors does not mean that a valid mechanism has been found. Testing the absolute quality of the forecast should complement the relative comparison.
Figure 83. The limit of available information and the ambiguity of parameters. Training diagram and accurate calculation. The upper part separates the latent cause in the environment generator from the available observation model; The dotted line denotes a separately specified response generation model. In the lower example, positive evidence with reliability 0.75 under preliminary persuasion 0.75 and with reliability 0.90 under persuasion 0.50 gives one result 0.90. Here, the pre-belief is given immediately before observation: no additional memory decay is applied. One total does not determine both parameters.
Maintain reproducibility
For each run, record the rule version, parameters, initial state, and order of events. When generating randomly, fix the initial values of the generators. But one seed is not enough if the sequence of calls to randomness has changed. Additional observation should not inadvertently shift the entire future scenario of the compared version.
Separate condition generation and agent decisions. Potential observations at each step can be prepared in advance, and the agent's action will determine which one is discovered. If the action physically changes the future environment, this change must be part of the causal model. Comparability does not mean an artificial prohibition on the consequences of an action.
Also save the raw results and the summary program. Otherwise, fixing one filter may imperceptibly change the numbers in the text. In the final set, the reader should see how the sequence produced predictions, the predictions - errors, and the errors - the conclusion. This chain is more important than the decorative complexity of the interface.
From simulation to exploratory inference
Simulation can establish that a mechanism is realizable, what consequences it has, and under what conditions models differ. It can also show the impossibility of the desired result given the chosen rules. But the artificial data generated by the model itself does not independently confirm its applicability to a person or biological network.
For the hypothesis of chapter 26, additional description of the execution is required. If computational organization is significant, show that the program actually implements it, including responses to interventions. If certain physical interactions are significant, justification at this level will be required. The simulation graph does not replace the question of what process is actually occurring in the medium.
Executable recovery procedure
In the extended workshop, the generator M0 creates independent binary features with probability 0.5. The M1 generator stores one hidden cause for the entire sequence, the M2 generator stores a separate cause for each alternating source. When contacted, the cause remains with probability 0.9, and a positive sign appears with probability 0.75 for reason 1 and 0.25 for reason 0. The initial causes are equally probable. Thus, the generating environment is specified independently of the analyzing model.
Model recovery uses 30 independent sequences of 120 events for each of the three generators. Analyzers M0, M1 and M2 receive the same source labels and features, but not hidden causes. In each trial, the probability of a positive attribute is first stored, then its meaning is discovered and the belief is updated. The main criterion here is the mean square error. If the results are exactly equal, a draw remains; randomly assigning a winner does not add distinguishability.
To restore the parameters M2, a predetermined retention grid from 0 to 1 with a step 0.1 and a reliability grid from 0.55 to 0.95 with a step 0.05 is used. For each pair, the error of the complete trajectory is calculated on known artificial data. This small search makes neighboring nearly equal solutions visible. It is a training procedure and not a universally best method for estimating parameters.
Control with one source must give equality to M1 and M2. Additionally, all series where the selected analysis did not favor the generating mechanism are saved. The matrix of such choices shows the ability of this particular amount of data and criterion to distinguish between these particular generators. For a different environment, different noise or different mesh, the test is performed again.
After checking the instrument, you can set the main experiment of the chapter to 34. The use of known artificial causes here is legal for the evaluator who verifies the restoration. Transferring these reasons to the predictive candidate itself would defeat the purpose and make success uninformative.
One outcome does not determine the origin of confidence
Belief 0.75, when the positive attribute 0.75 is plausible, is updated to 0.9. The original 0.5 with the reliability of 0.9 also gives 0.9. A finite number alone is not enough to restore the power of past and new evidence. Therefore, analysis needs a trajectory, contradictory signs and different conditions. Testing on data from a well-known generator shows where the procedure confuses parameters and where it confuses entire models. If the competitors are computationally identical, such a test should detect a tie rather than artificially assign a winner.
What has now been established
Simulation allows one to explore the consequences and discriminability of rules. It is not independent evidence of their applicability to human experience. Now let's check the comparison tool itself.
Practice 33 Explore mechanism uncertainty
Why do it: Reproduce recovery on known generators and find the area of ambiguity.
What you will need: Update M0-M2, difference between the probability of a hidden cause and the probability of a sign, a unit of independent repetition. The workshop added an executable example of comparison and recovery.
Time reference: 40–60 minutes. Can be done intermittently; This is not a speed standard.
1. Run python teaching_lab.py --chapter 33. Generators and parameter grid are described before practice; all predictions are recorded before the current feature is opened.
2. Consider the errors M0, M1 and M2 on each series, then the selection table for a known generator. Save all model classification errors.
3. For M2, compare several retention and reliability values. Find neighboring combinations that are close by mistake and check intermediate states.
4. In the single-channel condition, check the equality of M1 and M2. Compare the time by calls and calendar steps in the sequence with missing A.
What to keep: Restoration result, known equality control, and one condition that enhances parameter discrimination.
Hint: Do not discard series in which the candidate that did not generate the data won. They characterize the chosen procedure and the amount of information.
Exploratory follow-up: Add a generator that does not match any candidate and evaluate the absolute quality of the best model. Test the recovery under a different variability and number of observations by committing to a new plan before running.
Analysis and answers - Appendix F, chapter 33, p. 296
Self-test
1. Why is the probability of a common cause different from the probability of a positive attribute?
2. Does the restoration of M2 on the data of M2 itself prove its truth for humans?
3. Why does changing the forgetting rule require a separate version of the model?
The limitations of the analysis itself are now known. In the next chapter we will document how it will be applied to new data so that the result does not select its own validation rules.
Chapter 34

