def measure_error(V, index, kernel_times, delay_indexes, image_indexes, input_to_image, kernel_to_input, h0, h1, h2, ims, ims2): ''' Gives the difference between the value and the prediction ''' return (V[index] - hypothesis(index, kernel_times, delay_indexes, image_indexes, input_to_image, kernel_to_input, h0, h1, h2, ims, ims2))
def calculate_prediction(data_indexes, kernel_times, delay_indexes, image_indexes, input_to_image, kernel_to_input, h0, h1, h2, ims, ims2): ''' returns an array with the predictions for the indexes given in data_indexes ''' prediction = np.zeros(data_indexes.size) # Scale factors # Calculate prediction for index_index, index in enumerate(data_indexes): prediction[index_index] = hypothesis(index, kernel_times, delay_indexes, image_indexes, input_to_image, kernel_to_input, h0, h1, h2, ims, ims2) return prediction