[Zooimage-commits] r196 - pkg/zooimage/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jan 20 13:23:20 CET 2011
Author: kevin
Date: 2011-01-20 13:23:19 +0100 (Thu, 20 Jan 2011)
New Revision: 196
Modified:
pkg/zooimage/R/ZIClass.R
pkg/zooimage/R/ZITrain.R
Log:
ZIClass: change in "FormVarsSelect" with preselection of varibales to exclude
ZITrain: change in "get.ZITrain" to avoid memory saturation, subset of ZI.sample one by one
Modified: pkg/zooimage/R/ZIClass.R
===================================================================
--- pkg/zooimage/R/ZIClass.R 2010-09-07 10:15:24 UTC (rev 195)
+++ pkg/zooimage/R/ZIClass.R 2011-01-20 12:23:19 UTC (rev 196)
@@ -233,7 +233,7 @@
# "Range", "MeanPos", "SDNorm", "CV", "logArea", "logPerim.", "logMajor",
# "logMinor", "logFeret"),
# multiple = TRUE, title = "Select variables to keep")
- Notkeep <- select.list(list = mes, preselect = c("Id", "FIT_Cal_Const", "Item", "FIT_Raw_Area", "FIT_Raw_Feret_Max",
+ Notkeep <- select.list(choices = mes, preselect = c("Id", "FIT_Cal_Const", "Item", "FIT_Raw_Area", "FIT_Raw_Feret_Max",
"FIT_Raw_Feret_Min", "FIT_Raw_Feret_Mean", "FIT_Raw_Perim", "FIT_Raw_Convex_Perim", "FIT_Feret_Max_Angle",
"FIT_Feret_Min_Angle", "FIT_Avg_Red", "FIT_Avg_Green", "FIT_Avg_Blue", "FIT_PPC", "FIT_Ch3_Peak", "FIT_Ch3_TOF",
"FIT_Ch4_Peak", "FIT_Ch4_TOF", "FIT_SaveX", "FIT_SaveY", "FIT_PixelW", "FIT_PixelH", "FIT_CaptureX",
Modified: pkg/zooimage/R/ZITrain.R
===================================================================
--- pkg/zooimage/R/ZITrain.R 2010-09-07 10:15:24 UTC (rev 195)
+++ pkg/zooimage/R/ZITrain.R 2011-01-20 12:23:19 UTC (rev 196)
@@ -105,14 +105,14 @@
checkDirExists(dir)
# Make sure we have .RData files in this dir (otherwise it is perhaps not a
- # training set root dir!
- Dats <- list.files(dir, pattern = "_dat1[.]RData$", full.names = TRUE)
+ # training set root dir!
+ Dats <- list.files(dir, pattern = "_dat1[.]RData$", full.names = TRUE)
if (length(Dats) == 0)
stop("does not appear to be a ", getTemp("ZIname"),
" training set root dir!")
# list the jpg files (recursively) in the dir
- res <- list.files.ext(dir, extension = "jpg", recursive = TRUE)
+ res <- list.files.ext(dir, extension = "jpg", recursive = TRUE)
# Check the result...
if (length(res) < 1)
@@ -136,7 +136,7 @@
# Create a directory (a data frame with: Id, Class)
df <- data.frame(Id = Id, Class = Class)
df$Id <- as.character(df$Id)
- nitems <- nrow(df)
+ nitems <- nrow(df)
# Read in all the .RData files from the root directory and merge them
### TODO: also collect metadata and merge them => make a merge function for
@@ -148,20 +148,37 @@
load(Dats[1])
Dat <- ZI.sample
Classes <- class(Dat)
+
+ # Modif Kev to free memory
+ Dat <- cbind(Id = make.Id(Dat), Dat)
+ Dat <- merge(Dat, df, by = "Id")
+
if (length(Dats) > 1) {
for (i in 2:length(Dats)) {
load(Dats[i])
+ ZI.sample <- cbind(Id = make.Id(ZI.sample), ZI.sample)
+ ZI.sample <- merge(ZI.sample, df, by = "Id")
Dat <- rbind(Dat, ZI.sample)
}
}
+
+# if (length(Dats) > 1) {
+# for (i in 2:length(Dats)) {
+# load(Dats[i])
+# Dat <- rbind(Dat, ZI.sample)
+# }
+# }
+
rownames(Dat) <- 1:nrow(Dat)
# Create the Id column
- Dat <- cbind(Id = make.Id(Dat), Dat)
+# Done in the loop!
+# Dat <- cbind(Id = make.Id(Dat), Dat)
# Merge Dat & df by "Id"
- df <- merge(Dat, df, by = "Id")
-
+# df <- merge(Dat, df, by = "Id")
+ # rename Dat in df
+ df <- Dat
# Issue an error if there is no remaing row in the data frame
if (nrow(df) == 0)
stop("No valid item found (both with a vignette and with valid measurement data!")
More information about the Zooimage-commits
mailing list