sda(sparseLDA)
sda()所属R语言包:sparseLDA
Sparse discriminant analysis
稀疏判别分析
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Performs sparse linear discriminant analysis. Using an alternating minimization algorithm to minimize the SDA
执行稀疏线性判别分析。使用交替最小化算法,以尽量减少的SDA
用法----------Usage----------
sda(x, ...)
## Default S3 method:[默认方法]
sda(x, y, lambda = 1e-6, stop = -p, maxIte = 100,
Q = K-1, trace = FALSE, tol = 1e-6, ...)
参数----------Arguments----------
参数:x
A matrix of the training data with observations down the rows and variables in the columns.
向下的行和列中的变量与观测的训练数据的矩阵。
参数:y
A matrix initializing the dummy variables representing the groups.
矩阵初始化虚拟变量代表的群体。
参数:lambda
The weight on the L2-norm for elastic net regression. Default: 1e-6.
弹性网回归的L2-模的重量。默认值:1E-6。
参数:stop
If STOP is negative, its absolute value corresponds to the desired number of variables. If STOP is positive, it corresponds to an upper bound on the L1-norm of the b coefficients. There is a one to one correspondence between stop and t. The default is -p (-the number of variables).
如果STOP(停止)是负的,其绝对值对应至所需的号码的变量。如果STOP是积极的,它对应于一个上限的L1范数的系数b。停止和t之间有一个一一对应。默认值是-p(-的变量的数量)。
参数:maxIte
Maximum number of iterations. Default: 100.
最大迭代次数。默认值:100。
参数:Q
Number of components. Maximum and default is K-1 (the number of classes less one).
部件的数量。最大值和默认是K-1(少一类)。
参数:trace
If TRUE, prints out its progress. Default: FALSE.
如果是TRUE,打印出其进展情况。默认值:FALSE。
参数:tol
Tolerance for the stopping criterion (change in RSS). Default is 1e-6.
公差停止标准(RSS的变化)。默认是1e-6。
参数:...
additional arguments
额外的参数
Details
详细信息----------Details----------
The function finds sparse directions for linear classification.
功能发现稀疏线性分类的方向。
值----------Value----------
Returns a list with the following attributes:
返回一个具有以下属性的列表:
参数:beta
The loadings of the sparse discriminative directions.
稀疏的歧视性方向的负荷。
参数:theta
The optimal scores.
最佳的成绩。
参数:rss
A vector of the Residual Sum of Squares at each iteration.
在每次迭代的残差平方和的矢量。
参数:varNames
Names on included variables </table>
名称对包括变量</ TABLE>
.
。
(作者)----------Author(s)----------
Line Clemmensen, modified by Trevor Hastie
参考文献----------References----------
analysis", Technometrics, To appear.
参见----------See Also----------
normalize, normalizetest, smda
normalize, normalizetest, smda
实例----------Examples----------
## load data[#加载数据]
data(penicilliumYES)
X <- penicilliumYES$X
Y <- penicilliumYES$Y
colnames(Y) <- c("P. Melanoconidium",
"P. Polonicum",
"P. Venetum")
## test samples[#检测样品]
Iout<-c(3,6,9,12)
Iout<-c(Iout,Iout+12,Iout+24)
## training data[#培训资料]
Xtr<-X[-Iout,]
k<-3
n<-dim(Xtr)[1]
## Normalize data[#标准化数据]
Xc<-normalize(Xtr)
Xn<-Xc$Xc
p<-dim(Xn)[2]
## Perform SDA with one non-zero loading for each discriminative[#执行SDA一个非零加载的每个歧视]
## direction with Y as matrix input[#方向与Y矩阵的输入]
out <- sda(Xn, Y,
lambda = 1e-6,
stop = -1,
maxIte = 25,
trace = TRUE)
## predict training samples[#预测训练样本。]
train <- predict(out, Xn)
## testing[#测试]
Xtst<-X[Iout,]
Xtst<-normalizetest(Xtst,Xc)
test <- predict(out, Xtst)
print(test$class)
## Factor Y as input[#系数Y输入]
Yvec <- factor(rep(colnames(Y), each = 8))
out2 <- sda(Xn, Yvec,
lambda = 1e-6,
stop = -1,
maxIte = 25,
trace = TRUE)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|