Description Usage Arguments Details Value Author(s) References See Also Examples
Distance Weighted Discriminations are an excellent tool for classification.
kdwd
supports the well known binary classification formulations along with
native multi-class classification formulations.
1 2 3 4 5 6 7 |
x |
a symbolic description of the model to be fit. When not using a formula x can be a matrix containing the training data. |
data |
an optional data frame containing the training data, when using a formula. |
y |
a response vector with one label for each row/component of |
scaled |
A logical vector indicating the variables to be
scaled. If |
type |
|
C |
cost of constraints violation (default: 1) this is the ‘C’-constant of the regularization term in the Lagrange formulation. |
class.weights |
a named vector of weights for the different classes, used for asymmetric class sizes. Not all factor levels have to be supplied (default weight: 1). All components have to be named. |
cross |
if a integer value k>0 is specified, a k-fold cross validation on the training data is performed to assess the quality of the model: the accuracy rate for classification. |
fit |
indicates whether the fitted values should be computed
and included in the model or not (default: |
subset |
An index vector specifying the cases to be used in the training sample. (NOTE: If given, this argument must be named.) |
na.action |
A function to specify the action to be taken if |
... |
further arguments. |
kdwd
uses SDPT3 infeasible path-following algorithm to solve the DWD SOCP
problem.
For multiclass-classification with k classes, k > 2, bdwd
uses
the
‘one-against-one’-approach, in which k(k-1)/2 binary classifiers are
trained; the appropriate class is found by a voting scheme,
The mdwd
formulations deal with the multiclass-classification problems by
solving
a single SOCP problem involving all the classes.
In classification when cross
is k
a k-fold cross validation is
performed on the data.
The data can be passed to the kdwd
function in a matrix
or a
data.frame
.
An S4 object of class "kdwd"
containing the fitted model, Accessor
functions can be used to access
the slots of the object (see examples) which include:
w |
The direction vector pointing towards positive class, unit vector (i.e length 1). In case of one-against-one classification this is a list of vectors. In case of global multiclass classification, it is a matrix. |
b0 |
The intercept. In case of one-against-one classification this is a list of scalers. In case of global multiclass classification, it is a vector. |
obj |
The value of the objective function. In case of one-against-one classification this is a vector of values. |
error |
Training error. |
cross |
Cross validation error, (when cross > 0). |
fitted |
Fitted class label for training data. |
Hanwen Huang: hanwenh@email.unc.edu; Perry Haaland: Perry_Haaland@bd.com; Xiaosun Lu: Xiaosun_Lu@bd.com; Yufeng Liu: yfliu@email.unc.edu; J. S. Marron: marron@email.unc.edu
Kim-Chuan Toh , Michael J. Todd, and Reha H. Tutuncu
SDPT3 version 4.0 – a MATLAB software for semidefinite-quadratic-linear
programming
http://www.math.nus.edu.sg/~mattohkc/sdpt3.html
J. S. Marron and Michael Todd
Distance Weighted Discrimination
http://ecommons.cornell.edu/bitstream/1813/9217/1/TR001339.pdf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## simple binary classification example
data(promotergene)
## train DWD
gene <- kdwd(Class~.,data=promotergene,C=100,scaled=TRUE,cross=5)
gene@fitted
## simple multiclass example using the famous iris data
data(iris)
## train an OVO multiclass DWD
irismodel <- kdwd(Species~.,data=iris,type="bdwd",C=100,scaled=TRUE,cross=5)
## get fitted values
irismodel@fitted
## Test on the training set
predict(irismodel, iris)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.