[Zooimage-commits] r209 - pkg/zooimage/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 20 10:33:41 CEST 2012


Author: kevin
Date: 2012-06-20 10:33:41 +0200 (Wed, 20 Jun 2012)
New Revision: 209

Modified:
   pkg/zooimage/R/ZIClass.R
Log:
Modification of ZIClass function to accept algorithms from party package as ctree or cforest

Modified: pkg/zooimage/R/ZIClass.R
===================================================================
--- pkg/zooimage/R/ZIClass.R	2012-06-20 08:28:27 UTC (rev 208)
+++ pkg/zooimage/R/ZIClass.R	2012-06-20 08:33:41 UTC (rev 209)
@@ -60,11 +60,15 @@
 
 	## Possibly make a k-fold cross-validation and check results
 	if (!is.null(k.xval)) {
-		mypredict <- if (algorithm == "lda") {
-			function (object, newdata)
+		# Modification to accept classifier from party package : ctree and cforest
+		if (algorithm == "lda") {
+			mypredict <- function (object, newdata)
 				predict(object, newdata = newdata)$class
-		} else {
-			function (object, newdata)
+		} else if(package == "party"){
+            mypredict <- function(object, newdata)
+                predict(object, newdata = newdata, type = "response", OOB = FALSE)        
+        } else {
+			mypredict <- function (object, newdata)
 				predict(object, newdata = newdata, type = "class")
 		}
     	res <- cv(attr(ZI.class, "classes"), Formula, data = df,



More information about the Zooimage-commits mailing list