Horje
scipy.optimize.curve_fit 3D Code Example
scipy.optimize.curve_fit 3D
# The first argument to func must be the data (both x and y).
# The rest of the arguments to func represent the parameters.

# The first argument to curve_fit is the function.
# The second argument is the independent data (x and y in the form of one array).
# The third argument is the dependent data (z).
# The fourth argument is a guess for the value of the parameters (a and b in this case.)

import scipy.optimize as optimize
import numpy as np

A = np.array([(19,20,24), (10,40,28), (10,50,31)])

def func(data, a, b):
    return data[:,0]*data[:,1]*a + b

guess = (1,1)
params, pcov = optimize.curve_fit(func, A[:,:2], A[:,2], guess)
print(params)
# [ 0.04919355  6.67741935]




Python

Related
find each geometry overlap python Code Example find each geometry overlap python Code Example
factors of a number with memoization Code Example factors of a number with memoization Code Example
styling  filter form django Code Example styling filter form django Code Example
clase describe algo Code Example clase describe algo Code Example
filter query objects by date range in Django Code Example filter query objects by date range in Django Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7