R-code 'Fitting a simple detection function model with ds' - r

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:

Related

pyLDAvis.prepare function term_frequency calculation

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

All estimators should implement fit and transform, or can be 'drop' or 'passthrough' specifiers

I am try to make a pipeline but I have got a error with TargetTransformRegressor.
numerical_features=make_column_selector(dtype_include=np.number)
categorical_features=make_column_selector(dtype_exclude=np.number)
numerical_pipeline=make_pipeline(TransformedTargetRegressor(regressor=LinearRegression(),
transformer=PowerTransformer(standardize=True)))
categorical_pipeline=make_pipeline(OneHotEncoder())
preprocessor=make_column_transformer((numerical_pipeline,numerical_features),
(categorical_pipeline,categorical_features))
model=make_pipeline(preprocessor,xgb.XGBRegressor(objective='reg:squarederror'))
model.fit(X,y)
And I have this error :
TypeError: All estimators should implement fit and transform, or can be 'drop' or 'passthrough' specifiers. 'TransformedTargetRegressor(regressor=LinearRegression(),
transformer=PowerTransformer())' (type <class 'sklearn.compose._target.TransformedTargetRegressor'>) doesn't.
Thank you for helping

Error while using write_xes function : Error in defaultvalues[[datatype]] : invalid subscript type 'list'

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")

H2o with predict_json: "Error: Could not find or load main class water.util.H2OPredictor"?

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

selction on xdf error

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))

Resources