cog-imperial / OMLT

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

[WIP] Allow for linear tree classifiers #135

Open bammari opened 8 months ago

bammari commented 8 months ago

This PR will allow users to utilize linear tree classifiers from the linear-tree Python library.

UPDATE: 10/31 Currently support binary classification. The OMLT model output is a number <= 0 (which corresponds to class 0) or a number >0 (which corresponds to class 1). Users can handle these outputs with additional Big-M constraints to transform the output to 0 and 1.

In Progress:

  1. Provide an option to generate these Big-M constraints for the user.
  2. Testing, documentation, and examples
  3. Multiclass models

Legal Acknowledgement\ By contributing to this software project, I agree my contributions are submitted under the BSD license. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

codecov[bot] commented 8 months ago

Codecov Report

Attention: 19 lines in your changes are missing coverage. Please review.

Comparison is base (b9600e2) 95.95% compared to head (f2cd74c) 94.87%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #135 +/- ## ========================================== - Coverage 95.95% 94.87% -1.08% ========================================== Files 29 29 Lines 1656 1678 +22 Branches 255 262 +7 ========================================== + Hits 1589 1592 +3 - Misses 35 51 +16 - Partials 32 35 +3 ``` | [Files](https://app.codecov.io/gh/cog-imperial/OMLT/pull/135?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cog-imperial) | Coverage Δ | | |---|---|---| | [src/omlt/linear\_tree/lt\_definition.py](https://app.codecov.io/gh/cog-imperial/OMLT/pull/135?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cog-imperial#diff-c3JjL29tbHQvbGluZWFyX3RyZWUvbHRfZGVmaW5pdGlvbi5weQ==) | `88.00% <24.00%> (-10.70%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.