The target distances and list of accepted simulations during the ABC algorithm are separate attributes of the SimulationBundle and are therefore difficult to work with, requiring extra manipulation steps to compare the acceptance and distance as a function of the input parameters.
Changes
Added the function collate_accept as a setter function in SimulationBundle that generates a polars DataFrame from the calculated distances dictionary and joins these results to the initial parameter inputs for quick diagnostics and manipulation. The simulation column is then checked for existing in the accept dictionary keys for fast filtering of the distance results.
This function is then tested in the toy model workflow developed earlier to ensure that the accepted logical column exists, that the number of TRUE values is equivalent to the number of accepted simulations, and that no simulations listed as accepted in the DataFrame have a distance greater than the threshold tolerance of the ABC-SMC step.
Next steps
Unittest was used for testing to follow previous implementation. Analogous tests should be implemented in Pytest.
Overview
The target distances and list of accepted simulations during the ABC algorithm are separate attributes of the
SimulationBundle
and are therefore difficult to work with, requiring extra manipulation steps to compare the acceptance and distance as a function of the input parameters.Changes
Added the function
collate_accept
as a setter function inSimulationBundle
that generates a polarsDataFrame
from the calculateddistances
dictionary and joins these results to the initial parameter inputs for quick diagnostics and manipulation. Thesimulation
column is then checked for existing in theaccept
dictionary keys for fast filtering of the distance results.This function is then tested in the toy model workflow developed earlier to ensure that the accepted logical column exists, that the number of
TRUE
values is equivalent to the number of accepted simulations, and that no simulations listed as accepted in the DataFrame have a distance greater than the threshold tolerance of the ABC-SMC step.Next steps
Unittest
was used for testing to follow previous implementation. Analogous tests should be implemented inPytest
.