I am trying to visualize LDA model with pyLDAvis.
This was working for me:
pyLDAvis.gensim.prepare(lda_model, corpus, id2word)
but now it is throwing an error:
AttributeError: module 'pyLDAvis' has no attribute 'gensim'
I tried this:
pyLDAvis.prepare(lda_model, corpus, id2word)
but it is throwing error:
TypeError: prepare() missing 2 required positional arguments: 'vocab' and 'term_frequency'
Then I tried this:
pyLDAvis.prepare(lda_model, corpus, id2word, vocab=list_lemmatized) # list_lemmatized is my list of vocab
but it is throwing error:
TypeError: prepare() missing 1 required positional argument: 'term_frequency'
So, how to calculate "term_frequency"?
Thank you very much
Related
When I use;
wren.hn <- ds(data=wren_lt, key="hn", adjustment=NULL, convert.u=conversion.factor)
I get the error message:
Error in .deprecated_args(c("dht.group", "region.table", "sample.table", :
Argument: convert.units is deprecated, check documentation.
I'll attach a photo:
I want to export an eventlog object built in R using bupaR package function - eventlog as an xes file. For that I am using function write_xes() of package xesreadR. But the function is giving out error :
Error in defaultvalues[[datatype]] : invalid subscript type 'list'
>class(log)
output:
[1] "eventlog" "tbl_df" "tbl" "data.frame"
write_xes(log,"myxes.xes")
According to the documentation it should save the log to the destined file.But instead it is producing the error :
ERROR : Error in defaultvalues[[datatype]] : invalid subscript type
'list'
I have tried multiple things to troubleshoot this problem but haven't came up with a solution. So can somebody help me to solve this error. Thank You!
Your function is defined as follow:
write_xes ( eventlog, case_attributes = NULL, file = file.choose())
Thus, writing
write_xes(log,"myxes.xes")
means
write_xes(eventlog = log, case_attributes = "myxes.xes").
Instead, you shall write
write_xes(eventlog = log, file = "myxes.xes")
I tried to use the H2o predict_json in R,
h2o.predict_json(modelpath, jsondata)
and got the error message:
Error: Could not find or load main class water.util.H2OPredictor
I am using h2o_3.20.0.8.
I searched the documentation from H2o but didn't help.
> h2o.predict_json(modelpath, jsondata)
$error
[1] "Error: Could not find or load main class water.util.H2OPredictor"
Warning message:
In system2(java, args, stdout = TRUE, stderr = TRUE) :
running command ''java' -Xmx4g -cp .:/Library/Frameworks/R.framework/Versions/3.5/Resources/library/mylib/Models/h2o-genmodel.jar:/Library/Frameworks/R.framework/Versions/3.5/Resources/library/mylib/Models:genmodel.jar:/ water.util.H2OPredictor /Library/Frameworks/R.framework/Versions/3.5/Resources/library/mylib/Models/mymodel.zip '[{"da1":252,"da2":22,"da3":62,"da4":63,"da5":84.83}]' 2>&1' had status 1
It looks like you are missing your h2o-genmodel.jar file - this is what the error message Could not find or load main class water.util.H2OPredictor indicates. You may want to provide all the arguments to checkoff that you have everything:
h2o.predict_json(model, json, genmodelpath, labels, classpath, javaoptions)
documentation here
When I execute:
my_env <- new.env(parent = emptyenv())
test <- purrr::safely(get("meta", envir = my_env))
I get the following error:
Error in get("meta") : object 'meta' not found
The error is correct in the sense of that the meta variable is not defined in the environment but my line of thinking was that safely would return a NULL in that case.
I can get around the error by using checking using exists first but I was curious about why safely fails. Am I wrong in thinking of safely as the equivalent of a try-catch?
You are misinterpreting the actions of the safely function. It was actually succeeding. If you had examined the value of test, you should have seen:
> test
[1] "Error in get(\"meta\", env = my_env) : object 'meta' not found\n"
attr(,"class")
[1] "try-error"
attr(,"condition")
<simpleError in get("meta", env = my_env): object 'meta' not found
To suppress error messages from being visible at the console you can either turn off reporting with options(show.error.messages = FALSE) or you can redirect the destination of stderr().
If I run this code:
myData <- rxDataStep(inData=SensorData, varsToKeep=c("X.U.FEFF.time"),
rowSelection=floor(as.numeric(X.U.FEFF.time)) ==
floor(as.numeric(as.POSIXct("2016-08-29 19:16:10",tz="GMT"))))
It works fine for me.
But if I change my code to:
WarnungZeit <- as.POSIXct("2016-08-29 19:16:10",tz="GMT")
WarnungZeit <- WarnungZeit + Test1[1,]$Diff_Warnung
myData <- rxDataStep(inData=SensorData, varsToKeep=c("X.U.FEFF.time"),
rowSelection=floor(as.numeric(X.U.FEFF.time)) ==
floor(as.numeric(WarnungZeit)))
I get this error:
ERROR: The sample data set for the analysis has no variables.
Caught exception in file: CxAnalysis.cpp, line: 3756. ThreadID: 4872 Rethrowing.
Caught exception in file: CxAnalysis.cpp, line: 5249. ThreadID: 4872 Rethrowing.
Error in doTryCatch(return(expr), name, parentenv, handler) :
ERROR: The sample data set for the analysis has no variables.
Do you know why I get this error and how can I solve it?
The reason is that any objects in your global environment that you reference in a rxDataStep have to be explicitly declared. Microsoft R functions are designed to be usable in a distributed environment, so you can't assume that all processes will be able to access the same global objects.
Declare your WarnungZeit object via the transformObjects argument, like so:
myData <- rxDataStep(inData=SensorData, varsToKeep=c("X.U.FEFF.time"),
rowSelection=floor(as.numeric(X.U.FEFF.time)) == floor(as.numeric(wz)),
transformObjects=list(wz=WarnungZeit))