jbrukh / bayesian

Naive Bayesian Classification for Golang.
Other
805 stars 128 forks source link

Allow classifier to initialise with only one class #21

Open SanketSKasar opened 7 years ago

SanketSKasar commented 7 years ago

Current code panics in case the classifier is initialised with just 1 class. However I have an edge case where there might only be a single class. So I was thinking maybe classifier could be allowed to initialise with just 1 class. I made changes in the code and tested for my use case. It worked. However, the unit tests fail in this case. Is there any specific reason to keep this limitation? What would be a good way to solve this, if any?

tonyStreet commented 7 years ago

@SanketSKasar I think the reason for that limitation (initialization of NewClassifier should have 2 or more classes) is because currently there is no support for adding new class to an existing classifier. If you only have 1 class in a classifier whenever you ask him to identify on which class your query will fall, it will always give you the same class whatever your query is. Your thoughts?