Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FeatureBasedNB precomputed trained data #60

Open
gradzio opened this issue Jan 31, 2018 · 2 comments
Open

FeatureBasedNB precomputed trained data #60

gradzio opened this issue Jan 31, 2018 · 2 comments

Comments

@gradzio
Copy link

gradzio commented Jan 31, 2018

Hey, the constructor in FeatureBasedNB should allow this:

public function __construct($priors = [], $condprob = [])
{
$this->priors = $priors;
$this->condprob = $condprob;
$this->unknown = [];
}

this way we would be able to cache / store trained properties and then inject them before classifying. Now one has to train the model each time calling the classify or getScore on classifier.

@angeloskath
Copy link
Owner

The concept was to simply serialize and unserialize the model, but you may be right and perhaps it should be added. I 'll look into that when I have some time. For now you can just serialize and unserialize the model so that you don't have to train again.

@gradzio
Copy link
Author

gradzio commented Feb 1, 2018

Hey no problem, i am using it right now in my own project. I will make pull request later today :), serialization does not always work, depending on the caching system used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants