gng module
- class gng.GNG(iterations, learning_rate=0.1, age_threshold=100, node_creation_interval=100, new_node_error_discount=0.5, step_error_discount=0.1)
Bases:
objectA class to apply the Growing-Neural-Gas algorithm over a given dataset, generating a Graph.
- Parameters
iterations – The amount of iterations to run the GNG algorithm
learning_rate – Optional, default = 0.1 - The rate at which coordinates of nodes are updated towards the learned direction
age_threshold – Optional, default = 100 - The maximum age an edge can reach before being removed.
node_creation_interval – Optional, default = 100 - Defines at what amount of steps a new node should be added.
new_node_error_discount – Optional default = 0.5 - The discount value for the error when a new node is created.
step_error_discount – Optional default = 0.1 - The discount value for the error which is subtracted from the errors each step.
- fit(data)
Fit the GNG class to the dataset.
- Parameters
data – A list of coordinate tuples of data-points
- Returns
This class instance.
- transform(data)
Applies the self-organising-map algorithm over a given dataset and graph. Returns a graph after running the algorithm. NOTE: Running transform() multiple times will continue updating the same graph, to restart fresh create a new GNG instance.
- Parameters
data – A list of coordinate tuples of data-points
- Returns
The Graph of the GNG class after running the GNG algorithm.