Learn R Programming

RecordLinkage (version 0.3-1)

classifySupv: Supervised Classification

Description

Supervised classification of record pairs based on a trained model.

Usage

classifySupv(model, newdata, ...)

## S3 method for class 'RecLinkClassif,RecLinkData': classifySupv(model, newdata, ...)

## S3 method for class 'RecLinkClassif,RLBigData': classifySupv(model, newdata, withProgressBar = (sink.number()==0), ...)

Arguments

model
Object of class RecLinkClassif. The calibrated model. See trainSupv.
newdata
Object of class "RecLinkData" or "RLBigData". The data to classify.
withProgressBar
Whether to display a progress bar
...
Further arguments for the predict method.

Value

  • For the "RecLinkData" method, a S3 object of class "RecLinkResult" that represents a copy of newdata with element rpairs$prediction, which stores the classification result, as addendum.

    For the "RLBigData" method, a S4 object of class "RLResult".

Details

The record pairs in newdata are classified by calling the appropriate predict method for model$model.

By default, the "RLBigDataDedup" method displays a progress bar unless output is diverted by sink, e.g. when processing a Sweave file.

See Also

trainSupv for training of classifiers, classifyUnsup for unsupervised classification.

Examples

Run this code
# Split data into training and validation set, train and classify with rpart
data(RLdata500)
pairs=compare.dedup(RLdata500, identity=identity.RLdata500,
                    blockfld=list(1,3,5,6,7))
l=splitData(pairs, prop=0.5, keep.mprop=TRUE)                    
model=trainSupv(l$train, method="rpart", minsplit=5)
result=classifySupv(model=model, newdata=l$valid)
summary(result)

Run the code above in your browser using DataLab