- Posts: 210
TypeError with the python script do_fit.py
- Hot
- Topic Author
- Visitor
4 years 4 months ago #8363
by Hot
TypeError with the python script do_fit.py was created by Hot
I am doing CG simulation and initial guess for angle bending parameters,according to
http://cgmartini.nl/index.php/tutorials-general-introduction-gmx5/bilayers-gmx5#Adv-refinehttp://cgmartini.nl/index.php/tutorials-general-introduction-gmx5/bilayers-gmx5#Adv-refine
.
The python script do_fit.py was used, and the command is as follows:
python do_fit.py -f ANGLES/cga_0-distr.xvg -x0 100 -k 400 --harmonic --radians
Returned results:
Parameter Value Standard Deviation
par_0 1.055004e+02 4.039648e-01
par_1 8.000000e+02 1.338068e+02
Status message CONVERGENCE: NORM_OF_PROJECTED_GRADIENT_<=_PGTOL
Number of iterations 4
Objective <symfit.core.objectives.LeastSquares object at 0x2ae29ab84810>
Minimizer <symfit.core.minimizers.LBFGSB object at 0x2ae29ab67650>
Goodness of fit qualifiers:
chi_squared 0.631567762071
objective_value 0.315783881035
r_squared 0.679987456214
Traceback (most recent call last):
File "do_fit.py", line 135, in <module>
plt.plot(xs, model(x=xs, **result.params), color='r')
File "/home/stjt/miniconda3/envs/do-fit/lib/python2.7/site-packages/symfit/core/operators.py", line 90, in call
bound_arguments = signature.bind(*values, **relevant_named_values)
File "/home/stjt/miniconda3/envs/do-fit/lib/python2.7/site-packages/funcsigs/__init__.py", line 792, in bind
return args[0]._bind(args[1:], kwargs)
File "/home/stjt/miniconda3/envs/do-fit/lib/python2.7/site-packages/funcsigs/__init__.py", line 717, in _bind
raise TypeError(msg)
TypeError: 'var_0' parameter lacking default value
Where need to modify?
The python script do_fit.py was used, and the command is as follows:
python do_fit.py -f ANGLES/cga_0-distr.xvg -x0 100 -k 400 --harmonic --radians
Returned results:
Parameter Value Standard Deviation
par_0 1.055004e+02 4.039648e-01
par_1 8.000000e+02 1.338068e+02
Status message CONVERGENCE: NORM_OF_PROJECTED_GRADIENT_<=_PGTOL
Number of iterations 4
Objective <symfit.core.objectives.LeastSquares object at 0x2ae29ab84810>
Minimizer <symfit.core.minimizers.LBFGSB object at 0x2ae29ab67650>
Goodness of fit qualifiers:
chi_squared 0.631567762071
objective_value 0.315783881035
r_squared 0.679987456214
Traceback (most recent call last):
File "do_fit.py", line 135, in <module>
plt.plot(xs, model(x=xs, **result.params), color='r')
File "/home/stjt/miniconda3/envs/do-fit/lib/python2.7/site-packages/symfit/core/operators.py", line 90, in call
bound_arguments = signature.bind(*values, **relevant_named_values)
File "/home/stjt/miniconda3/envs/do-fit/lib/python2.7/site-packages/funcsigs/__init__.py", line 792, in bind
return args[0]._bind(args[1:], kwargs)
File "/home/stjt/miniconda3/envs/do-fit/lib/python2.7/site-packages/funcsigs/__init__.py", line 717, in _bind
raise TypeError(msg)
TypeError: 'var_0' parameter lacking default value
Where need to modify?
Please Log in or Create an account to join the conversation.
- peterkroon
- Offline
- Gold Boarder
Less
More
4 years 4 months ago #8365
by peterkroon
Replied by peterkroon on topic TypeError with the python script do_fit.py
Hi,
to be honest, I haven't looked at or maintained that script in quite some time.
First, upgrade to Python3. After January 1 2020 Python2 will no longer be supported by anyone in the world.
Then, for the script:
In lines 110-112:Should be:
Line 135:should be
Let me know if it works, so I can update the tutorial files.
to be honest, I haven't looked at or maintained that script in quite some time.
First, upgrade to Python3. After January 1 2020 Python2 will no longer be supported by anyone in the world.
Then, for the script:
In lines 110-112:
x = Variable() * args.factor
x0 = Parameter(value=args.x0, min=np.min(xs), max=np.max(xs)) * args.factor
k = Parameter(value=args.k, min=args.mink, max=args.maxk)
x = Variable('x') * args.factor
x0 = Parameter('x0', value=args.x0, min=np.min(xs), max=np.max(xs)) * args.factor
k = Parameter('k', value=args.k, min=args.mink, max=args.maxk)
Line 135:
plt.plot(xs, model(x=xs, **result.params), color='r')
plt.plot(xs, model(x=xs, **result.params)[0], color='r')
Let me know if it works, so I can update the tutorial files.
Please Log in or Create an account to join the conversation.
- Hot
- Topic Author
- Visitor
4 years 4 months ago #8366
by Hot
Replied by Hot on topic TypeError with the python script do_fit.py
I have modified the script following your prompt,and run it with Python2 and Python3 respectively. The error still exists.
Python2:
/home/miniconda3/envs/do-fit/lib/python2.7/site-packages/symfit/core/fit_results.py:114: RuntimeWarning: invalid value encountered in sqrt
return np.sqrt(self.variance(param))
Parameter Value Standard Deviation
par_0 9.800000e+01 nan
par_1 5.000000e+01 3.055364e+01
Status message CONVERGENCE: NORM_OF_PROJECTED_GRADIENT_<=_PGTOL
Number of iterations 2
Objective <symfit.core.objectives.LeastSquares object at 0x2b15e24577d0>
Minimizer <symfit.core.minimizers.LBFGSB object at 0x2b15e243b610>
Goodness of fit qualifiers:
chi_squared 5.44559526318
objective_value 2.72279763159
r_squared -1.75925862157
Traceback (most recent call last):
File "do_fit.py", line 135, in <module>
plt.plot(xs, model(x=xs, **result.params), color='r')
File "/home/stjt/miniconda3/envs/do-fit/lib/python2.7/site-packages/symfit/core/operators.py", line 90, in call
bound_arguments = signature.bind(*values, **relevant_named_values)
File "/home/stjt/miniconda3/envs/do-fit/lib/python2.7/site-packages/funcsigs/__init__.py", line 792, in bind
return args[0]._bind(args[1:], kwargs)
File "/home/stjt/miniconda3/envs/do-fit/lib/python2.7/site-packages/funcsigs/__init__.py", line 717, in _bind
raise TypeError(msg)
TypeError: 'var_0' parameter lacking default value
Python3:
do_fit.py:92: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
if 'n' not in inspect.getargspec(args.func).args and hasattr(args, 'n'):
do_fit.py:95: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
if not hasattr(args, 'n') and 'n' in inspect.getargspec(args.func).args:
do_fit.py:110: DeprecationWarning: It is recommended to provide names to Variable explicitly as automatic generation of names will be dropped in future `symfit` versions.
x = Variable() * args.factor
qt.qpa.xcb: QXcbConnection: XCB error: 145 (Unknown), sequence: 177, resource id: 0, major code: 139 (Unknown), minor code: 20
/home/stjt/miniconda3/lib/python3.7/site-packages/symfit/core/fit_results.py:114: RuntimeWarning: invalid value encountered in sqrt
return np.sqrt(self.variance(param))
Parameter Value Standard Deviation
par_0 9.800000e+01 nan
par_1 5.000000e+01 3.055364e+01
Status message b'CONVERGENCE: NORM_OF_PROJECTED_GRADIENT_<=_PGTOL'
Number of iterations 2
Objective <symfit.core.objectives.LeastSquares object at 0x2aca22deaf90>
Minimizer <symfit.core.minimizers.LBFGSB object at 0x2aca22deaad0>
Goodness of fit qualifiers:
chi_squared 5.4455952631815085
objective_value 2.7227976315907543
r_squared -1.759258621573057
Traceback (most recent call last):
File "do_fit.py", line 135, in <module>
plt.plot(xs, model(x=xs, **result.params), color='r')
File "/home/stjt/miniconda3/lib/python3.7/site-packages/symfit/core/operators.py", line 90, in call
bound_arguments = signature.bind(*values, **relevant_named_values)
File "/home/stjt/miniconda3/lib/python3.7/inspect.py", line 3015, in bind
return args[0]._bind(args[1:], kwargs)
File "/home/stjt/miniconda3/lib/python3.7/inspect.py", line 2930, in _bind
raise TypeError(msg) from None
TypeError: missing a required argument: 'var_0'
Python2:
/home/miniconda3/envs/do-fit/lib/python2.7/site-packages/symfit/core/fit_results.py:114: RuntimeWarning: invalid value encountered in sqrt
return np.sqrt(self.variance(param))
Parameter Value Standard Deviation
par_0 9.800000e+01 nan
par_1 5.000000e+01 3.055364e+01
Status message CONVERGENCE: NORM_OF_PROJECTED_GRADIENT_<=_PGTOL
Number of iterations 2
Objective <symfit.core.objectives.LeastSquares object at 0x2b15e24577d0>
Minimizer <symfit.core.minimizers.LBFGSB object at 0x2b15e243b610>
Goodness of fit qualifiers:
chi_squared 5.44559526318
objective_value 2.72279763159
r_squared -1.75925862157
Traceback (most recent call last):
File "do_fit.py", line 135, in <module>
plt.plot(xs, model(x=xs, **result.params), color='r')
File "/home/stjt/miniconda3/envs/do-fit/lib/python2.7/site-packages/symfit/core/operators.py", line 90, in call
bound_arguments = signature.bind(*values, **relevant_named_values)
File "/home/stjt/miniconda3/envs/do-fit/lib/python2.7/site-packages/funcsigs/__init__.py", line 792, in bind
return args[0]._bind(args[1:], kwargs)
File "/home/stjt/miniconda3/envs/do-fit/lib/python2.7/site-packages/funcsigs/__init__.py", line 717, in _bind
raise TypeError(msg)
TypeError: 'var_0' parameter lacking default value
Python3:
do_fit.py:92: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
if 'n' not in inspect.getargspec(args.func).args and hasattr(args, 'n'):
do_fit.py:95: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
if not hasattr(args, 'n') and 'n' in inspect.getargspec(args.func).args:
do_fit.py:110: DeprecationWarning: It is recommended to provide names to Variable explicitly as automatic generation of names will be dropped in future `symfit` versions.
x = Variable() * args.factor
qt.qpa.xcb: QXcbConnection: XCB error: 145 (Unknown), sequence: 177, resource id: 0, major code: 139 (Unknown), minor code: 20
/home/stjt/miniconda3/lib/python3.7/site-packages/symfit/core/fit_results.py:114: RuntimeWarning: invalid value encountered in sqrt
return np.sqrt(self.variance(param))
Parameter Value Standard Deviation
par_0 9.800000e+01 nan
par_1 5.000000e+01 3.055364e+01
Status message b'CONVERGENCE: NORM_OF_PROJECTED_GRADIENT_<=_PGTOL'
Number of iterations 2
Objective <symfit.core.objectives.LeastSquares object at 0x2aca22deaf90>
Minimizer <symfit.core.minimizers.LBFGSB object at 0x2aca22deaad0>
Goodness of fit qualifiers:
chi_squared 5.4455952631815085
objective_value 2.7227976315907543
r_squared -1.759258621573057
Traceback (most recent call last):
File "do_fit.py", line 135, in <module>
plt.plot(xs, model(x=xs, **result.params), color='r')
File "/home/stjt/miniconda3/lib/python3.7/site-packages/symfit/core/operators.py", line 90, in call
bound_arguments = signature.bind(*values, **relevant_named_values)
File "/home/stjt/miniconda3/lib/python3.7/inspect.py", line 3015, in bind
return args[0]._bind(args[1:], kwargs)
File "/home/stjt/miniconda3/lib/python3.7/inspect.py", line 2930, in _bind
raise TypeError(msg) from None
TypeError: missing a required argument: 'var_0'
Please Log in or Create an account to join the conversation.
- peterkroon
- Offline
- Gold Boarder
Less
More
- Posts: 210
4 years 4 months ago #8371
by peterkroon
Replied by peterkroon on topic TypeError with the python script do_fit.py
Interesting :)
While I start digging, could you get me the output of?
And could you double check you made all the modifications?still looks like the old code.
While I start digging, could you get me the output of
pip show symfit
And could you double check you made all the modifications?
File "do_fit.py", line 135, in <module>
plt.plot(xs, model(x=xs, **result.params), color='r')
Please Log in or Create an account to join the conversation.
- peterkroon
- Offline
- Gold Boarder
Less
More
- Posts: 210
4 years 4 months ago #8372
by peterkroon
Replied by peterkroon on topic TypeError with the python script do_fit.py
Ok, I made some modifications and get the following output:
And for Python2:
The changes I made:
Could you give these a try? If this doesn't work for you there's something very strange going on, and I'll have to dig deeper. If it works for you I'll update the tutorial.
$ python3 -V
Python 3.6.8
$ pip3 show symfit
Name: symfit
Version: 0.5.2
...
$ python3 do_fit.py -f ANGLES/cga_0-distr.xvg -x0 135 -k 35 --harmonic --radians
Parameter Value Standard Deviation
k 1.878271e+01 4.340405e-01
x0 1.317686e+02 2.847421e-01
Status message b'CONVERGENCE: REL_REDUCTION_OF_F_<=_FACTR*EPSMCH'
Number of iterations 10
Objective <symfit.core.objectives.LeastSquares object at 0x7feff9425a58>
Minimizer <symfit.core.minimizers.LBFGSB object at 0x7feff942eba8>
Goodness of fit qualifiers:
chi_squared 0.4169061723299059
objective_value 0.20845308616495295
r_squared 0.9715937509657963
$ python2 -V
Python 2.7.15+
$ pip2 show symfit
Name: symfit
Version: 0.5.2
...
$ python2 do_fit.py -f ANGLES/cga_0-distr.xvg -x0 135 -k 35 --harmonic --radians
Parameter Value Standard Deviation
k 1.878271e+01 4.340405e-01
x0 1.317686e+02 2.847421e-01
Status message CONVERGENCE: REL_REDUCTION_OF_F_<=_FACTR*EPSMCH
Number of iterations 10
Objective <symfit.core.objectives.LeastSquares object at 0x7f373456f350>
Minimizer <symfit.core.minimizers.LBFGSB object at 0x7f375fb9fcd0>
Goodness of fit qualifiers:
chi_squared 0.41690617233
objective_value 0.208453086165
r_squared 0.971593750966
The changes I made:
$ diff do_fit_original.py do_fit.py
8c8
< from symfit.api import exp, cos, Variable, Parameter, Fit
---
> from symfit import exp, cos, Variable, Parameter, Fit, Model
110,112c110,113
< x = Variable() * args.factor
< x0 = Parameter(value=args.x0, min=np.min(xs), max=np.max(xs)) * args.factor
< k = Parameter(value=args.k, min=args.mink, max=args.maxk)
---
> y = Variable('y')
> x = Variable('x') * args.factor
> x0 = Parameter('x0', value=args.x0, min=np.min(xs), max=np.max(xs)) * args.factor
> k = Parameter('k', value=args.k, min=args.mink, max=args.maxk)
117c118
< n = Parameter(value=args.n, min=0, max=args.n * 2, fixed=True)
---
> n = Parameter('n', value=args.n, min=0, max=args.n * 2, fixed=True)
122c123
< model = harmonic_distribution(**argument_dict)
---
> model = Model({y: harmonic_distribution(**argument_dict)})
124c125
< guess = symfit.contrib.interactive_guess.interactive_guess.InteractiveGuess2D(model, xs, ys)
---
> guess = symfit.contrib.interactive_guess.interactive_guess.InteractiveGuess2D(model, x=xs, y=ys)
129c130
< fit = Fit(model, xs, ys)
---
> fit = Fit(model, x=xs, y=ys)
135c136
< plt.plot(xs, model(x=xs, **result.params), color='r')
---
> plt.plot(xs, model(x=xs, **result.params).y, color='r')
Could you give these a try? If this doesn't work for you there's something very strange going on, and I'll have to dig deeper. If it works for you I'll update the tutorial.
Please Log in or Create an account to join the conversation.
- Hot
- Topic Author
- Visitor
4 years 4 months ago #8373
by Hot
Replied by Hot on topic TypeError with the python script do_fit.py
I have modified do-fit.py and get the output:
symfit 0.5.2
Python3.7.3
do_fit.py:92: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
if 'n' not in inspect.getargspec(args.func).args and hasattr(args, 'n'):
do_fit.py:95: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
if not hasattr(args, 'n') and 'n' in inspect.getargspec(args.func).args:
Traceback (most recent call last):
File "do_fit.py", line 122, in <module>
model = Model({y: harmonic_distribution(**argument_dict)})
File "do_fit.py", line 43, in boltzmann
return exp(-V(*args, **kwargs)/kbT)
File "do_fit.py", line 47, in harmonic
return 0.5 * k * (x - x0)**2
TypeError: unsupported operand type(s) for *: 'float' and '_StoreAction'
Python2.7
Traceback (most recent call last):
File "do_fit.py", line 122, in <module>
model = Model({y: harmonic_distribution(**argument_dict)})
File "do_fit.py", line 43, in boltzmann
return exp(-V(*args, **kwargs)/kbT)
File "do_fit.py", line 47, in harmonic
return 0.5 * k * (x - x0)**2
TypeError: unsupported operand type(s) for *: 'float' and '_StoreAction'
The result is different from yours. I don't know what the problem is.
symfit 0.5.2
Python3.7.3
do_fit.py:92: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
if 'n' not in inspect.getargspec(args.func).args and hasattr(args, 'n'):
do_fit.py:95: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
if not hasattr(args, 'n') and 'n' in inspect.getargspec(args.func).args:
Traceback (most recent call last):
File "do_fit.py", line 122, in <module>
model = Model({y: harmonic_distribution(**argument_dict)})
File "do_fit.py", line 43, in boltzmann
return exp(-V(*args, **kwargs)/kbT)
File "do_fit.py", line 47, in harmonic
return 0.5 * k * (x - x0)**2
TypeError: unsupported operand type(s) for *: 'float' and '_StoreAction'
Python2.7
Traceback (most recent call last):
File "do_fit.py", line 122, in <module>
model = Model({y: harmonic_distribution(**argument_dict)})
File "do_fit.py", line 43, in boltzmann
return exp(-V(*args, **kwargs)/kbT)
File "do_fit.py", line 47, in harmonic
return 0.5 * k * (x - x0)**2
TypeError: unsupported operand type(s) for *: 'float' and '_StoreAction'
The result is different from yours. I don't know what the problem is.
Please Log in or Create an account to join the conversation.
- peterkroon
- Offline
- Gold Boarder
Less
More
- Posts: 210
4 years 4 months ago #8381
by peterkroon
Replied by peterkroon on topic TypeError with the python script do_fit.py
Very strange.
It also works for me on Python 3.7.4 (although I do get the deprecation warning about inspect.signature).
Could you try `pip install --force-reinstall symfit matplotlib`? My guess is your sympy version got too old (1.4 here; `pip show sympy`).
I'll put my full code below, just to be sure.
It also works for me on Python 3.7.4 (although I do get the deprecation warning about inspect.signature).
Could you try `pip install --force-reinstall symfit matplotlib`? My guess is your sympy version got too old (1.4 here; `pip show sympy`).
I'll put my full code below, just to be sure.
Warning: Spoiler!
[ Click to expand ]
[ Click to hide ]
from symfit import exp, cos, Variable, Parameter, Fit, Model
import symfit.contrib
import numpy as np
import functools
import matplotlib.pyplot as plt
import argparse
import os
import inspect
kb = 8.3144621e-3 # kJ/mol/K
T = 298
def read_xvg(file_name):
#return np.loadtxt(file_name, comments = '@', dtype=np.float)
#Let's assume simply tabulated data for now (x y\nx y\nx y...)
data = []
comment_chars = ('#', '@')
with open(file_name, 'r') as file_handle:
for line in file_handle:
line = split_comments(line, comment_chars)[0].strip()
if not line:
continue
data.append(list(map(float, line.split())))
return np.array(data, dtype=float)
def split_comments(line, comment_chars):
find = lambda char: (line.find(char), char) if char in line else (len(line), char)
comment_start, char = min(map(find, comment_chars), key=lambda x: x[0])
return line[:comment_start], line[comment_start + len(char):]
def boltzmann(T, V, *args, **kwargs):
kbT = kb * T
return exp(-V(*args, **kwargs)/kbT)
def harmonic(x, x0, k):
return 0.5 * k * (x - x0)**2
def periodic(x, x0, k, n):
return k*(1+cos(n*x - x0))
funcs = {'harmonic': harmonic, 'periodic': periodic}
def file_readable(file):
if not os.access(file, os.F_OK | os.R_OK):
raise argparse.ArgumentTypeError("{} is not readable or does not exist.".format(file))
return file
parser = argparse.ArgumentParser(description="Fit a function to data.")
parser.add_argument('-f', help='(input) XVG file containing the data to fit to',
required=True, metavar='data.xvg', type=file_readable, dest='xvg_file')
function_group = parser.add_mutually_exclusive_group(required=True)
function_group.add_argument('--harmonic', help='use an harmonic functional (V(x) = 0.5 * k * (x - x0)**2)', action='store_const', const=harmonic, dest='func')
function_group.add_argument('--periodic', help='use an periodic functional (V(x) = k * (1 + cos(n*x - x0)))', action='store_const', const=periodic, dest='func')
x0 = parser.add_argument('-x0', help='equilibrium value.', required=True,
type=float, dest='x0')
k = parser.add_argument('-k', help='force constant.', required=True,
type=float, dest='k')
parser.add_argument('-mink', help='(opt.) minimum value allowed for k.', required=False, default=0, type=float, metavar=0)
parser.add_argument('-maxk', help='(opt.) maximum value allowed for k.', required=False, default=None, type=float, metavar='2*k')
n = parser.add_argument('-n', help='(opt.) periodicity for periodic function.',
required=False, type=int, dest='n', metavar=1)
parser.add_argument('--radians', '-rad', help='(opt.) specify whether x0 and the x-axis in your data should be converted to radians. This is usually the case for all angles.',
required=False, action='store_const', const=np.pi/180, default=1, dest='factor')
parser.add_argument('-T', help='(opt.) temperature (K).',
required=False, default=298, type=float, dest='T', metavar=298)
args = parser.parse_args()
if args.maxk is None:
args.maxk = args.k * 2
if args.n is None:
del args.n
if 'n' not in inspect.getargspec(args.func).args and hasattr(args, 'n'):
raise argparse.ArgumentError(n, 'This function type does not accept -n.')
if not hasattr(args, 'n') and 'n' in inspect.getargspec(args.func).args:
args.n = 1
data = read_xvg(args.xvg_file)
xs = data[:, 0]
ys = data[:, 1]
ys = ys/np.max(ys) # Normalize data
harmonic_distribution = functools.partial(boltzmann, args.T, args.func)
argument_dict = {}
y = Variable('y')
x = Variable('x') * args.factor
x0 = Parameter('x0', value=args.x0, min=np.min(xs), max=np.max(xs)) * args.factor
k = Parameter('k', value=args.k, min=args.mink, max=args.maxk)
argument_dict['x'] = x
argument_dict['x0'] = x0
argument_dict['k'] = k
if hasattr(args, 'n'):
n = Parameter('n', value=args.n, min=0, max=args.n * 2, fixed=True)
argument_dict['n'] = n
model = Model({y: harmonic_distribution(**argument_dict)})
#fit = fitter.InteractiveFit2D(model, xs, ys)
guess = symfit.contrib.interactive_guess.interactive_guess.InteractiveGuess2D(model, x=xs, y=ys)
#fit.visual_guess(1000)
#result = fit.execute(maxfev=1000)
result = guess.execute()
fit = Fit(model, x=xs, y=ys)
result = fit.execute()
print(result)
plt.scatter(xs, ys, color='b')
plt.plot(xs, model(x=xs, **result.params).y, color='r')
plt.show()
Please Log in or Create an account to join the conversation.
Time to create page: 0.112 seconds