predict.BRPmodel: Predict Method for BR+ (brplus)

Description Usage Arguments Details Value References See Also Examples

View source: R/method_brplus.R

Description

This function predicts values based upon a model trained by brplus.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## S3 method for class 'BRPmodel'
predict(
  object,
  newdata,
  strategy = c("Dyn", "Stat", "Ord", "NU"),
  order = list(),
  probability = getOption("utiml.use.probs", TRUE),
  ...,
  cores = getOption("utiml.cores", 1),
  seed = getOption("utiml.seed", NA)
)

Arguments

object

Object of class 'BRPmodel'.

newdata

An object containing the new input data. This must be a matrix, data.frame or a mldr object.

strategy

The strategy prefix to determine how to estimate the values of the augmented features of unlabeled examples.

The possible values are: 'Dyn', 'Stat', 'Ord' or 'NU'. See the description for more details. (Default: 'Dyn').

order

The label sequence used to update the initial labels results based on the final results. This argument is used only when the strategy = 'Ord' (Default: list())

probability

Logical indicating whether class probabilities should be returned. (Default: getOption("utiml.use.probs", TRUE))

...

Others arguments passed to the base algorithm prediction for all subproblems.

cores

The number of cores to parallelize the training. Values higher than 1 require the parallel package. (Default: options("utiml.cores", 1))

seed

An optional integer used to set the seed. This is useful when the method is run in parallel. (Default: options("utiml.seed", NA))

Details

The strategies of estimate the values of the new features are separated in two groups:

No Update (NU)

This use the initial prediction of BR to all labels. This name is because no modification is made to the initial estimates of the augmented features during the prediction phase

With Update

This strategy update the initial prediction in that the final predict occurs. There are three possibilities to define the order of label sequences:

Specific order (Ord)

The order is define by the user, require a new argument called order.

Static order (Stat)

Use the frequency of single labels in the training set to define the sequence, where the least frequent labels are predicted first

Dinamic order (Dyn)

Takes into account the confidence of the initial prediction for each independent single label, to define a sequence, where the labels predicted with less confidence are updated first.

Value

An object of type mlresult, based on the parameter probability.

References

Cherman, E. A., Metz, J., & Monard, M. C. (2012). Incorporating label dependency into the binary relevance framework for multi-label classification. Expert Systems with Applications, 39(2), 1647-1655.

See Also

BR+

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Predict SVM scores
model <- brplus(toyml, "RANDOM")
pred <- predict(model, toyml)


# Predict SVM bipartitions and change the method to use No Update strategy
pred <- predict(model, toyml, strategy = 'NU', probability = FALSE)

# Predict using a random sequence to update the labels
labels <- sample(rownames(toyml$labels))
pred <- predict(model, toyml, strategy = 'Ord', order = labels)

# Passing a specif parameter for SVM predict method
pred <- predict(model, toyml, na.action = na.fail)

utiml documentation built on May 31, 2021, 9:09 a.m.