Closed isuytto closed 3 years ago
just use the save function like you would save any R object. It will invalidate the pointer to the C++ model but you don't need it any more to use the functions predict/terms/print/loglik on the BTM object if you load it back in with load (like you would do with any R object)
That's good news ! Some more details : my question comes from the fact that when I tried to get the biterms from the reloaded model, I got the "external pointer is not valid" error. With your response I understand that I just have to save the model along with this object. Thanks a lot for your response ! Regards...
That's correct, you need to save the model alongside the biterms which you extracted with biterms = terms(model, type = "biterms") so save(model, biterms, file = "mytopics.RData") and next you can do anything if you reload the data
Closing as you now have an extra argument when training the model detailed. If you set it to TRUE, you'll get the biterms which were used for model training and you can just save the model as is with save(model, file = "mytopics.RData"). If you didn't run it with detailed = TRUE, you still need to extract the biterms with biterms = terms(model, type = "biterms") and save the model with save(model, biterms, file = "mytopics.RData")
Hello jwijffels,
I got interesting results using BTM for finding topics in a corpus of 200k sentences (that are much more meaningful than those generated with LDA for example). But as is takes quite a long time to compute it, I would like to know if there is a way to save/reload the model (it may be more a feature request than an issue btw...)
Many thanks in advance...