Displaying 10 results from an estimated 10 matches for "testindex".
2012 Dec 02
2
How to re-combine values based on an index?
I am able to split my df into two like so:
dataset <- trainset
index <- 1:nrow(dataset)
testindex <- sample(index, trunc(length(index)*30/100))
trainset <- dataset[-testindex,]
testset <- dataset[testindex,-1]
So I have the index information, how could I re-combine the data using that back into a single df?
I tried what I thought might work, but failed with:
newdataset[testindex] =...
2013 Jan 08
0
bagging SVM Ensemble
...Bogor Agricultural Institute, Indonesia
-------------- next part --------------
#SINGLE SVM
library(colorspace)
library(rpart)
library(e1071)
library(MASS)
dataset <- read.csv("E:/thesis/SVM/hepatitis data csv.csv",header=T,sep=";")
attach(dataset)
index <- 1:nrow(dataset)
testindex <- sample(index, trunc(length(index)*30/100))
testset <- dataset[testindex,]
trainset <- dataset[-testindex,]
trainindex <- sample(index, trunc(length(index)*70/100))
tuned <- tune.svm(class~., data = trainset, gamma = 10^(-6:-1), cost = 10^(-1:1))
cc <- as.numeric(tuned$best.para...
2011 Sep 26
1
SVM accuracy question
...o "stabilize" the performance of my
analysis. To do this I used the "set.seed" function. Is there a better
way to do this? Should I perform a bootstrap on my work-flow (sample and
svm)?
Here is an example of my workflow:
### not to run
index <- 1:nrow(myData)
set.seed(23)
testindex <- sample(index, trunc(length(index)/3))
testset <- myData[testindex, ]
trainset <- myData[-testindex, ]
tune.svm()
svm.model <- svm(Factor ~ ., data = myData, cost = from tune.svm,
gamma = from tune.svm, cross= 10, subset= testset)
summary(svm.model)
predict(svm.mode...
2012 Nov 29
1
Help with this error "kernlab class probability calculations failed; returning NAs"
...Factor w/ 2 levels "0","1": 2 1 2 2 2 2 1
$ age : num 23 5 28 48 82 11 9
$ amount : num 22.2 494.2 2 39.2 39.2 ...
> colSums(is.na(trainset))
outcome age amount
0 0 0
## SAMPLING AND FORMULA
dataset <- trainset
index <- 1:nrow(dataset)
testindex <- sample(index, trunc(length(index)*30/100))
trainset <- dataset[-testindex,]
testset <- dataset[testindex,-1]
## TUNE caret / kernlab
set.seed(1)
MyTrainControl=trainControl(
method = "repeatedcv",
number=10,
repeats=5,
returnResamp = "all",
classProbs = T...
2012 Nov 20
3
data after write() is off by 1 ?
...uot;1","2","3",..: 2 1 2 5 1 1 8 4 6 4 ...
$ pixel0 : int 0 0 0 0 0 0 0 0 0 0 ...
$ pixel1 : int 0 0 0 0 0 0 0 0 0 0 ...
$ pixel2 : int 0 0 0 0 0 0 0 0 0 0 ...
[list output truncated]
# I make a sampling testset and trainset
> index <- 1:nrow(dataset)
> testindex <- sample(index, trunc(length(index)*30/100))
> testset <- dataset[testindex,]
> trainset <- dataset[-testindex,]
# build model, predict, view
> model <- svm(label~., data = trainset, type="C-classification", kernel="radial", gamma=0.0000001, cost=16)
>...
2007 Oct 03
0
datasets
...39;,
'NH4','oPO4','PO4','Chla','a1','a2','a3','a4','a5','a6','a7'),
na.strings=c('XXXXXXX'))
algae <- algae[-c(62,199),]
algae <- algae[,4:12]
index <- 1:nrow(algae)
testindex <- sample(index, trunc(length(index)/3))
testset <- algae[testindex, ]
trainset <- algae[-testindex, ]
svm.model <- svm(a1 ~ ., data = trainset, cost = 100, gamma = 1)
svm.pred <- predict(svm.model, testset[, -9])
matrix.svm <- table(pred = svm.pred, true = testset[, 9])
Ta...
2011 Feb 23
0
svm(e1071) and scaling of weights
I expected, that I will get the same prediction, if I multiply the
weights for all classes with a constant factor, but I got different
results. Please look for the following code.
> library(e1071)
> data(Glass, package = "mlbench")
> index <- 1:nrow(Glass)
> testindex <- sample(index, trunc(length(index)/5))
> testset <- Glass[testindex, ]
> trainset <- Glass[-testindex, ]
> datatrain <- subset(trainset,select=-Type)
> classestrain <- subset(trainset,select=Type)
> Wts <- 1.0/table(Glass$Type);
> model <-
svm(datatrain,c...
2011 Oct 19
0
R classification
...ov)
data(fish)
library(e1071)
names(fish)
[1] "Weight" "Length1" "Length2" "Length3" "Height" "Width" "Species"
model <- svm(Species~., data=fish,type="C")
print(model)
summary(model)
index <- 1:nrow(fish)
testindex <- sample(index, trunc(length(index)*30/100))
testset <- fish[testindex,]
trainset <- fish[-testindex,]
model <- svm(Species~., data = trainset)
prediction <- predict(model, testset[,-7])
tab <- table(pred = prediction, true = testset[,7])
Error in table(pred = prediction,...
2009 Mar 27
1
ROCR package finding maximum accuracy and optimal cutoff point
If we use the ROCR package to find the accuracy of a classifier
pred <- prediction(svm.pred, testset[,2])
perf.acc <- performance(pred,"acc")
Do we?find the maximum accuracy?as follows?(is there a simplier way?):
> max(perf.acc at x.values[[1]])
Then to find the cutoff point that maximizes the accuracy?do we do the
following?(is there a simpler way):
> cutoff.list <-
2012 Nov 21
1
about index speed of xapian
...s two field like 13445511 | 111115151. the recored size is 10000000. the XAPIAN_FLUSH_THRESHOLD set 1000000. it takes 1026544ms to index the file, it is more slower than lucene. The lucene speed is about 40000 records per second.
code:
try
{
Xapian::WritableDatabase database("testindex", Xapian::DB_CREATE_OR_OPEN);
mybase::Timeval now;
std::string line;
while (getline(fin, line))
{
int pos = line.find('|');
if (pos != std::string::npos)
{
std::string imsi = line.substr(0, pos);...