code: def compare_networks(default_class, tested_class, data, **kwargs):
      """
      Compare two network arcitectures.
  
      Parameters
      ----------
      default_class : BaseNetwork instance
      tested_class : BaseNetwork instance
      data : tuple
      **kwargs :
  
      Raises
      ------
      AssertionError
          Raise exception when first network have better prediction
          accuracy then the second one.
      """
      epochs = kwargs.pop("epochs", 100)
      show_comparison_plot = kwargs.pop("show_comparison_plot", False)
  
      # Compute result for default network (which must be slower)
      network = default_class(**kwargs)
  
      if hasattr(network, "connection"):
          initial_parameters = save_dict(network.network)
  
      network.train(*data, epochs=epochs)
  
      network_default_error = network.errors.train[-1]
      errors1 = network.errors.train
  
      # Compute result for test network (which must be faster)
      if hasattr(network, "connection"):
          load_dict(network.network, initial_parameters)
  
      network = tested_class(**kwargs)
  
      network.train(*data, epochs=epochs)
      network_tested_error = network.errors.train[-1]
      errors2 = network.errors.train
  
      if show_comparison_plot:
          error_range = np.arange(max(len(errors1), len(errors2)))
          plt.plot(error_range[: len(errors1)], errors1)
          plt.plot(error_range[: len(errors2)], errors2)
          plt.show()
  
      if network_default_error <= network_tested_error:
          raise AssertionError(
              "First network has smaller error ({}) that the second one ({})."
              "".format(network_default_error, network_tested_error)
          )
  
file_path: neupy/tests/helpers.py
imports: import sys
  from contextlib import contextmanager
  import six
  import numpy
  import pandas
  from sklearn import datasets
  from sklearn.model_selection import StratifiedShuffleSplit
  from matplotlib import pyplot
  from neupy import algorithms, layers, utils, init
  from neupy.storage import save_dict, load_dict
label_desc: Use image node_id 3 for calling a global function with example usage: compare_networks(default_class, tested_class, data) without return types