Last data update: 2014.03.03

R: Manipulate training and testsets 'ZITrain'/'ZITest' objects
ZITrainR Documentation

Manipulate training and testsets 'ZITrain'/'ZITest' objects

Description

'ZITrain' contain a hierarchy of classes (taxonomic or not) and a link to a series of items belonging to these classes. It can be obtained after manual or automatic classification of various objects from .zid or .zidb files. 'ZITest' objects are almost identical, but with a constraint on the classes that must match the ones of the reference 'ZItrain' or 'ZIClass' object (a necessity to allow for comparisons)!

Usage

prepareTrain(traindir, zidbfiles, template = c("[Basic]", "[Detailed]",
    "[Very detailed]"), classes = NULL, ...)
addToTrain(traindir, zidbfiles, classes = NULL, ...)
getTrain(traindir, creator = NULL, desc = NULL, keep_ = FALSE, na.rm = FALSE)

prepareTest(testdir, zidbfiles, template, classes = NULL, ...)
addToTest(testdir, zidbfiles, classes = NULL, ...)
getTest(testdir, creator = NULL, desc = NULL, keep_ = NA, na.rm = FALSE)

template(object, ...)
## Default S3 method:
template(object, ...)

recode(object, ...)
## S3 method for class 'ZITrain'
recode(object, new.levels, depth, ...)
## S3 method for class 'ZITest'
recode(object, new.levels, depth, ...)

Arguments

traindir

the root directory of the training set.

testdir

the root directory of the test set.

zidbfiles

.zidb files or .zid files to use for data and vignettes in the training set.

template

file containing subdirectories template to use for creating classes in the training or test set. Either a defaut template between [], or the name of a .zic file, or a template extracted from a 'ZITrain' or 'ZIClass' object using template(object) (with the add.others argument to TRUE for prepareTest() and to FALSE for prepareTrain())

classes

if vignettes are already classified in the zid(b) files, should they be sorted that way in the created training or test set? If not NULL, indicate the name of the classification column (usually, Class for manual classification or Predicted for automatic predictions). This can also be a 'ZIClass' or 'mlearning' object that will be used for classification of the particles first, ... or it can be a function that does the classification.

creator

name of the author of this classification (or the method, if done automatically).

desc

a short description of this manual classification.

keep_

do we keep items in the '_' subdirectory (corresponding to unclassified ones)? Default to FALSE in getTrain() and to NA for getTest(), which transforms all items in the '_' or one of its subdirectories into missing data.

na.rm

do we remove item with missing data? By default, not.

object

a 'ZITrain' or 'ZITest' object. For prepareTest(), a 'ZITrain' or 'ZIClass' object to use as reference to determine the classes to make.

new.levels

a character string of same length as the levels of object$Class with the labels of the new levels.

depth

the depth in the hierachy of the classes as in the "path" attribute of the object to use for recoding classes. If this argument is provided, new.levels is ignored and recomputed (and a warning is issued if both arguments are provided).

...

further arguments passed to the method. For prepareXXX() and addToXXX(), it is further arguments passed to the prediction function provided in classes, or to the predict() method for 'ZIClass' or 'mlearning' objects.

Author(s)

Philippe Grosjean <Philippe.Grosjean@umons.ac.be>

See Also

ZIClass

Examples

##TODO...

Results