Yukti Choudhury
2013-May-06 09:55 UTC
[R] How are feature weights extracted from 'superpc' analysis?
Hi, I am running 'superpc' to model a supervised principal component predictor to predict survival and I am having problems extracting feature weights to derive a formula for calculating a score. I am new to R so please pardon if the solution is obvious. After running superpc.predict.red to form the reduced model, I am unable to extract feature weights that are used to construct the reduced predictor. According to documentation for 'superpc', "wt" corresponding to "Weight for each feature, in constructing the reduced predictor" is one of the values of the output list from superpc.predict.red. However, after running superpc.predict.red, I do not find this value in the output. The same is true when I run the example script provided in the documentation, as below: library(superpc) set.seed(332) #generate some data x<-matrix(rnorm(1000*40),ncol=40) y<-10+svd(x[1:60,])$v[,1]+ .1*rnorm(40) ytest<-10+svd(x[1:60,])$v[,1]+ .1*rnorm(40) censoring.status<- sample(c(rep(1,30),rep(0,10))) censoring.status.test<- sample(c(rep(1,30),rep(0,10))) featurenames <- paste("feature",as.character(1:1000),sep="") data<-list(x=x,y=y, censoring.status=censoring.status, featurenames=featurenames) data.test<-list(x=x,y=ytest, censoring.status=censoring.status.test, featurenames= featurenames) a<- superpc.train(data, type="survival") fit<- superpc.predict(a, data, data.test, threshold=1.0, n.components=1, prediction.type="continuous") fit.red<- superpc.predict.red(a,data, data.test, threshold=.6) fit.red does not include a value called "wt". I am trying to derive a formula based on the weights of selected features which will to assign a supervised principal components score, with which survival outcome can be determined. Am I doing something wrong? Any advice on the use of this function will be much appreciated. Thanks, Yukti [[alternative HTML version deleted]]