Skip to content

Panics in NaiveBayes #273

@corebreaker

Description

@corebreaker

I'm submitting a

  • bug report.
  • improvement.
  • feature request.

Current Behaviour:

There are unresolved cases of panicking in the function naive_bayes::BaseNaiveBayes::predict by unwraping Option

Expected Behaviour:

These cases can be resolved.

Steps to reproduce:

Introducing NaNs in data

Environment:

Version 0.3.2 of Smartcore

Do you want to work on this issue?

yes

Suggestions

These cases of panic in function naive_bayes::BaseNaiveBayes::predict can be resolved by compromission for tricky values:

  • Nan at line 109:
.max_by(|(_, p1), (_, p2)| p1.partial_cmp(p2).unwrap())
  • Unpredictible cases can return a Failed error instead of unwraping at line 110

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions