[Zooimage-commits] r227 - pkg/mlearning/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Aug 2 10:49:02 CEST 2012


Author: phgrosjean
Date: 2012-08-02 10:49:02 +0200 (Thu, 02 Aug 2012)
New Revision: 227

Modified:
   pkg/mlearning/R/mlearning.R
Log:
Bug correction for some arguments ignored is mlRforest() mlNnet() and mlLvq()

Modified: pkg/mlearning/R/mlearning.R
===================================================================
--- pkg/mlearning/R/mlearning.R	2012-08-01 23:08:53 UTC (rev 226)
+++ pkg/mlearning/R/mlearning.R	2012-08-02 08:49:02 UTC (rev 227)
@@ -530,8 +530,17 @@
 	}
 	
 	## Return a mlearning object
-	structure(randomForest:::randomForest.default(x = train,
-		y = response, ...), formula = .args.$formula, train = train,
+	if (missing(mtry) || !length(mtry)) {
+		res <- randomForest:::randomForest.default(x = train,
+		y = response, ntree = ntree, replace = replace,
+		classwt = classwt, ...)
+	} else {
+		res <- randomForest:::randomForest.default(x = train,
+		y = response, ntree = ntree, mtry = mtry, replace = replace,
+		classwt = classwt, ...)
+	}
+	 
+	structure(res, formula = .args.$formula, train = train,
 		response = response, levels = .args.$levels, n = .args.$n,
 		optim = .args.$optim, numeric.only = FALSE, type = .args.$type,
 		pred.type = c(class = "response", member = "prob", vote ="vote"),
@@ -635,6 +644,10 @@
 		if (rang > 0.7) rang <- 0.7
 	}
 	nnetArgs$rang <- rang
+	
+	## decay and maxit
+	nnetArgs$decay <- decay
+	nnetArgs$maxit <- maxit
 			
 	## TODO: should I need to implement this???
 	#x <- model.matrix(Terms, m, contrasts)
@@ -738,8 +751,6 @@
 	init <- lvqinit(train, response, k = k, size = size, prior = prior)
 	
 	## Calculate final codebook
-	algorithm <- dots$algorithm
-	if (!length(algorithm)) algorithm <- "olvq1" # Default algorithm
 	if (algorithm == "olvq1") times <- 40 else times <- 100
 	niter <- dots$niter
 	if (!length(niter)) niter <- times * nrow(init$x) # Default value



More information about the Zooimage-commits mailing list