Skip to content

Creating a Map

CEIEC edited this page Jul 3, 2024 · 2 revisions

In order to create and train a Self-Organizing Map on GEMA we will import the Map module from the library:

from GEMA import Map

To initialize a map we will call the constructor and save it on a variable:

my_map = Map(data, size, period, initial_lr, initial_neighbourhood, distance, use_decay, reinforcement, extension, compression, normalization, presentation, weights)

Parameters:

  • data : Required

    Numpy array of (N*M) where N is the number of data entries and M is the number of characteristics of the data.

  • size: Required

    Integer to indicates the lateral size of the map. It allows the creation of a squared map with size x size neurons.

  • period: Optional - Default = 10

    Integer that represents the number of iterations of the training process. Each iteration is a full presentation of all of the patterns.

  • initial_lr: Optional - Default = 0.1

    Float value. Indicates the learning rate for the first iteration. It will decrease to 0 in the last iteration according to a lineal function.

  • initial_neighbourhood: Optional - Default = 0

    Integer that indicates the distance from where a neuron will be considered inside the neighbourhood and actually learn in the first iteration. It will decrease to 0 (only the BMU will learn) in the last iteration according to a lineal function.

  • distance Optional - Default = 'euclidean'

    euclidean considers the neighbourhood as a diamond.

    chebyshev considers the neighbourhood as a square.

  • use_decay Optional - Default = False

    Experimental feature to allow the use of decay on the training process.

  • reinforcement Optional - Default = 0

    Integer that indicates extra reinforcement period after normal training.

  • extension Optional - Default = 1

    Float that indicates the rate at which the period will increase during reinforcements iterations.

  • compression Optional - Default = 1

    Float that indicates the rate at which the initial learning rate will decrease during reinforcements iterations.

  • normalization Optional - Default = 'none'

    • 'none': No normalization apply to the training data
    • 'euclidean': Euclidean normalization.
    • 'fwn': Feature Wise Normalization
  • presentation Optional - Default = 'random'

    Allows to choose if the patterns will be presented in a random ('random') or a sequential ('sequential') way.

  • weights Optional - Default = 'random'

    Allows for different weights initialization:

    • 'random': values between 0 and 1
    • 'random_negative': values between -1 and 1
    • 'sample': random values based on the training data
    • 'PCA': values given by a linear combination of the two first principal components of the training data.

Clone this wiki locally