Вы можете использовать curve_fit
( документы ).Обратите внимание, как вы помещаете вход и выход в векторы:
from scipy.optimize import curve_fit
import numpy as np
sigma_x=3
sigma_y=3
sigma_z=3
def f(curr_location, x_my, y_my, z_my):
curr_location_x, curr_location_y, curr_location_z = curr_location
return np.exp(-((((curr_location_x - x_my) * (curr_location_x - x_my))
/ (2*sigma_x * sigma_x)) + (((curr_location_y - y_my)
*(curr_location_y - y_my)) / (2 * sigma_y * sigma_y)) +
(((curr_location_z - z_my) *(curr_location_z - z_my)) /
(2 * sigma_z * sigma_z))))
curr_location_values = [[3,3,3,], [4,4,4], [6,6,6]]
output_values = [0.4, 0.3, 0.24]
popt, pcov = curve_fit(f, curr_location_values, output_values)
popt
>> array([2.99570375, 2.38445522, 1.7246244 ])