cog-imperial / OMLT

Represent trained machine learning models as Pyomo optimization formulations
Other
257 stars 56 forks source link

Input bounds documentation #69

Closed rmisener closed 1 year ago

rmisener commented 2 years ago

@fracek, we need documentation on write_input_bounds and load_input_bounds (both in https://github.com/cog-imperial/OMLT/blob/main/src/omlt/io/input_bounds.py).

I need to clarify. Does the following make sense and (if it doesn't) would you please suggest an alternative?

For write_input_bounds:

""" Write the specified input bounds to the given file. This input implicitly assumes that all inputs are defined (no indices missing) and all indices are bounded. """

` """

Parameters
----------
input_bounds_filename: file
input_bounds: dict or list
"""`

For load_input_bounds:

""" Read the input bounds from the given file. """

` """

Parameters
----------
input_bounds_filename: file
The file should be a list of tuples with a key (index of the input), lower bound (real number), and upper bound (real number).
"""`
fracek commented 2 years ago

The description for write_input_bounds looks good.

I would change the description of load_input_bounds to:

Read the input bounds from the given file. 

The input bounds file should be generated by `write_input_bounds`.

Parameters
----------
input_bounds_filename: file
    The file should contain a JSON-encoded list of objects with properties "key" (the input index),
   "lower_bound" (a number), and "upper_bound" (a number).