Closed M1V0 closed 2 years ago
Yes, these coefficients should be the same as the ones dumped at summary(model, "modeldetails.txt"). I only tested this on Windows and an Ubuntu machine. Maybe it is because you put feature.minfreq to something high and there is no data to train or maybe you moved the .crfsuite file containing the model? What does this give you?
model$file_model
file.info(model$file_model)
x <- crfsuite:::crfsuite_model_coefficients(model$file_model)
x
Okay, good to know the dump is the same information. I kept all the rest of the code the same, even copied the Rmd contents for the vignette to be sure.
Output is:
model$file_model [1] "/Users/ivorym/Documents/PhD/#2; ScrapeR/tagger.crfsuite" file.info(model$file_model) size isdir mode mtime /Users/ivorym/Documents/PhD/#2; ScrapeR/tagger.crfsuite 828000 FALSE 644 2022-02-15 12:09:44 ctime atime uid gid /Users/ivorym/Documents/PhD/#2; ScrapeR/tagger.crfsuite 2022-02-15 12:09:44 2022-02-15 12:09:44 501 20 uname grname /Users/ivorym/Documents/PhD/#2; ScrapeR/tagger.crfsuite ivorym staff x <- crfsuite:::crfsuite_model_coefficients(model$file_model) Error: object 'crfsuite_model_coefficients' not found
Thanks
crfsuite_model_coefficients is included in crfsuite version 0.4 https://cran.r-project.org/web/packages/crfsuite/news/news.html if the error says Error: object 'crfsuite_model_coefficients' not found it means you are not running version 0.4 but an older version of crfsuite which does not have this code https://github.com/bnosac/crfsuite/blob/master/R/coef.R which as a result does not extract the coefficients. Please update your crfsuite version.
I am the fool. I installed the latest version of crfsuite when trying this a few hours ago, clearly I forgot to load it too. Forgive me and thank you for your swift assistance.
When going through the vignette example of how to use crfsuite (which is very insightful, so thank you), the
weights <- coefficients(model, encoding = "UTF-8")
command returns NULL.This is the same for "conll2002-nl" and "wikiner-en-wp3". Using coef instead of coefficients doesn't change this.
Are the weights/coefs the same as the state_features downloaded to
summary(model, "modeldetails.txt")
?This is using crfsuite version 0.4 and running on R4.1.0 on Mac Monterey.
Thanks.