********************************************** * Description of R functions in SMSVM v1.2.1 * ********************************************** smsvm is used to calculate the one-step update SMSVM solution. It consists of initialization of theta and coefficients and the first update of theta values and the corresponding coefficients. [Input] lambda and lambda.theta can be a scalar or a vector. Note that lambda and lambda.theta are on log2 scale. x: a numeric data matrix of covariates. y: a vector of scalar valued class labels {1,...,k}. isCombined: logical. If 'FALSE', the sequential tuning method is used. Otherwise, the theta-step tuning is combined with the following c-step. [Output] cstep0: the initial c-step output. thetastep1: the first theta-step output. cstep1: the first c-step output if 'isCombined' is FALSE. opt.theta: a vector of the optimal shrinkage factors. model: fitted SMSVM. -------------------------------------------------------------------- cstep is used to carry out the c-step of finding SMSVM coefficients given theta (rescaling parameters). Default: choose the lambda minimizing the in-sample training loss and get c-step solution at the value, or get c-step solution at a specific value of lambda. If 'cv' is TRUE, it finds the lambda minimizing cross-validated loss using the training data only and gets c-step solution at the value. If 'cv' is FALSE and test data are given, then it finds the lambda minimizing the testing loss and gets c-step solution at the value. [Input] lambda can be a scalar or a vector. Note that lambda is on log2 scale. 'theta' takes either 'NULL' or a vector of theta values. If 'NULL', equal weights are assigned as in the initial c-step. x: a numeric data matrix of covariates. y: a vector of scalar valued class labels {1,...,k}. [Output] opt.lambda: the value of optimal lambda minimizing 'criterion'. error: error rate with respect to '0-1' loss. hinge: average risk with respect to 'hinge' loss. model: fitted MSVM (cstep solution) for the optimal lambda. -------------------------------------------------------------------- thetastep is used to carry out the theta-step of finding the rescaling parameters given the coefficients of MSVM. Default: choose the lambda.theta minimizing the in-sample training loss and get theta-step solution at the value, or get theta-step solution at a specific value of lambda.theta If 'cv' is TRUE, it finds the lambda.theta minimizing cross-validated loss using the training data only and gets theta-step solution at the value. If 'cv' is FALSE and test data are given, then it finds the lambda.theta minimizing the testing loss and gets theta-step solution at the value. [Input] lambda.theta can be a scalar or a vector. The input argument 'pretheta' allows for the possibility of proceeding to further iterations. 'pretheta' takes either 'NULL' or a vector of theta values at the previous iteration. If 'NULL', equal weights are assigned as in the initial theta-step. x: a numeric data matrix of covariates. y: a vector of scalar valued class labels {1,...,k}. opt.lambda: a value of lambda on log2 scale. isCombined: logical. If 'FALSE', the sequential tuning method is used. Otherwise, the theta-step tuning is combined with the following c-step. [Output] theta.seq: the sequence of theta vectors at given lambda.theta values using the training data set only. nsel: number of positive theta values (selected features) shrinkage: average shrinkage factor -------------------------------------------------------------------- msvm is used to find the MSVM solution. It is very similar to cstep except that kernel matrix computation is more efficient via eval.kernel than cstep. Default: choose the lambda minimizing the in-sample training loss and get MSVM solution at the value, or get MSVM solution at a specific value of lambda. If 'cv' is TRUE, it finds the lambda minimizing cross-validated loss using the training data only and gets MSVM solution at the value. If 'cv' is FALSE and test data are given, then it finds the lambda minimizing the testing loss and gets MSVM solution at the value. [Input] lambda can be a scalar or a vector. Note that lambda is on log2 scale. x: a numeric data matrix of covariates. y: a vector of scalar valued class labels {1,...,k}. [Output] opt.lambda: the value of optimal lambda minimizing 'criterion'. error: error rate with respect to '0-1' loss. hinge: average risk with respect to 'hinge' loss. model: fitted MSVM for the optimal lambda. -------------------------------------------------------------------- msvm.compact is the same as 'msvm' given a value of lambda except that its input is not x, a raw data matrix but K, a kernel matrix. [Input] lambda is a scalar on the original scale. y: a vector of scalar valued class labels {1,...,k}. -------------------------------------------------------------------- predict.smsvm is used to predict SMSVM outputs for new data points given fitted SMSVM. [Input] x: a numeric data matrix of covariates in training set. x.new: a numeric data matrix of covariates in test set. model: msvm or smsvm model object -------------------------------------------------------------------- predict.msvm is used to predict MSVM outputs for new data points given fitted MSVM. [Input] x: a numeric data matrix of covariates in training set. x.new: a numeric data matrix of covariates in test set. model: msvm model object -------------------------------------------------------------------- predict.msvm.compact is the same as predict.msvm except that its input arguments are not x and x.new, raw data matrices but K, a kernel matrix. [Input] model: msvm or smsvm model object -------------------------------------------------------------------- find.theta finds a set of rescaling parameters (theta values) as a solution to the theta-step optimization problem. [Input] lambda and lambda.theta are scalars. Note that lambda and lambda.theta are on the original scale. y: a vector of scalar valued class labels {1,...,k}. -------------------------------------------------------------------- main.kernel computes a kernel matrix for linear, polynomial, and radial basis kernel functions. [Input] x: a numeric data matrix of covariates. -------------------------------------------------------------------- spline.kernel computes a kernel matrix using variants of spline kernel functions for additive or two-way interaction models. [Input] Note that input data are supposed to be between 0 and 1. If not, use unit.scale beforehand for transformation. x: a numeric data matrix of covariates. -------------------------------------------------------------------- make.anovaKernel is used to compute a list of anova kernel matrices. [Input] kernel$type: 'spline' for additive models with linear and smooth parts separated. 'spline-t' for additive models with linear and smooth parts combined. 'spline2' for two-way interaction models with linear and smooth parts separated. 'spline-t2' for two-way interaction models with linear and smooth parts combined. x: a numeric data matrix of covariates. -------------------------------------------------------------------- combine.kernel is used to combine anova kernel matrices with weights determined by theta values. The default theta vector is the vector of ones. -------------------------------------------------------------------- find.nonzero is used to find nonzero entries of a given matrix and their positions in the matrix for a compact representation of elements of QP problem. -------------------------------------------------------------------- hinge computes the average loss with respect to the extended hinge loss. [Input] y: a vector of scalar valued class labels {1,...,k}. -------------------------------------------------------------------- error.rate computes the misclassification rate. [Input] y: a vector of scalar valued class labels {1,...,k}. -------------------------------------------------------------------- class.code converts class label vector y (integers from 1 to k) into a matrix of MSVM class codes -------------------------------------------------------------------- eval.kernel computes a kernel matrix without constructing a list of anova kernels via make.anovaKernel. [Input] x: a numeric data matrix of covariates. -------------------------------------------------------------------- unit.scale is used to scale data to lie between 0 and 1 for spline kernel functions. [Input] x: a numeric data matrix of covariates. If 'limit' is a matrix of specified ranges with the same number of columns as x and two rows, x is scaled according as the range matrix. If 'limit' is NULL, the range of given data x itself is used. -------------------------------------------------------------------- data.split breaks data indices into 'fold' numbers of splits of roughly equal size for cross-validation. With the exception of leave-one-out cross-validation, the fold size should not be smaller than the minimum class size. [Input] y: a vector of scalar valued class labels {1,...,k}. fold: the fold size in cross-validation -------------------------------------------------------------------- msvm.plot draws the classification boundary induced by msvm or smsvm model object for two-dimensional x. [Input] x: a numeric data matrix of covariates. y: a vector of scalar valued class labels {1,...,k}. model: msvm or smsvm model object overlay: logical. If 'FALSE', a scatter plot and classification boundary plot are generated separately. Otherwise, the boundary induced by model is overlaid on the scatter plot. (this option is not implemented yet). -------------------------------------------------------------------- theta.plot draws theta path as a function of lambda.theta. -------------------------------------------------------------------- twod.data and twod.k4 simulate two-dimensional data.