Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstract error checking #687

Merged
merged 11 commits into from
Aug 16, 2024

Conversation

njtierney
Copy link
Collaborator

Resolves #529

* Moving more checking functions into checkers.R
* Using cli_abort instead of stop
* update snapshots
* check_2d_multivariate
* check_2d
* check_if_greta_mcmc_list
* check_if_model_info
* check_positive_scalar
* check_scalar
* check_finite
* check_x_gte_y
* check_numeric_length_1
* check_not_greta_array()
* check_param_greta_array()
* check_final_dim()
* check_rows_equal()
* check_is_column_array()
* check_stats_dim_matches_x_dim()
* check_x_matches_ncol()
* check_transpose()
* check_2_by_1()
* check_fields_installed()
* check_diagrammer_installed()
* check_ncols_match()
* check_greta_data_frame()
* check_greta_array_type()
* check_unfixed_discrete_distributions()
* check_not_data_greta_arrays()
* check_greta_arrays_associated_with_model()
* check_nodes_all_variable()
* check_initial_values_correct_dim()
* check_initial_values_match_chains()
* check_initials_are_numeric()
* check_initials_are_named()
* check_weights_dim()
* check_num_distributions()
* check_not_discrete_continuous()
* check_not_multivariate_univariate()
* check_distribution_support()
* check_compatible_dimensions()
* check_both_2d()
change logic in cholesky variable to clarify error catching intent
* Add `dim` argument to `check_square` so you can either pass x, and then calculate dim, or pass a dimension
* check_dim_length()
* check_is_distribution_node()
* check_values_dim()
* check_dot_nodes_scalar()
* inform_if_one_set_of_initials()
* check_subgraphs()
* check_has_representation()
* check_is_greta_array()
@njtierney
Copy link
Collaborator Author

njtierney commented Aug 16, 2024

This is a pretty decently sized refactor of checking functions.

There is still more work to be done with making these simpler and easier to understand. At the moment I'm happy to merge this in and revisit this alter at another release. The goals for that revisit/spring clean should be:

  • Look at various "TODO" notes to identify places for refactoring wrt checking
  • Consider consolidating/categorising checking functions in checkers.R.
    • e.g., Put all installation checking functions in checkers-installation.R, put inference related checking functions in checkers-inference.R.
    • Review similar checking functions and see if they can be combined. We might not need so many custom checking functions
    • Check test coverage to ensure that the checking functions are all covered. This provides another way to look at improving test coverage
    • Revisit the error messages provided - could they provide more information?
    • Ensure all checking functions are exported in module.

I will put the above notes into a separate issue so I can remember these things!

* check_for_free_state_error()
* check_initial_values_correct_class()
* check_missing_infinite_values()
* check_timeout()
* check_sampling_implemented()
* check_truncation_implemented()
* add internal `are_intials()` function
@njtierney njtierney merged commit 53dd4af into greta-dev:master Aug 16, 2024
10 checks passed
@njtierney njtierney deleted the abstract-error-checkers-529 branch August 16, 2024 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

abstract error/checking parts of greta
1 participant