def err_func(chromosome, dataset, rbfn):
    """Calculate the error function for each chromosome.
    This function is specially designed to be pickable for multiprocessing.

    Args:
        chromosome (list of floats): The chromosome which is the parameters of
            RBFN model.
        dataset (list of TrainingData): The training dataset.
        rbfn (RBFN): The RBFN model which must be deep copied for different
            parameters in output calculation.

    Returns:
        float: The result of fitting function.
    """

    rbfn.load_model(chromosome)
    res = sum(abs(d.o - rbfn.output(d.i, antinorm=True)) for d in dataset)
    return res / len(dataset)