[R] Clarification of inputs for xyf function of kohonen package

Ben Harrison harb at student.unimelb.edu.au
Thu Jul 25 09:42:24 CEST 2013


For supervised version of the kohonen SOM (xyf), I wish to train a
map, and then predict a property from the trained map. For the
function xyf, whose basic call is:

xyf(data, Y, grid)

should the data argument contain the Y property? Or does it need to be excluded?

e.g.:
> head(somdata)
   MEAS_TC        SP        LN        SN       GR     NEUT
1 2.780000 59.181090  33.74364  19.75361 66.57665 257.0368
2 1.490000 49.047750 184.14598 139.07980 54.75052 326.8001
3 1.490000 49.128902 183.58853 138.02768 55.54114 327.4739
4 2.201276 18.240331  19.20386  10.74748 62.04492 494.4161
5 2.201276 18.215522  19.18009  10.72446 61.87448 494.7409
6 1.276476  9.337769  14.16061  19.06902 14.99612 363.0020

Is the correct call like this:
data.xyf <- xyf(somdata, Y=somdata[1], ...)

Or this:
data.xyf <- xyf(somdata[-1], Y=somdata[1], ...)

Ben.



More information about the R-help mailing list