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

feat: add input validation for non-private methods of approximation.py #260

Merged
merged 11 commits into from
Dec 6, 2023

Conversation

pc532627
Copy link
Contributor

Refs: 251

PR Type

  • Feature

Description

Input validation added for approximation.py as a check before proceeding with other modules.

How Has This Been Tested?

Test A: test_kernel_mean_approximator_creation_invalid_types
Test B: test_random_approximator_creation_invalid_types
Test C: test_annchor_approximator_creation_invalid_types
Test D: test_nystrom_approximator_creation_invalid_types

Checklist before requesting a review

  • I have made sure that my PR is not a duplicate.
  • My code follows the style guidelines of this project.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have performed a self-review of my code.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.

@pc532627 pc532627 requested a review from tp832944 November 28, 2023 16:39
@pc532627
Copy link
Contributor Author

@tp832944 first module covered for an initial check of the approach. I suggest we don't verify inputs of private functions, as these are not intended to be accessed by users. We need to clarify exactly what is an acceptable input if something is just 'array like' and how to check this. Also, we should verify what to do with JIT decorated functions - if they check only on first call, then we aren't validating on future calls when compiled. I suggest we don't input validate in these cases.

Copy link
Contributor

@tp832944 tp832944 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your validation function idea is good @pc532627. I've suggested several changes to keep it more general.

coreax/validation.py Outdated Show resolved Hide resolved
coreax/validation.py Outdated Show resolved Hide resolved
coreax/validation.py Outdated Show resolved Hide resolved
coreax/validation.py Show resolved Hide resolved
coreax/validation.py Outdated Show resolved Hide resolved
coreax/validation.py Outdated Show resolved Hide resolved
coreax/validation.py Outdated Show resolved Hide resolved
coreax/validation.py Outdated Show resolved Hide resolved
tests/unit/test_validation.py Show resolved Hide resolved
coreax/approximation.py Outdated Show resolved Hide resolved
@pc532627 pc532627 requested a review from tp832944 December 5, 2023 09:48
Copy link
Contributor

@tp832944 tp832944 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your changes @pc532627. Here are a few more please.

coreax/validation.py Outdated Show resolved Hide resolved
coreax/validation.py Outdated Show resolved Hide resolved
coreax/validation.py Outdated Show resolved Hide resolved
coreax/validation.py Outdated Show resolved Hide resolved
tests/unit/test_validation.py Show resolved Hide resolved
tests/unit/test_validation.py Show resolved Hide resolved
tests/unit/test_validation.py Show resolved Hide resolved
tests/unit/test_validation.py Show resolved Hide resolved
tests/unit/test_validation.py Outdated Show resolved Hide resolved
coreax/approximation.py Show resolved Hide resolved
@pc532627 pc532627 requested a review from tp832944 December 6, 2023 16:30
Copy link
Contributor

@tp832944 tp832944 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good @pc532627. Now for someone else to extend it to the rest of the codebase (new PR).

@tp832944 tp832944 merged commit 6d4d34f into feature/oop_106 Dec 6, 2023
0 of 8 checks passed
@tp832944 tp832944 deleted the feature/input_validation_251 branch December 6, 2023 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assess levels of input validation and make necessary changes in approximation.py
2 participants