Laura Bendhaiba, Madalina Olteanu, Nathalie Vialaneix

Definition and purpose of a myGrid class object

Objects of class myGrid are made to depict a grid. To be able to create such objects, you have to load the package SOMbrero.

Basic functions on a myGrid class object

In this section, we will consider only the four basic functions that can be applied on a myGrid class object:

The initGrid function

The initGrid function initializes a new myGrid object. It has 3 parameters:

The following R code initializes a new myGrid object of square topology, x dimension 5 and y dimension 6, and distance type maximum.

my.first.grid <- initGrid(dimension=c(5,6), topo="square", dist.type="maximum")

The print.myGrid function

The myGrid object print function prints in the console the main features of the chosen object. The only argument is the object to be printed.

Considering the previously initialized grid, the print command is:

print(my.first.grid)
## 
##       Self-Organizing Map structure
## 
##         Features   :
##            topology     :  square 
##            x dimension  :  5 
##            y dimension  :  6 
##            distance type:  maximum

The summary.myGrid function

The myGrid object summary function is quite simple. It only prints the class of the object and then calls the print function previously described. The only argument is the object to be summarized.

summary(my.first.grid)
## 
## Summary
## 
##       Class            :  myGrid 
## 
##       Self-Organizing Map structure
## 
##         Features   :
##            topology     :  square 
##            x dimension  :  5 
##            y dimension  :  6 
##            distance type:  maximum

The plot.myGrid function

The myGrid object plot function draws the squared area corresponding to the object, in a new graphical window. It has 2 parameters:

# plot without any color specification: squares are filled in white color
plot(my.first.grid)

plot of chunk plotRainbowGrid

# generating colors from the rainbow() function
my.colors <- rainbow(5*6)
plot(my.first.grid, neuron.col=my.colors)

plot of chunk plotRainbowGrid