omisvm {mildsvm} | R Documentation |
Fit MI-SVM-OR model to ordinal outcome data
Description
This function fits a modification of MI-SVM to ordinal outcome data based on the research method proposed by Kent and Yu.
Usage
## Default S3 method:
omisvm(
x,
y,
bags,
cost = 1,
h = 1,
s = Inf,
method = c("qp-heuristic"),
weights = TRUE,
control = list(kernel = "linear", sigma = if (is.vector(x)) 1 else 1/ncol(x),
max_step = 500, type = "C-classification", scale = TRUE, verbose = FALSE, time_limit
= 60),
...
)
## S3 method for class 'formula'
omisvm(formula, data, ...)
## S3 method for class 'mi_df'
omisvm(x, ...)
Arguments
x |
A data.frame, matrix, or similar object of covariates, where each
row represents an instance. If a |
y |
A numeric, character, or factor vector of bag labels for each
instance. Must satisfy |
bags |
A vector specifying which instance belongs to each bag. Can be a string, numeric, of factor. |
cost |
The cost parameter in SVM. If |
h |
A scalar that controls the trade-off between maximizing the margin and minimizing distance between hyperplanes. |
s |
An integer for how many replication points to add to the dataset. If
|
method |
The algorithm to use in fitting (default |
weights |
named vector, or |
control |
list of additional parameters passed to the method that control computation with the following components:
|
... |
Arguments passed to or from other methods. |
formula |
a formula with specification |
data |
If |
Details
Currently, the only method available is a heuristic algorithm in linear SVM space. Additional methods should be available shortly.
Value
An object of class omisvm.
The object contains at least the
following components:
-
*_fit
: A fit object depending on themethod
parameter. Ifmethod = 'qp-heuristic'
this will begurobi_fit
from a model optimization. -
call_type
: A character indicating which methodomisvm()
was called with. -
features
: The names of features used in training. -
levels
: The levels ofy
that are recorded for future prediction. -
cost
: The cost parameter from function inputs. -
weights
: The calculated weights on thecost
parameter. -
repr_inst
: The instances from positive bags that are selected to be most representative of the positive instances. -
n_step
: Ifmethod == 'qp-heuristic'
, the total steps used in the heuristic algorithm. -
x_scale
: Ifscale = TRUE
, the scaling parameters for new predictions.
Methods (by class)
-
default
: Method for data.frame-like objects -
formula
: Method for passing formula -
mi_df
: Method formi_df
objects, automatically handling bag names, labels, and all covariates.
Author(s)
Sean Kent
See Also
predict.omisvm()
for prediction on new data.
Examples
if (require(gurobi)) {
data("ordmvnorm")
x <- ordmvnorm[, 3:7]
y <- ordmvnorm$bag_label
bags <- ordmvnorm$bag_name
mdl1 <- omisvm(x, y, bags, weights = NULL)
predict(mdl1, x, new_bags = bags)
}