This function fits the Support Vector Ordinal Regression with Explicit Constraints based on the research of Chu and Keerthi (2007).
# S3 method for default
svor_exc(
x,
y,
cost = 1,
method = c("smo"),
weights = NULL,
control = list(kernel = "linear", sigma = if (is.vector(x)) 1 else 1/ncol(x), max_step
= 500, scale = TRUE, verbose = FALSE),
...
)# S3 method for formula
svor_exc(formula, data, ...)
# S3 method for mi_df
svor_exc(x, ...)
An object of class svor_exc
The object contains at least the
following components:
smo_fit
: A fit object from running the modified ordinal smo algorithm.
call_type
: A character indicating which method svor_exc()
was called
with.
features
: The names of features used in training.
levels
: The levels of y
that are recorded for future prediction.
cost
: The cost parameter from function inputs.
n_step
: The total steps used in the heuristic algorithm.
x_scale
: If scale = TRUE
, the scaling parameters for new predictions.
A data.frame, matrix, or similar object of covariates, where each
row represents an instance. If a mi_df
object is passed, y
is
automatically extracted, bags
is ignored, and all other columns will be
used as predictors.
A numeric, character, or factor vector of bag labels for each
instance. Must satisfy length(y) == nrow(x)
. Suggest that one of the
levels is 1, '1', or TRUE, which becomes the positive class; otherwise, a
positive class is chosen and a message will be supplied.
The cost parameter in SVM.
The algorithm to use in fitting (default 'smo'
). When
method = 'smo'
, the modified SMO algorithm from Chu and Keerthi (2007) is
used.
NULL
, since weights are not implemented for this function.
list of additional parameters passed to the method that control computation with the following components:
kernel
either a character the describes the kernel ('linear' or
'radial') or a kernel matrix at the instance level.
sigma
argument needed for radial basis kernel.
max_step
argument used when method = 'heuristic'
. Maximum steps of
iteration for the heuristic algorithm.
scale
argument used for all methods. A logical for whether to rescale
the input before fitting.
verbose
argument used when method = 'mip'
. Whether to message output
to the console.
Arguments passed to or from other methods.
A formula with specification y ~ x
. This argument is an
alternative to the x
, y
arguments, but requires the data
argument.
See examples.
If formula
is provided, a data.frame or similar from which
formula elements will be extracted.
svor_exc(default)
: Method for data.frame-like objects
svor_exc(formula)
: Method for passing formula
svor_exc(mi_df)
: Method for mi_df
objects, automatically handling bag
names, labels, and all covariates. Use the bag_label
as y
at the
instance level, then perform svor_exc()
ignoring the MIL structure and
bags.
Sean Kent
Chu, W., & Keerthi, S. S. (2007). Support vector ordinal regression. Neural computation, 19(3), 792-815. tools:::Rd_expr_doi("10.1162/neco.2007.19.3.792")
predict.svor_exc()
for prediction on new data.
data("ordmvnorm")
x <- ordmvnorm[, 3:7]
y <- attr(ordmvnorm, "instance_label")
mdl1 <- svor_exc(x, y)
predict(mdl1, x)
Run the code above in your browser using DataLab