-
Notifications
You must be signed in to change notification settings - Fork 8
Creating a Map
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: RequiredNumpy array of (N*M) where N is the number of data entries and M is the number of characteristics of the data.
-
size: RequiredInteger to indicates the lateral size of the map. It allows the creation of a squared map with
size x sizeneurons. -
period: Optional - Default = 10Integer 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.1Float 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 = 0Integer 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.
-
distanceOptional - Default = 'euclidean'euclideanconsiders the neighbourhood as a diamond.chebyshevconsiders the neighbourhood as a square. -
use_decayOptional - Default = FalseExperimental feature to allow the use of decay on the training process.
-
reinforcementOptional - Default = 0Integer that indicates extra reinforcement period after normal training.
-
extensionOptional - Default = 1Float that indicates the rate at which the period will increase during reinforcements iterations.
-
compressionOptional - Default = 1Float that indicates the rate at which the initial learning rate will decrease during reinforcements iterations.
-
normalizationOptional - Default = 'none'- 'none': No normalization apply to the training data
- 'euclidean': Euclidean normalization.
- 'fwn': Feature Wise Normalization
-
presentationOptional - Default = 'random'Allows to choose if the patterns will be presented in a random (
'random') or a sequential ('sequential') way. -
weightsOptional - 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.
-