-
Notifications
You must be signed in to change notification settings - Fork 276
Implement linear tree surrogate #1657
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
base: main
Are you sure you want to change the base?
Conversation
…Base Surrogate parent class to be more general. Created tests for linear trees. All tests passing
…bammari/idaes-pse into implement-linear-tree-surrogate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look reasonable to me, just a couple of very minor "missing periods" in docstrings but feel free to ignore. I will update the branch and approve the workflow.
This constructor should only be used when first creating the surrogate within IDAES. | ||
Once created, this object can be stored to disk using save_to_folder and loaded | ||
with load_from_folder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with load_from_folder | |
with load_from_folder. |
Args: | ||
lt_model: Linear-tree model | ||
This is the Linear-tree model that will be loaded. | ||
input_labels: list of str | ||
The ordered list of labels corresponding to the inputs in the linear-tree model | ||
output_labels: list of str | ||
The ordered list of labels corresponding to the outputs in the linear-tree model | ||
input_bounds: None of dict of tuples | ||
Keys correspond to each of the input labels and values are the tuples of | ||
bounds (lb, ub) | ||
input_scaler: None or OffsetScaler | ||
The scaler to be used for the inputs. If None, then no scaler is used | ||
output_scaler: None of OffsetScaler | ||
The scaler to be used for the outputs. If None, then no scaler is used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Args: | |
lt_model: Linear-tree model | |
This is the Linear-tree model that will be loaded. | |
input_labels: list of str | |
The ordered list of labels corresponding to the inputs in the linear-tree model | |
output_labels: list of str | |
The ordered list of labels corresponding to the outputs in the linear-tree model | |
input_bounds: None of dict of tuples | |
Keys correspond to each of the input labels and values are the tuples of | |
bounds (lb, ub) | |
input_scaler: None or OffsetScaler | |
The scaler to be used for the inputs. If None, then no scaler is used | |
output_scaler: None of OffsetScaler | |
The scaler to be used for the outputs. If None, then no scaler is used | |
Args: | |
lt_model: Linear-tree model | |
This is the Linear-tree model that will be loaded. | |
input_labels: list of str | |
The ordered list of labels corresponding to the inputs in the linear-tree model. | |
output_labels: list of str | |
The ordered list of labels corresponding to the outputs in the linear-tree model. | |
input_bounds: None of dict of tuples | |
Keys correspond to each of the input labels and values are the tuples of | |
bounds (lb, ub). | |
input_scaler: None or OffsetScaler | |
The scaler to be used for the inputs. If None, then no scaler is used. | |
output_scaler: None of OffsetScaler | |
The scaler to be used for the outputs. If None, then no scaler is used. |
@bammari can you please look into the pylint issue? See below:
|
Change to most recent version of omlt==1.2.2 to allow for linear-tree capabilities.
@bpaul4 Thanks for pointing this out. It looks like Github CI installs omlt v1.1 in the idaes-pse-dev conda environment when we run actions. Linear tree capabilities were introduced in omlt v1.2. We have specified omlt==1.1 in setup.py. The most recent version is omlt==1.2.2. I believe changing this should resolve this issue. I have included a new commit that tests this. |
Add linear-tree as extra dependency. Co-authored-by: Brandon Paul <[email protected]>
Change to linear-tree
Fix scikit-learn==1.6.1.
Fixes
We generalize the OMLTSurrogate base class to include models other than Keras models. We refactor these changes across the KerasSurrogate class as well. We do this because future interfaces to OMLT models may inherity from the OMLTSurrogate base class without being specific to Keras. These are mostly semantic changes.
Summary/Motivation:
We add an interface to the OMLT linear-tree capabilities to allow users to implement Linear Model Decision Trees as surrogates within their IDAES models.
Changes proposed in this PR:
Legal Acknowledgement
By contributing to this software project, I agree to the following terms and conditions for my contribution: