[R] Problem with Mclust
Lorenzo Isella
lorenzo.isella at gmail.com
Wed Feb 23 12:34:11 CET 2011
Dear All,
I fear I am badly misunderstanding something fundamental about the
mclust package.
Please considered the dataset pasted at the end of the email (you can
also have a look at
http://dl.dropbox.com/u/5685598/dataedges.csv
).
Now, I would like to use the info on columns 1,2 and 4 to predict the
value in column 3.
However, when I run the script below (obg_mining_script.R), I get errors
and plenty of warnings.
source('obg_mining_script.R')
EEV EEI EEI EEE EEE EII EII EII EII EII EII EII E
3 4 3 3 2 8 5 8 2 9 2 9 2
[1] "OK training"
Error in cdensE(data = data, logarithm = TRUE, parameters = parameters, :
data must be one-dimensional
In addition: There were 42 warnings (use warnings() to see them)
Can anyone tell me what I am doing wrong?
Many thanks
Lorenzo
############################
library(mclust)
rm(list=ls())
#Define the training dataset
sel_col <- c(1,2,4)
sample_percentage <- 0.9
my_data <- read.csv("http://dl.dropbox.com/u/5685598/dataedges.csv",
header=FALSE)
my_data <- as.matrix(my_data)
set.seed(1234)
ms <- sample(seq(sample_percentage*dim(my_data)[1]))
train_set <- my_data[ms, sel_col]
my_labels <- my_data[ms,-sel_col]
train <- mclustDAtrain(train_set, labels = my_labels)
## training step
summary(train)
print("OK training")
test_set <- my_data[-ms, sel_col]
test <- mclustDAtest(test_set, train) ## compute model densities
clTest <- summary(test)$class ## classify training set
err_est <- classError(clTest,my_data[-ms,-sel_col])
More information about the R-help
mailing list