smartcorelib / smartcore

A comprehensive library for machine learning and numerical computing. The library provides a set of tools for linear algebra, numerical computing, optimization, and enables a generic, powerful yet still efficient approach to machine learning.
https://smartcorelib.org/
Apache License 2.0
698 stars 75 forks source link

In Naive Bayes, avoid using `Option::unwrap` and so avoid panicking from NaN values #274

Closed corebreaker closed 8 months ago

corebreaker commented 9 months ago

Fixes #273

Checklist

Current behaviour

Panics in function naive_bayes::BaseNaiveBayes::predict

New expected behaviour

No panics with NaNs

codecov-commenter commented 9 months ago

Codecov Report

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

Comparison is base (9c07925) 45.04% compared to head (00fb486) 44.95%.

Files Patch % Lines
src/naive_bayes/mod.rs 35.71% 9 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## development #274 +/- ## =============================================== - Coverage 45.04% 44.95% -0.10% =============================================== Files 85 85 Lines 7206 7214 +8 =============================================== - Hits 3246 3243 -3 - Misses 3960 3971 +11 ```

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

morenol commented 9 months ago

Thanks @corebreaker, can you add an unit test for that?

corebreaker commented 9 months ago

Sure, @morenol, i'll add an unit test.

corebreaker commented 8 months ago

@morenol , unit tests were added.

corebreaker commented 8 months ago

Sorry i forgot, review process.