clusterSVM(x, y, centers = NULL, cluster.object = NULL, lambda = 1, sparse = TRUE, valid.x = NULL, valid.y = NULL, valid.metric = NULL, type = 1, cost = 1, epsilon = NULL, bias = TRUE, wi = NULL, verbose = 1, seed = NULL, cluster.method = "kmeans", cluster.fun = NULL, cluster.predict = NULL, ...)x.
For classification, the values correspond to class labels and can be a 1xn matrix,
a simple vector or a factor. For regression, the values correspond to the values to predict,
and can be a 1xn matrix or a simple vector.cluster.fun, and can be passed to cluster.predictvalid.metricLiblineaR.LiblineaR.TRUE (default), instances of data becomes [data; 1].LiblineaR information will be printed.NULL to randomize the model.stats::kmeans
RcppMLPACK::mlKmeans
kernlab::kkmeans
If cluster.fun and cluster.predict are provided, cluster.method doesn't work anymore.
cluster and centers.cluster and centers.cluster.fun.svm the svm object from LiblineaR
lambda the parameter used.
sparse whether the data is sparsely transformed
label the clustering label for training data
centers the clustering centers from teh training dataset
cluster.fun the function used for clustering
cluster.object the object either
cluster.predict the function used for prediction on new data based on the object
valid.pred the validation prediction
valid.score the validation score
valid.metric the validation metric
time a list object recording the time consumption for each steps.
data(svmguide1)
svmguide1.t = svmguide1[[2]]
svmguide1 = svmguide1[[1]]
csvm.obj = clusterSVM(x = svmguide1[,-1], y = svmguide1[,1], lambda = 1,
centers = 8, seed = 512, verbose = 0,
valid.x = svmguide1.t[,-1],valid.y = svmguide1.t[,1])
csvm.pred = csvm.obj$valid.pred
# Or predict from the data
pred = predict(csvm.obj, svmguide1.t[,-1])
Run the code above in your browser using DataLab