statistical-classifier
statistical-classifier copied to clipboard
Append an existing model
Hi,
Can we somehow read an existing model and append to it?
Thanks and Regards, Sonal
If you add a new document to a existing data source, and then set the model to unprepared $model->setPrepared(false);
then when you try to classify something it will regenerate the model. But no there isn't a way to append to an existing model without recomputing.
Hi,
Thanks for the prompt reply. Actually my requirement was to generate model using a document records. and then based on scenario change, append another document records to the same model so i don't have to store all the files used for creating the model.
Any way this can be done with the current version?
Thanks and Regards, Sonal
I don't think that option is available at the moment sorry :(
Hi, One more question related to the above question. Can we use multiple models for classification of a document? Like for loading classifiers: public static function Factory($files){ if(empty($files) || count($files) != 1){ throw new \Exception("No file to load"); } $classifierfile = $files[0]; if(!is_file($classifierfile)){ throw new \Exception("unable to find .model file!"); } $fp = fopen($classifierfile, "r"); $content = fread($fp, filesize($classifierfile)); fclose($fp);
$classifier = unserialize($content);
unlink($classifierfile);
return $classifier;
} Cause the parameter is $files, can i send an array of files and loop through them and read them. In that case ho do i deal with $classifier = unserialize($content);
If this can somehow work, then we dont need to append a model but use multiple models to classify a document.
Many thanks, Sonal