cnsr.train: cnsr.train

Usage Arguments Author(s) References See Also Examples

View source: R/sentiment.R

Usage

1
cnsr.train(data, control = list(cost = 100, cross = 0, tolerance = 0.001))

Arguments

data

A data.frame,result of cnsr.prepare. It must contain column 'sentiment', This column is the label of context, '0' is negative, '1' is positive.

control

Some parameters of svm.

Author(s)

Shao Dan Lee [aut, cre]

References

URL: https://github.com/leeshuheng/cnSentimentR

See Also

cnsr.predict,cnsr.prepare,cnsr.topic.word,cnsr.keyword

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
devtools::install_github("leeshuheng/cnSentimentR")

train.set <- read.csv("./train_set.csv", header = T, sep = ",", stringsAsFactors = F)
train.set <- train.set[,c("sentiment", "content")]

library(cnSentimentR)

train.set <- cnsr.prepare(train.set)
fit <- cnsr.train(train.set)
# test.set <- read.csv("./test_set.csv", header = T, sep = ",", stringsAsFactors = F)
# test.set <- cnsr.prepare(test.set)
test.set <- train.set[sample(1:nrow(train.set), 100, replace = F),]

test.set <- cnsr.predict(fit, test.set)

cnsr.topic.word(test.set)

cnsr.keyword(test.set)

leeshuheng/cnSentimentR documentation built on May 21, 2019, 3:05 a.m.