code: def test_simple_neural_gas(self):
      gng = algorithms.GrowingNeuralGas(
          n_inputs=2,
          n_start_nodes=2,
          shuffle_data=True,
          step=0.2,
          neighbour_step=0.05,
          max_edge_age=10,
          n_iter_before_neuron_added=50,
          error_decay_rate=0.995,
          after_split_error_decay_rate=0.5,
          min_distance_for_update=0.1,
          max_nodes=100,
          verbose=False,
      )
      data = self.data
      gng.train(data, epochs=10)
  
      # Add one useless node to make sure that it
      # would be deleted at the end
      first_node = gng.graph.nodes[0]
      new_node = algorithms.NeuronNode(
          weight=np.array([[1000.0, 1000.0]])
      )
      new_node.useless_node = True
  
      gng.graph.add_node(new_node)
      gng.graph.add_edge(new_node, first_node)
  
      # We run it twice in order to make sure that we won't
      # reset weights on the second run.
      gng.train(data, epochs=10)
  
      if self.debug_plot:
          self.make_plot(data, gng)
  
      self.assertEqual(len(gng.graph.nodes), gng.max_nodes)
      self.assertAlmostEqual(gng.errors.train[-1], 0.09, places=2)
  
      useless_node_present = any(
          getattr(node, "useless_node", False)
          for node in gng.graph.nodes
      )
  
      self.assertFalse(useless_node_present)
  
      with self.assertRaises(NotImplementedError):
          gng.predict(data)
  
      # Check that we can stop training in case if we don't get any updates
      before_epochs = gng.last_epoch
      gng.min_distance_for_update = 10
      gng.train(data, epochs=10)
      self.assertEqual(before_epochs + 1, gng.last_epoch)
  
file_path: neupy/tests/algorithms/competitive/test_growing_neural_gas.py
imports: import pickle
  import numpy
  import matplotlib.pyplot
  from sklearn.datasets import make_blobs
  from neupy import algorithms
  from neupy.algorithms.competitive.growing_neural_gas import NeuralGasGraph, NeuronNode
  from base import BaseTestCase
label_desc: Use image node_id 4 for calling the GrowingNeuralGasTestCase obj's underlying member method code with example usage: obj.test_simple_neural_gas() without return types