code: def test_storage_pickle_save_and_load_during_the_training(self):
      tempdir = tempfile.mkdtemp()
      x_train, x_test, y_train, y_test = simple_classification()
  
      errors = {}
  
      def on_epoch_end(network):
          epoch = network.last_epoch
          errors[epoch] = network.score(x_test, y_test)
  
          if epoch == 4:
              storage.load_pickle(
                  network.network,
                  os.path.join(tempdir, "training-epoch-2"),
              )
              raise StopTraining(
                  "Stop training process after 4th epoch"
              )
          else:
              storage.save_pickle(
                  network.network,
                  os.path.join(
                      tempdir, "training-epoch-{}".format(epoch)
                  ),
              )
  
      gdnet = algorithms.GradientDescent(
          network=[
              layers.Input(10),
              layers.Sigmoid(4),
              layers.Sigmoid(1),
          ],
          signals=on_epoch_end,
          batch_size=None,
          step=0.5,
      )
      gdnet.train(x_train, y_train)
  
      validation_error = gdnet.score(x_test, y_test)
  
      self.assertGreater(errors[2], errors[4])
      self.assertAlmostEqual(validation_error, errors[2])
      self.assertNotAlmostEqual(validation_error, errors[4])
  
file_path: neupy/tests/storage/test_pickle_storage.py
imports: import os
  import tempfile
  import numpy
  from neupy import algorithms, layers, storage
  from neupy.utils import asfloat
  from neupy.exceptions import StopTraining
  from base import BaseTestCase
  from helpers import simple_classification
label_desc: Use image node_id 4 for calling the LayerStoragePickleTestCase obj's underlying member method code with example usage: obj.test_storage_pickle_save_and_load_during_the_training() without return types