[R] datasets
Luís Paulo F. Garcia
lpfgarcia at gmail.com
Wed Oct 3 22:19:17 CEST 2007
Hi, my name is Luis, and I have a problem with a dataset.
Its name is algae and count the collection of data in a lake and respective
proliferation of algae.
The parameters that it has are: "mxPH", "mnO2", "Cl", "NO3" "NH4", "oPO4",
"PO4", "Chla" and "a1" all numerics.
a1 - algae1
If I try to do SVM with him, it doesn't generate a square matrix, why?
If I try to do same thing in another dataset as Glass of the package
"mlbench"
with the data(Glass) that has the parameters:
"RI", "Na", "Mg", "Al", "Si", "K", "Ca" , "Ba", "Fe" e "Type" , I get to
generate a square matrix! why?
My code is:
library(rpart)
algae <- read.table('Analysis.txt',
header=F,
dec='.',
col.names=c('season','size','speed','mxPH','mnO2','Cl','NO3',
'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])
Tanks!!!!
-------------- Próxima Parte ----------
Um texto embutido e sem conjunto de caracteres especificado associado...
Nome: Analysis.txt
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20071003/541229c2/attachment.txt
More information about the R-help
mailing list