π§ͺ Add comprehensive testing and validation logic for GenerativeModel#3
π§ͺ Add comprehensive testing and validation logic for GenerativeModel#3
Conversation
Added missing validation and normalization logic to the GenerativeModel __post_init__ function. The core matrix inputs (A, B, D) are now safely normalized, and assertions were added to raise a ValueError if any negative probabilities are detected. Additionally, a comprehensive test suite (alf/tests/test_generative_model.py) was created to test initialization, auto-computed attributes, matrix normalizations, invalid matrix validations, policy enumeration logic (both single and multi-factor models across different horizons), and habit generation (default and custom E matrices). Co-authored-by: m9h <28337207+m9h@users.noreply.github.com>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Updated the GitHub Actions CI workflow to point to the correct `alf/` directory instead of the non-existent `src/` and `tests/` directories, resolving the failing pipeline checks. Co-authored-by: m9h <28337207+m9h@users.noreply.github.com>
π― What: The testing gap for the GenerativeModel class was addressed. Previously, the class lacked tests for core functionalities, including matrix validation and normalization.
π Coverage: The following scenarios are now covered by the new
alf/tests/test_generative_model.pytest suite:num_modalities,num_factors,num_obs,num_states,num_actions).A,B,C, andDinputs are converted tonp.float64ndarrays.ValueErrors are raised if invalid matrices with negative probabilities are supplied.T=1,T=2).Ematrix, as well as the successful preservation of a user-supplied customEmatrix.β¨ Result: A significant improvement in test coverage has been achieved, fortifying the core initialization of the Active Inference models. By also implementing the missing strict probability normalizations and non-negativity validations directly in
GenerativeModel.__post_init__, the model's reliability has substantially increased.PR created automatically by Jules for task 11686316768010037417 started by @m9h