コード例 #1
0
    def __evaluate_derived_cost(self):

        thread_manager = ThreadManager(1)
        for theta_index in range(len(self.__theta)):
            thread_manager.attach(derived_cost,
                                  (theta_index, self.__y, self.__x,
                                   self.__theta, self.__predict))

        return thread_manager.execute_all()
コード例 #2
0
def minibatch_error_evaluation_function(y,
                                        x,
                                        theta,
                                        prediction_function,
                                        percentage_to_evaluate=0.3):

    setsize = math.floor(len(y) * percentage_to_evaluate)

    thread_manager = ThreadManager(1)
    for i in range(setsize):
        thread_manager.attach(evaluate_error,
                              (y[i], x[i], theta, prediction_function))

    errors = thread_manager.execute_all()

    error = sum(errors) / setsize

    return error