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

Append an existing model #25

Open
sonalmahajan01 opened this issue Jul 26, 2016 · 4 comments
Open

Append an existing model #25

sonalmahajan01 opened this issue Jul 26, 2016 · 4 comments

Comments

@sonalmahajan01
Copy link

Hi,

Can we somehow read an existing model and append to it?

Thanks and Regards,
Sonal

@camspiers
Copy link
Owner

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.

@sonalmahajan01
Copy link
Author

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

@camspiers
Copy link
Owner

I don't think that option is available at the moment sorry :(

@sonalmahajan01
Copy link
Author

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

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

No branches or pull requests

2 participants