[R] Y in Kohonen xyf function

K. Elo maillists at pp.inet.fi
Wed Jun 22 12:46:29 CEST 2016


Hi again!

21.06.2016, 21:33, chalabi.elahe at yahoo.de wrote:
> Hi Kimmo, Thanks for your reply. I think now my problem is that I
> don't understand what does factor(df.classes[training]) do?

Sorry, my mistake, should habe been 'df$speed'. Please try the following:

--- snip ---

set.seed(7) training <- sample(nrow(df), 120)
Xtraining<- scale(df[training,])
Xtest <- scale(df[-training,], center = attr(Xtraining, 
"scaled:center"), scale = attr(Xtraining,
"scaled:scale"))
xyf.df <- xyf(Xtraining, factor(df$speed[training]), grid =
somgrid(5, 5, "hexagonal"))

--- snip ---

HTH,
Kimmo



More information about the R-help mailing list