[Zooimage-commits] r236 - in pkg/zooimage: . R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Dec 21 13:58:18 CET 2012
Author: phgrosjean
Date: 2012-12-21 13:58:18 +0100 (Fri, 21 Dec 2012)
New Revision: 236
Added:
pkg/zooimage/NEWS
Modified:
pkg/zooimage/DESCRIPTION
pkg/zooimage/R/ZITrain.R
pkg/zooimage/R/gui.R
pkg/zooimage/R/utilities.R
Log:
zooimage: merge of samples with different attributes measured on images in getTrain() + update of GUI function (analyzeClass() and vignettesClass()) + addition of meaningless FIT_xxx attributes as default for dropVars()
Modified: pkg/zooimage/DESCRIPTION
===================================================================
--- pkg/zooimage/DESCRIPTION 2012-11-30 15:24:49 UTC (rev 235)
+++ pkg/zooimage/DESCRIPTION 2012-12-21 12:58:18 UTC (rev 236)
@@ -1,8 +1,8 @@
Package: zooimage
Type: Package
Title: Analysis of numerical zooplankton images
-Version: 3.0-0
-Date: 2012-07-05
+Version: 3.0-1
+Date: 2012-12-21
Author: Ph. Grosjean, K. Denis & R. Francois
Maintainer: Ph. Grosjean <Philippe.Grosjean at umons.ac.be>
Depends: R (>= 2.14.0), svMisc (>= 0.9-67), svDialogs (>= 0.9-53), mlearning
Added: pkg/zooimage/NEWS
===================================================================
--- pkg/zooimage/NEWS (rev 0)
+++ pkg/zooimage/NEWS 2012-12-21 12:58:18 UTC (rev 236)
@@ -0,0 +1,22 @@
+= zooimage News
+
+== Changes in zooimage 3.0-1
+
+* getTrain() was not able to collect data when attributes measured on samples
+ mixed in training set differ slightly. Now, data are more carefully merged.
+
+* Meaningless FIT_xxx attributes from the FlowCAM are now excluded by default
+ in dropVars().
+
+* The GUI function vignettesClass(), and thus, the corresponding menu entry
+ were not implemented (the function prepareTest() that is called internally
+ was working properly, but was not reacheable through the menu). Done now.
+
+* The GUI function analyzeClass() and the corresponding menu entry listed old
+ (version 2) items. The list is now updated with new plots available in
+ zooimage 3 and mlearning 1.
+
+
+== Changes in zooimage 3.0-0
+
+This is a major refactoring of code from zooimage 1.x and 2.X.
Modified: pkg/zooimage/R/ZITrain.R
===================================================================
--- pkg/zooimage/R/ZITrain.R 2012-11-30 15:24:49 UTC (rev 235)
+++ pkg/zooimage/R/ZITrain.R 2012-12-21 12:58:18 UTC (rev 236)
@@ -372,7 +372,8 @@
load(Dats[i])
ZI.sample <- cbind(Id = makeId(ZI.sample), ZI.sample)
ZI.sample <- merge(ZI.sample, df, by = "Id")
- Dat <- rbind(Dat, ZI.sample)
+ Dat <- merge(Dat, ZI.sample, all = TRUE)
+ Dat$X.Item.1 <- NULL
}
}
rownames(Dat) <- 1:nrow(Dat)
Modified: pkg/zooimage/R/gui.R
===================================================================
--- pkg/zooimage/R/gui.R 2012-11-30 15:24:49 UTC (rev 235)
+++ pkg/zooimage/R/gui.R 2012-12-21 12:58:18 UTC (rev 236)
@@ -778,14 +778,14 @@
assignTemp("ZI.ClassName", name)
}
-## New version of confusion matrix analysis v 1.2-2
+## Analyze confusion matrix
analyzeClass <- function ()
{
## Analyze a classifier, using a ZI1Class object (new version)
## Ask for an option of analysis
defval <- "Print Confusion Matrix"
- opts <- c("Print Confusion Matrix", "Plot Confusion Matrix",
- "Print Precision/recall", "Plot Precision/recall")
+ opts <- c("Print Confusion Matrix", "Summarize", "Plot Confusion Matrix",
+ "Plot F-score", "Plot Dendrogram", "Plot Precision/recall")
## Then, show the dialog box
#res <- modalAssistant(paste(getTemp("ZIClass"), "Analyze a classifier"),
# c("This is a simplified version of the analysis of classifiers",
@@ -810,18 +810,34 @@
conf <- confusion(ZIC)
switch(res,
`Print Confusion Matrix` = print(conf),
- `Plot Confusion Matrix` = plot(conf, type = "image2"),
- `Print Precision/recall` = print(summary(conf)),
- `Plot Precision/recall` = plot(conf, type = "precision_recall"))
- return(invisible(res))
+ `Summarize` = print(summary(conf)),
+ `Plot Confusion Matrix` = plot(conf, type = "image"),
+ `Plot F-score` = plot(conf, type = "barplot"),
+ `Plot Dendrogram` = plot(conf, type = "dendrogram"),
+ `Plot Precision/recall` = plot(conf, type = "stars"))
+ return(invisible(conf))
}
## Extract vignettes from zid files to respective directories
-## TODO: also allow for .zidb files!
vignettesClass <- function ()
{
+ ## Ask for the base directory
+ defdir <- getTemp("ZI.BaseDir", default = getwd())
+ basedir <- dlgDir(default = defdir,
+ title = "Select the base directory for the test set")$res
+ if (!length(basedir)) return(invisible(NULL))
+
+ ## Ask for a subdir for this training set
+ subdir <- dlgInput("Subdirectory where to create the test set:",
+ default = "_test")$res
+ if (!length(subdir)) return(invisible(NULL))
+ testdir <- file.path(basedir, subdir)
+ if (file.exists(testdir))
+ stop("The directory '", testdir,
+ "' already exists! Please, restart and specify a new one")
+
## Select .zid files to be classified
- zid <- selectFile(type = "Zid", multiple = TRUE, quote = FALSE)
+ zid <- selectFile(type = "ZidZidb", multiple = TRUE, quote = FALSE)
if (!length(zid)) return(invisible(NULL))
## Look if we have a classifier object defined
@@ -829,10 +845,21 @@
zic <- selectObject("ZIClass", multiple = FALSE, default = zic,
title = "Choose a classifier (ZIClass object):")
if (!length(zic)) return(invisible(FALSE))
+ ## Save this choice for later reuse
+ assignTemp("ZI.ClassName", zic, replace.existing = TRUE)
zicObj <- get(zic, envir = .GlobalEnv)
- stop("sorry! This function need to be reimplemented")
+ ## Sort vignettes in the different directories, as predicted by the classifier
+ prepareTest(testdir, zid, template = zicObj, classes = zicObj)
+ ## Remember the directory...
+ assignTemp("ZI.BaseDir", basedir)
+ assignTemp("ZI.TestDir", testdir)
+
+ ## Explain what to do next...
+ message("Vignettes classified in '", testdir, "'")
+ message("View them in your favorite file browser (and possibly correct classification manually)")
+
## Classify vignettes
# if (length(zid) > 1) {
# classVignettesAll(zidfiles = zid, Dir = "_manuValidation",
Modified: pkg/zooimage/R/utilities.R
===================================================================
--- pkg/zooimage/R/utilities.R 2012-11-30 15:24:49 UTC (rev 235)
+++ pkg/zooimage/R/utilities.R 2012-12-21 12:58:18 UTC (rev 236)
@@ -95,6 +95,7 @@
}
## Default list of variables to drop
+## Version 3.0-1: added useless FIT variables
dropVars <- function ()
{
res <- try(get("ZI.dropVarsDef"), silent = TRUE)
@@ -102,7 +103,18 @@
res <- getOption("ZI.dropVarsDef",
c("Id", "Label", "Item", "X", "Y", "XM", "YM", "BX", "BY", "Width",
"Height", "Angle", "XStart", "YStart", "Dil", "Predicted",
- "Predicted2"))
+ "Predicted2", "FIT_Cal_Const", "FIT_Avg_Red", "FIT_Avg_Green",
+ "FIT_Avg_Blue", "FIT_PPC", "FIT_Ch1_Peak", "FIT_Ch1_TOF",
+ "FIT_Ch2_Peak", "FIT_Ch2_TOF", "FIT_Ch3_Peak", "FIT_Ch3_TOF",
+ "FIT_SaveX", "FIT_SaveY", "FIT_PixelW", "FIT_PixelH",
+ "FIT_CaptureX", "FIT_CaptureY", "FIT_Edge_Gradient",
+ "FIT_Source_Image", "FIT_Calibration_Image", "FIT_High_U32",
+ "FIT_Low_U32", "FIT_Total", "FIT_Red_Green_Ratio",
+ "FIT_Blue_Green_Ratio", "FIT_Red_Blue_Ratio",
+ "FIT_Ch2_Ch1_Ratio", "FIT_Ch4_Peak", "FIT_Ch4_TOF", "FIT_Timestamp1",
+ "FIT_Timestamp2", "FIT_Camera", "FIT_FringSize", "FIT_CircleFit",
+ "FIT_Ch1_Area", "FIT_Ch2_Area", "FIT_Ch3_Area",
+ "FIT_TimeStamp1", "FIT_Source_Image.1"))
as.character(res)
}
More information about the Zooimage-commits
mailing list