batchSOM                package:class                R Documentation

_S_e_l_f-_O_r_g_a_n_i_z_i_n_g _M_a_p_s: _B_a_t_c_h _A_l_g_o_r_i_t_h_m

_D_e_s_c_r_i_p_t_i_o_n:

     Kohonen's Self-Organizing Maps are a crude form of
     multidimensional scaling.

_U_s_a_g_e:

     batchSOM(data, grid = somgrid(), radii, init)
     somgrid(xdim = 8, ydim = 6, topo = c("rectangular", "hexagonal"))

_A_r_g_u_m_e_n_t_s:

    data: a matrix or data frame of observations, scaled so that
          Euclidean distance is appropriate. 

    grid: A grid for the representatives. 

   radii: the radii of the neighbourhood to be used for each pass: one
          pass is run for each element of `radii'. 

    init: the initial representatives.  If missing, chosen (without
          replacement) randomly from `data'. 

xdim, ydim: dimensions of the grid 

    topo: the topology of the grid. 

_D_e_t_a_i_l_s:

     The batch SOM algorithm of Kohonen(1995, section 3.14) is used.

_V_a_l_u_e:

     an object of class `"SOM"' with components

    grid: the grid, an object of class `"somgrid"'. 

   codes: a matrix of representatives. 

_R_e_f_e_r_e_n_c_e_s:

     Kohonen, T. (1995) Self-Organizing Maps. Springer-Verlag

_S_e_e _A_l_s_o:

     `SOM'

_E_x_a_m_p_l_e_s:

     library(MASS)
     data(crabs)
     library(mva) # for dist
     lcrabs <- log(crabs[, 4:8])
     crabs.grp <- factor(c("B", "b", "O", "o")[rep(1:4, rep(50,4))])
     gr <- somgrid(topo = "hexagonal")
     crabs.som <- batchSOM(lcrabs, gr, c(4, 4, 2, 2, 1, 1, 1, 0, 0))
     plot(crabs.som)

     bins <- as.numeric(knn1(crabs.som$code, lcrabs, 0:47))
     plot(crabs.som$grid, type = "n")
     symbols(crabs.som$grid$pts[, 1], crabs.som$grid$pts[, 2],
             circles = rep(0.4, 48), inches = FALSE, add = TRUE)
     text(crabs.som$grid$pts[bins, ] + rnorm(400, 0, 0.1),
          as.character(crabs.grp))

