Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

usage

from src.naive_bayes import NaiveBayes, Type

# from scratch usage
nb = NaiveBayes()
nb.mark_message(message="not spam", data_type="ham") # or Type.ham
nb.mark_message(message="spam", data_type="spam") # or Type.spam
nb.predict(message="not spam")

# you can also load your weights
# the example data from the paper this is based on
nb = NaiveBiase()

nb.load(
    {
        "free": {"ham": 100, "spam": 300},
        "viagra": {"ham": 10, "spam": 90},
        "other": {"ham": 290, "spam": 210},
    }
)
nb.predict("free viagra")

# you can also save weights
nb.save()

testing

python -m pytest

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages