[R] Error in Rose Method (class balancing)
Jeff Newmiller
jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Thu Jul 23 22:10:59 CEST 2020
The R Administration and Installation manual explains this nomenclature. OP _is_ typically using two libraries... the one installed with R and the "personal" library which contains the packages installed by the user. You retrieve packages from libraries using library(somepackage)
Of more relevance here is the fact that OP has yet again failed to read the Posting Guide, and appears to have attempted to send a disallowed attachment type through the mailing list and it has been removed from the message. Ordinarily I would recommend trying to use dput() to remove the need for the file, but in this case it may be best for the OP to send a link to the file stored on a file sharing website.
In any event, making the example reproducible is the responsibility of the p person asking the question. I highly recommend reading [1][2] and using [3] to verify that the plain text example actually runs up to the point where the error occurs.
[1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
[2] http://adv-r.had.co.nz/Reproducibility.html
[3] https://cran.r-project.org/web/packages/reprex/index.html (read the vignette)
On July 23, 2020 10:42:55 AM PDT, Bert Gunter <bgunter.4567 using gmail.com> wrote:
>Actually, you are using no libraries. You are using R *packages* .
>
>Don't ask me why the call is library() and not package() -- I'm just
>another worker bee.
>
>Bert Gunter
>
>"The trouble with having an open mind is that people keep coming along
>and
>sticking things into it."
>-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
>On Thu, Jul 23, 2020 at 9:35 AM Neha gupta <neha.bologna90 using gmail.com>
>wrote:
>
>> Hello David, file not found should be the path problem I guess. I
>just
>> forgot the pROC library, which I included here. These are all the
>libraries
>> I am using.
>>
>> library(caret)
>> library(farff)
>> library(DMwR)
>> library(pROC)
>> library(pls)
>>
>> setwd("C:/Users/PC/Documents")
>> d=readARFF("bughunter.arff")
>> dput( head( d, 30 ) )
>>
>> index <- createDataPartition(d$`Bug class`, p = .70,list = FALSE)
>>
>> tr <- d[index, ]
>>
>> ts <- d[-index, ]
>>
>> boot3 <- trainControl(method = "repeatedcv", number=10,
>> repeats=10,classProbs = TRUE,verboseIter = FALSE,
>>
>> summaryFunction = twoClassSummary, sampling = "rose")
>>
>> set.seed(30218)
>>
>> ct <- train(`Bug class` ~ ., data = tr, method = "pls", metric =
>"AUC",
>> preProc
>> = c("center", "scale", "nzv"), trControl = boot3)
>>
>> getTrainPerf(ct)
>>
>>
>> <
>>
>https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon
>> >
>> Virus-free.
>> www.avast.com
>> <
>>
>https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link
>> >
>> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>> On Thu, Jul 23, 2020 at 4:01 PM Neha gupta <neha.bologna90 using gmail.com>
>> wrote:
>>
>> >
>> > Hello David, thanks for your reply. I have added the information.
>> >
>> > library(caret)
>> > library(farff)
>> > library(DMwR)
>> >
>> > d=readARFF("bughunter.arff")
>> > dput( head( d, 30 ) )
>> >
>> > index <- createDataPartition(d$`Bug class`, p = .70,list = FALSE)
>> >
>> > tr <- d[index, ]
>> >
>> > ts <- d[-index, ]
>> >
>> > boot3 <- trainControl(method = "repeatedcv", number=10,
>> > repeats=10,classProbs = TRUE,verboseIter = FALSE,
>> >
>> > summaryFunction = twoClassSummary, sampling = "rose")
>> >
>> > set.seed(30218)
>> >
>> > ct <- train(`Bug class` ~ ., data = tr, method = "pls", metric =
>"AUC",
>> preProc
>> > = c("center", "scale", "nzv"), trControl = boot3)
>> >
>> > getTrainPerf(ct)
>> >
>> > On Thu, Jul 23, 2020 at 1:08 AM David Winsemius
><dwinsemius using comcast.net>
>> > wrote:
>> >
>> >>
>> >> On 7/22/20 3:43 PM, Neha gupta wrote:
>> >> > Hello,
>> >> >
>> >> >
>> >> > I get the following error when I use the ROSE class balancing
>method
>> but
>> >> > when I use other methods like SMOTE, up, down, I do not get any
>error
>> >> > message.
>> >> >
>> >> >
>> >> > Something is wrong; all the ROC metric values are missing:
>> >> >
>> >> > ROC Sens Spec
>> >> >
>> >> > Min. : NA Min. : NA Min. : NA
>> >> >
>> >> > 1st Qu.: NA 1st Qu.: NA 1st Qu.: NA
>> >> >
>> >> > Median : NA Median : NA Median : NA
>> >> >
>> >> > Mean :NaN Mean :NaN Mean :NaN
>> >> >
>> >> > 3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA
>> >> >
>> >> > Max. : NA Max. : NA Max. : NA
>> >> >
>> >> >
>> >> >
>> >> > library(DMwR)
>> >> >
>> >> > d=readARFF("bughunter.arff")
>> >>
>> >> After installing that package and loading pkg:DMwR I get:
>> >>
>> >>
>> >> Error in readARFF("bughunter.arff") : could not find function
>"readARFF"
>> >>
>> >>
>> >> Since you also posted in HTML, I suggest you read the Posting
>Guide,
>> >> restart and R session and post a reproducible example that loads
>all
>> >> needed packages and data.
>> >>
>> >> --
>> >>
>> >> David.
>> >>
>> >> >
>> >> > index <- createDataPartition(d$`Bug class`, p = .70,list =
>FALSE)
>> >> >
>> >> > tr <- d[index, ]
>> >> >
>> >> > ts <- d[-index, ]
>> >> >
>> >> > boot3 <- trainControl(method = "repeatedcv", number=10,
>> >> > repeats=10,classProbs = TRUE,verboseIter = FALSE,
>> >> >
>> >> > summaryFunction = twoClassSummary, sampling = "rose")
>> >> >
>> >> > set.seed(30218)
>> >> >
>> >> > ct <- train(`Bug class` ~ ., data = tr,
>> >> >
>> >> > method = "pls",
>> >> >
>> >> > metric = "AUC",
>> >> >
>> >> > preProc = c("center", "scale", "nzv"),
>> >> >
>> >> > trControl = boot3)
>> >> >
>> >> > getTrainPerf(ct)
>> >> >
>> >> > [[alternative HTML version deleted]]
>> >> >
>> >> > ______________________________________________
>> >> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more,
>see
>> >> > https://stat.ethz.ch/mailman/listinfo/r-help
>> >> > PLEASE do read the posting guide
>> >> http://www.R-project.org/posting-guide.html
>> >> > and provide commented, minimal, self-contained, reproducible
>code.
>> >>
>> >
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.
--
Sent from my phone. Please excuse my brevity.
More information about the R-help
mailing list