I am currently working on a code which clusters attributes from a data set,
then uses a linear regression model to predict NA values in the data set.
The code works for almost all cases, but then errors out on a case that
seems like it should work the same.
This is the line of code that is giving me the problem:
NewClusterData[j,att] <- predict(cl,newdata =
ClusterData[j,],type="class")
Here is the code for the arguments:
algName <- "LinearRegression"
Formula <- as.formula(paste(as.name(att), " ~ ", paste(otherAtts,
collapse"+")))
myAlg <- get(algName)
cl <- myAlg(Formula, data = Data)
And this is the error I'm getting:
Error in .jnew("weka/core/Attribute", attname[i]) :
java.lang.NoSuchMethodError: <init>
Here is the printout of the a working case:
cl = Linear Regression Model
petallength 1.748 * sepallength +
-1.4174 * sepalwidth +
-2.1294
ClusterData[j,] = sepallength sepalwidth petallength petalwidth class
5.7 2.6 NA 1
1
petallength = 4.148813
And the non-working case:
cl = Linear Regression Model
petalwidth 0.8948 * class +
0.3031
ClusterData[j,] = sepallength sepalwidth petallength petalwidth class
4.9 3 1.4 NA
0
Error in .jnew("weka/core/Attribute", attname[i]) :
java.lang.NoSuchMethodError: <init>
Thanks for any help that anyone can provide!
--
View this message in context:
http://old.nabble.com/predict%28%29%3A-NoSuchMethodError-tp26521075p26521075.html
Sent from the R help mailing list archive at Nabble.com.