[R] Y in Kohonen xyf function

chalabi.elahe at yahoo.de chalabi.elahe at yahoo.de
Wed Jun 15 14:18:52 CEST 2016


Hi all,
I have a df and I want to use supervised Self Organizing Map to do classification. I should use Kohonen library and xyf function from it. As you know the xyf function looks like this and I have problem defining my Y:

    xyf(data,Y,grid=somgrid(),rlen=100,alpha=c(0.05,0.01))
I want to do classification based on a column which shows the speed that a protocols is run, and this column is the following:

   $speed   :num 4 4 3 3 3 1 1 1 2 1 4 4 3
numbers from 1 to 4 show the speed from very fast to very slow protocols. so the property I want to be modeled is df$speed, but I don't know how should I bring it in xyf function. Does anyone know how to do that? I also added my train set ans test set: 

   dt=sort(sample(nrow(df),nrow(df)*.7))
   train=df[dt,]
   Xtraining=scale(trian)
   Xtest=scale(-trian)
   center=attr(Xtrianing,"scaled:center")
   scale=attr(Xtraining,"scaled:scale")
   xyf(Xtraining,........,grid=somgrid(10,10,"hexagonal"))


Thanks for any Help,
Elahe



More information about the R-help mailing list