如何从属性和索引号中删除“

时间:2014-07-10 09:22:19

标签: r feature-selection

> wt<-c() 
 braz<-read.csv("braz.csv",header=T)
 index<-1:nrow(braz)
 tindex<-sample(index,trunc(length(index)*.7))
 trainbraz<-braz[tindex,]
 testbraz<-braz[-tindex,]
 weights<-chi.squared(Class~.,trainbraz) 
 wt$v<-weights$attr_importance
 wt$rn<-c(row.names(weights)) 
 a<-wt$rn[wt$v>0]
   >a
 [1] "Word7"   "Word12"  "Word30"  "Word40"  "Word55"  "Word63"  "Word73" 
 [8] "Word75"  "Word76"  "Word77"  "Word91"  "Word92"  "Word105" "Word107"
[15] "Word123" "Word127" "Word129" "Word133" "Word134" "Word151" "Word152"
[22] "Word170" "Word191" "Word199" "Word201" "Word202" "Word207" "Word211"
[29] "Word216" "Word258" "Word272" "Word282" "Word291" "Word333" "Word338"
[36] "Word345" "Word347" "Word379" "Word387" "Word403" "Word421" "Word425"
[43] "Word447" "Word456" "Word468" "Word476" "Word479" "Word487" "Word494"
[50] "Word499" "Word502" "Word511" "Word513" "Word518" "Word519" "Word523"
[57] "Word546" "Word553" "Word561" "Word595" "Word607" "Word608" "Word615"
[64] "Word619" "Word631" "Word650" "Word673" "Word687" "Word691" "Word705"
[71] "Word714" "Word726" "Word731" "Word799" "Word814" "Word815" "Word823"
[78] "Word832" "Word839" "Word851" "Word855"

我想从

添加5个顶级属性
  subset <- cutoff.k(a, 5)# FSelctor package
  f <- as.simple.formula(subset, "Class")

输出错误

  

子集&lt; - cutoff.k(a,5)
         if(dim(attrs)[1] == 0)返回错误(字符(0)):         参数长度为零   f&lt; - as.simple.formula(子集,&#34; Class&#34;)
        粘贴错误(属性,sep =&#34;&#34;,collapse =&#34; +&#34;):          不能强迫类型&#39;关闭&#39;到#&#39;字符&#39;

的矢量

因为&#34;&#34;增加没有发生。如何删除&#34;&#34;形式&#34; Word7&#34; &#34; Word12&#34; ..&#34; Word855&#34;等等,只检索Word7 Word12 .. Word855 如何删除索引号,即[1] [8] ....

0 个答案:

没有答案