cog-imperial / OMLT

Represent trained machine learning models as Pyomo optimization formulations
Other
281 stars 59 forks source link

Replacing assert statements with Exceptions #137

Closed jezsadler closed 11 months ago

jezsadler commented 1 year ago

Replaced assert statements across several files with ValueError or TypeError messages, which should be more informative.

Included unit tests for many of these - some of the error states were difficult to induce.

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 1 year ago

Codecov Report

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

Comparison is base (b9600e2) 95.95% compared to head (4a83a22) 91.89%.

:exclamation: Current head 4a83a22 differs from pull request most recent head 7d660c4. Consider uploading reports for the commit 7d660c4 to get more accurate results

Files Patch % Lines
src/omlt/io/onnx_parser.py 45.94% 20 Missing and 20 partials :warning:
src/omlt/neuralnet/layer.py 60.97% 10 Missing and 6 partials :warning:
src/omlt/gbt/model.py 20.00% 5 Missing and 3 partials :warning:
src/omlt/neuralnet/nn_formulation.py 66.66% 4 Missing and 4 partials :warning:
src/omlt/gbt/gbt_formulation.py 0.00% 3 Missing and 3 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #137 +/- ## ========================================== - Coverage 95.95% 91.89% -4.06% ========================================== Files 29 29 Lines 1656 1752 +96 Branches 255 330 +75 ========================================== + Hits 1589 1610 +21 - Misses 35 76 +41 - Partials 32 66 +34 ```

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