Error while using xgb.cv - r

I am trying to use XGBoost to enhance the Accuracy of my model. While I am new to xgboost, I have been trying to understand this algorithm through various sources. I have set the param list with the following code:
param = list("objective"="binary:logistic", "eval_metric"="logloss", "eta"=1, "max.depth"=2)
and then used:
xg.cv = xgb.cv(params=param, data=as.matrix(train), label=train$StatusDesc,
nthread=2, nrounds=2, nfold=5)
When I run this, I get the below error:
Error in xgb.DMatrix(data, label = label, missing = missing) :
[19:55:03] amalgamation/../dmlc-core/src/io/local_filesys.cc:66:
LocalFileSystem.GetPathInfo 20160906 Error:No such file or directory.
Can someone help me with this error?

Try it. This solved some of my problems.
install.packages("drat", repos="https://cran.rstudio.com")
drat:::addRepo("dmlc")
install.packages("xgboost", repos="http://dmlc.ml/drat/",type="source")

Related

Errors running Oolong validation in R on both STM and seededLDA

I'm trying to run the oolong package to validate a couple of topic models I've created. Using both an STM model and a seededLDA model (this code won't be reproducible)
oolong_test1a <- witi(input_model = model_stm_byt, input_corpus = YS$body)
OR
oolong_test1a <- witi(input_model = slda_howard_docs, input_corpus = howard_df$content)
In both cases it successfully creates an oolong test in my global environment. However, when I run either the word intrusion or topic intrusion test, I get this error in both my console and my viewer:
Listening on http://127.0.0.1:7122
Warning: Error in value[[3L]]: Couldn't normalize path in `addResourcePath`, with arguments: `prefix` = 'miniUI-0.1.1.1'; `directoryPath` = 'D:/temp/RtmpAh8J5r/RLIBS_35b54642a1c09/miniUI/www'
[No stack trace available]
I couldn't find any reference to this error anywhere else. I've checked I'm running the most recent version of oolong.
I've also tried to run it on the models/corpus that comes supplied with oolong. So this code is reproducible:
oolong_test <- witi(input_model = abstracts_keyatm, input_corpus = abstracts$text, userid = "Julia")
oolong_test$do_word_intrusion_test()
oolong_test$do_topic_intrusion_test()
This generates the same errors.
There is a new version in github that fixes this issue.
devtools::install_github("chainsawriot/oolong")

How to fix 'could not find function mvOutlier' in R

I am trying to remove outliers from my dataset using the mvOutliers function in MVN in R. However, upon executing the program, I get the error, could not find function "mvOutlier".
I have installed all the packages from MVN to mvoutlier. I have also imported MVN but also tried importing mvoutlier but still I am getting the same error.
I am using the following code for outlier removal
library(MVN)
M <- mvOutlier(data, method = "quan", label = TRUE)
Comb_Data=M$newData
I expect the Comb_Data to contain the outlier free dataset but all I am getting is the error:
Error in mvOutlier(dat, method = "quan", label = TRUE) : could not
find function "mvOutlier"
Any help in this matter would be appreciated.

MXNet Time-series Example - Dropout Error when running locally

I am looking into using MXNet LSTM modelling for time-series analysis for a problem i am currently working on.
As a way of understanding how to implement this, I am following the example code given by xnNet from the link: https://mxnet.incubator.apache.org/tutorials/r/MultidimLstm.html
When running this script after downloading the necessary data to my local source, i am able to execute the code fine until i get to the following section to train the model:
## train the network
system.time(model <- mx.model.buckets(symbol = symbol,
train.data = train.data,
eval.data = eval.data,
num.round = 100,
ctx = ctx,
verbose = TRUE,
metric = mx.metric.mse.seq,
initializer = initializer,
optimizer = optimizer,
batch.end.callback = NULL,
epoch.end.callback = epoch.end.callback))
When running this section, the following error occurs once gaining connection to the API.
Error in mx.nd.internal.as.array(nd) :
[14:22:53] c:\jenkins\workspace\mxnet\mxnet\src\operator\./rnn-inl.h:359:
Check failed: param_.p == 0 (0.2 vs. 0) Dropout is not supported at the moment.
Is there currently a problem internally within the XNNet R package which is unable to run this code? I can't imagine they would provide a tutorial example for the package that is not executable.
My other thought is that it is something to do with my local device execution and connection to the API. I haven't been able to find any information about this being a problem for other users though.
Any inputs or suggestions would be greatly appreciated thanks.
Looks like you're running an old version of R package. I think following instructions on this page to build a recent R-package should resolve this issue.

fpgrowth error in R

I am trying to fit a fpgrowth model on a in-built data set called Adult. While fitting a model, I was getting an error as shown below.
Error in .jcall(jPruning, "[[Ljava/lang/String;", "fpgrowth", support, :
method fpgrowth with signature (DDI)[[Ljava/lang/String; not found
I used the below R code to fit fpgrowth model.
library(rCBA)
data("Adult")
Adult<-as(Adult,"transactions")
rules = rCBA::fpgrowth(Adult, support=0.001, confidence=0.5, maxLength=2)
What's wrong with the above code?
Thanks in advance.
you must specify your "class" or consequent
rules = rCBA::fpgrowth(Adult, support=0.001, confidence=0.5, maxLength=2, consequent="Species")
Try with This:
https://rdrr.io/cran/rCBA/src/R/fpgrowth.R

error loading NER .bin file as model argument for openNLP::Maxent_Entity_Annotator()

I created a model using Apache OpenNLP's command line tool to recognize named entities. The below code created the model using the file sentences4OpenNLP.txt as a training set.
opennlp TokenNameFinderTrainer -type maxent -model C:\Users\Documents\en-ner-org.bin -lang en -data C:\Users\Documents\apache-opennlp-1.6.0\sentences4OpenNLP.txt -encoding UTF-8
I tested the model from the command line by passing it sentences to tag, and the model seemed to be working well. However, I am unable to successfully use the model from R. I am using the below lines in attempts to create an organization annotating function. Using the same code to load a model downloaded from OpenNLP works fine.
modelNER <- "C:/Users/Documents/en-ner-org.bin"
oa <- openNLP::Maxent_Entity_Annotator(language = "en",
kind = "organization",
probs = TRUE,
model = modelNER)
When the above code is run I get an error saying:
Could not instantiate the opennlp.tools.namefind.TokenNameFinderFactory. The initialization throw an exception.
opennlp.tools.util.ext.ExtensionNotLoadedException: Unable to find implementation for opennlp.tools.util.BaseToolFactory, the class or service opennlp.tools.namefind.TokenNameFinderFactory could not be located!
at opennlp.tools.util.ext.ExtensionLoader.instantiateExtension(ExtensionLoader.java:97)
at opennlp.tools.util.BaseToolFactory.create(BaseToolFactory.java:106)
at opennlp.tools.util.model.BaseModel.initializeFactory(BaseModel.java:254)
Error in .jnew("opennlp.tools.namefind.TokenNameFinderModel", .jcast(.jnew("java.io.FileInputStream", :
java.lang.IllegalArgumentException: opennlp.tools.util.InvalidFormatException: Could not instantiate the opennlp.tools.namefind.TokenNameFinderFactory. The initialization throw an exception.
at opennlp.tools.util.model.BaseModel.loadModel(BaseModel.java:237)
at opennlp.tools.util.model.BaseModel.<init>(BaseModel.java:181)
at opennlp.tools.namefind.TokenNameFinderModel.<init>(TokenNameFinderModel.java:110)
Any advice on how to fix the error would be a big help. Thanks in advance.
Resolved the error. The R function openNLP::Maxent_Entity_Annotator was not compatible with the named entity recognition (NER) model being produced by OpenNLP 1.6.0. Building the NER model using OpenNLP 1.5.3 resulted in openNLP::Maxent_Entity_Annotator running without error.

Resources