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

ParameterSpace class #5

Merged
merged 1 commit into from
Jul 18, 2024
Merged

ParameterSpace class #5

merged 1 commit into from
Jul 18, 2024

Conversation

dreamer2368
Copy link
Collaborator

@dreamer2368 dreamer2368 commented Jul 11, 2024

ParameterSpace class is factored out as a new object, supporting multi-dimensional parameter space.

Initialization

ParameterSpace is initiated with a dict-type variable config, which specifies parameters:

param_space = ParameterSpace(config)

Specifying parameters

With yaml format, a typical config (for the examples of burgers1d) looks like:

parameter_space:
  parameters:
    - name: a
      min: 0.7
      max: 0.9
      test_space_type: uniform
      sample_size: 21
      log_scale: false
    - name: w
      min: 0.9
      max: 1.1
      # another way of specifying test space.
      test_space_type: list
      list: [0.9, 0.91, 0.92, 0.93, 0.94,
             0.95, 0.96, 0.97, 0.98, 0.99,
             1.0, 1.01, 1.02, 1.03, 1.04,
             1.05, 1.06, 1.07, 1.08, 1.09, 1.1]
  test_space:
    type: grid

parameters category provides a list of parameters we'd want to perform parametric sampling:

  • name specifies the name of the parameter, so that a Physics solver can read it.
  • min and max value specify the range of the parameter
  • test_space_type: if the test space if specified, then create 1d parameter space based on this type specification.
    • uniform: uniform grid space between min and max with sample_size points.
    • list: uses the specified list of parameter values.

test_space specifies whether or not to use FOM solutions on parameter space for test, and what type of test space we'd use. Currently it only supports grid type. Will have to support PR #3 .

grid-type space

By default, ParameterSpace creates the initial training samples and a test space as multi-dimensional grids. The dimension of parameter space is determined by the number of parameters specified in the input config.

passing parameters to Physics

ParameterSpace.getParameter function converts a numpy 1d array of parameter into a dict, so that Physics class can use parameters according to their names. Physics class can use default parameter values if not all parameter values are provided.

Copy link
Collaborator

@chldkdtn chldkdtn left a comment

Choose a reason for hiding this comment

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

Looks great!

Copy link
Collaborator

@andersonw1 andersonw1 left a comment

Choose a reason for hiding this comment

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

Looks good! As you mentioned, in the future I think it would be helpful to add what I did in PR #3 where we provide the outline of the parameter space and put a grid over the convex hull.

@dreamer2368 dreamer2368 merged commit 256d1e3 into main Jul 18, 2024
@dreamer2368 dreamer2368 deleted the param branch October 23, 2024 21:33
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.

3 participants