import numpy as np
import numpy.random as random

# We are going to save the neural network and the selected hyper-parameters

import dill as pickle
import gzip

# We define the functions used to load and save objects

def save_object(obj, filename):

    """
    Function that saves an object to a file using pickle
    """

    result = pickle.dumps(obj)
    with gzip.GzipFile(filename, 'wb') as dest: dest.write(result)
    dest.close()


def load_object(filename):

    """
    Function that loads an object from a file using pickle
    """

    with gzip.GzipFile(filename, 'rb') as source: result = source.read()
    ret = pickle.loads(result)
    source.close()

    return ret


import numpy as np
import numpy.random as random

# We are going to save the neural network and the selected hyper-parameters

import dill as pickle
import gzip

# We define the functions used to load and save objects

def save_object(obj, filename):

    """
    Function that saves an object to a file using pickle
    """

    result = pickle.dumps(obj)
    with gzip.GzipFile(filename, 'wb') as dest: dest.write(result)
    dest.close()


def load_object(filename):

    """
    Function that loads an object from a file using pickle
    """

    with gzip.GzipFile(filename, 'rb') as source: result = source.read()
    ret = pickle.loads(result)
    source.close()

    return ret


# We are going to save the neural network and the selected hyper-parameters # We define the functions used to load and save objects Function that saves an object to a file using pickle Function that loads an object from a file using pickle