[R] Help with Caret
Lisa Gandy
lisagandy07 at gmail.com
Fri Jan 9 18:11:27 CET 2015
*My code is below:*
library('RMySQL')
library('DMwR')
library('tm')
library('Snowball')
library('SnowballC')
con <- dbConnect(MySQL(), user="root", password="stuff0645",
dbname="TwitterCelebs", host="localhost")
rt_outlier <- dbGetQuery(con, "SELECT *,tweet_text from
outlier_info,tweets where outlier_info.tweet_id=tweets.tweet_id limit
500")
rt_not_outlier <- dbGetQuery(con,"Select *, tweet_text from
not_outlier_info,tweets where
not_outlier_info.tweet_id=tweets.tweet_id limit 500");
dbDisconnect(con)
all_tweets = rbind(rt_outlier,rt_not_outlier)
all_tweets[,"tweet_text"] <- iconv(all_tweets[,"tweet_text"], to = "utf-8")
corpus = Corpus(VectorSource(all_tweets[,"tweet_text"]))
corpus = tm_map(corpus,removePunctuation)
corpus <- tm_map(corpus, tolower)
corpus <- tm_map(corpus, stemDocument)
corpus <- tm_map(corpus,removeWords,stopwords("english"))
corpus <- tm_map(corpus,stripWhitespace)
corpus <- tm_map(corpus,removeNumbers)
mydata.dtm <- TermDocumentMatrix(corpus,control=list(weighting=weightTfIdf,
minWordLength=2, findFreqTerms=5))
dataframe <- as.data.frame(inspect(mydata.dtm))
d=as.data.frame(t(dataframe))
classData = c(rep(0,500),rep(1,500))
classData = as.factor(classData)
library('caret')
ctrl = trainControl(method = "repeatedcv", repeats = 3,)
set.seed(2)
mymodel <- train(d, classData,trControl=ctrl,method="J48",model=FALSE)
Basically, what is happening here is that I keep getting the error and
warnings:
Error in train.default(d, classData, method = "J48", model = FALSE) :
final tuning parameters could not be determined
In addition: Warning messages:1: In train.default(d, classData, method
= "J48", model = FALSE) :
Models using Weka will not work with parallel processing with
multicore/doMC2: In nominalTrainWorkflow(x = x, y = y, wts = weights,
info = trainInfo, :
There were missing values in resampled performance measures.3: In
train.default(d, classData, method = "J48", model = FALSE) :
missing values found in aggregated results
What am I doing wrong? Also note I'm using model=FALSE in training to
conserve memory, as this has been a problem
--
Lisa Gandy, PhD
Assistant Professor
Central Michigan University
Computer Science Dept
Pearce 119
989-774-3696
gandy1l at cmich.edu
https://intlab.cps.cmich.edu/lgandy/
[[alternative HTML version deleted]]
More information about the R-help
mailing list