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

Allow parsing of nested numbers from config #400

Closed
wants to merge 2 commits into from

Conversation

JasonKChow
Copy link
Contributor

Summary:
Nested arrays were not directly parseable from the config. E.g., [12, [2, 4], 2, [2.0, 4]] would raise an exception.

If a nested array is detected, it will check whether the desired type is either a float or an int and if so, it'll evaluate the string as a number then recursively cast.

If the desired type is neither a float nor an int, it will raise a ValueException.

Differential Revision: D64138450

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 10, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D64138450

JasonKChow added a commit to JasonKChow/aepsych that referenced this pull request Oct 10, 2024
Summary:

Nested arrays were not directly parseable from the config. E.g., [12, [2, 4], 2, [2.0, 4]] would raise an exception.

If a nested array is detected, it will check whether the desired type is either a float or an int and if so, it'll evaluate the string as a number then recursively cast.

If the desired type is neither a float nor an int, it will raise a ValueException.

Differential Revision: D64138450
JasonKChow added a commit to JasonKChow/aepsych that referenced this pull request Oct 10, 2024
Summary:

Nested arrays were not directly parseable from the config. E.g., [12, [2, 4], 2, [2.0, 4]] would raise an exception.

If a nested array is detected, it will check whether the desired type is either a float or an int and if so, it'll evaluate the string as a number then recursively cast.

If the desired type is neither a float nor an int, it will raise a ValueException.

Differential Revision: D64138450
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D64138450

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D64138450

JasonKChow added a commit to JasonKChow/aepsych that referenced this pull request Oct 14, 2024
Summary:

Nested arrays were not directly parseable from the config. E.g., [12, [2, 4], 2, [2.0, 4]] would raise an exception.

If a nested array is detected, it will check whether the desired type is either a float or an int and if so, it'll evaluate the string as a number then recursively cast.

If the desired type is neither a float nor an int, it will raise a ValueException.

Differential Revision: D64138450
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D64138450

JasonKChow added a commit to JasonKChow/aepsych that referenced this pull request Oct 14, 2024
Summary:

Nested arrays were not directly parseable from the config. E.g., [12, [2, 4], 2, [2.0, 4]] would raise an exception.

If a nested array is detected, it will check whether the desired type is either a float or an int and if so, it'll evaluate the string as a number then recursively cast.

If the desired type is neither a float nor an int, it will raise a ValueException.

Differential Revision: D64138450
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D64138450

JasonKChow added a commit to JasonKChow/aepsych that referenced this pull request Oct 18, 2024
Summary:

Nested arrays were not directly parseable from the config. E.g., [12, [2, 4], 2, [2.0, 4]] would raise an exception.

If a nested array is detected, it will check whether the desired type is either a float or an int and if so, it'll evaluate the string as a number then recursively cast.

If the desired type is neither a float nor an int, it will raise a ValueException.

Reviewed By: crasanders

Differential Revision: D64138450
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D64138450

Summary:

To support more granular parameter settings in the future, we need to change the config style to be able to separately handle settings for each parameter.

Currently the only setting for each parameter are the lower and upper bounds, but we also implement parameter types here (which currently does nothing).

This is technically not a breaking change. Even though we have changed all documentation to match the new style, it is possible to define parameter bounds the old way. This will throw a warning however as this causes all parameter-specific bounds to be ignored.

Old tests in test_config.py are also modified to match the new style unless specifically testing for these changes. Other tests not in test_config.py are left unchanged (this was the case for the previous major config change where experiment was a section).

Reviewed By: crasanders

Differential Revision: D63679916
Summary:

Nested arrays were not directly parseable from the config. E.g., [12, [2, 4], 2, [2.0, 4]] would raise an exception.

If a nested array is detected, it will check whether the desired type is either a float or an int and if so, it'll evaluate the string as a number then recursively cast.

If the desired type is neither a float nor an int, it will raise a ValueException.

Reviewed By: crasanders

Differential Revision: D64138450
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D64138450

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in a74d426.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants