Exponential curve fitting in SciPy











up vote
23
down vote

favorite
9












I have two NumPy arrays x and y. When I try to fit my data using exponential function and curve_fit (SciPy) with this simple code



#!/usr/bin/env python
from pylab import *
from scipy.optimize import curve_fit

x = np.array([399.75, 989.25, 1578.75, 2168.25, 2757.75, 3347.25, 3936.75, 4526.25, 5115.75, 5705.25])
y = np.array([109,62,39,13,10,4,2,0,1,2])

def func(x, a, b, c, d):
return a*np.exp(b-c*x)+d

popt, pcov = curve_fit(func, x, y)


I get wrong coefficients popt



[a,b,c,d] = [1., 1., 1., 24.19999988]


What is the problem?










share|improve this question
























  • similar question stackoverflow.com/questions/17527869/…
    – Josef
    Jan 29 '14 at 2:54















up vote
23
down vote

favorite
9












I have two NumPy arrays x and y. When I try to fit my data using exponential function and curve_fit (SciPy) with this simple code



#!/usr/bin/env python
from pylab import *
from scipy.optimize import curve_fit

x = np.array([399.75, 989.25, 1578.75, 2168.25, 2757.75, 3347.25, 3936.75, 4526.25, 5115.75, 5705.25])
y = np.array([109,62,39,13,10,4,2,0,1,2])

def func(x, a, b, c, d):
return a*np.exp(b-c*x)+d

popt, pcov = curve_fit(func, x, y)


I get wrong coefficients popt



[a,b,c,d] = [1., 1., 1., 24.19999988]


What is the problem?










share|improve this question
























  • similar question stackoverflow.com/questions/17527869/…
    – Josef
    Jan 29 '14 at 2:54













up vote
23
down vote

favorite
9









up vote
23
down vote

favorite
9






9





I have two NumPy arrays x and y. When I try to fit my data using exponential function and curve_fit (SciPy) with this simple code



#!/usr/bin/env python
from pylab import *
from scipy.optimize import curve_fit

x = np.array([399.75, 989.25, 1578.75, 2168.25, 2757.75, 3347.25, 3936.75, 4526.25, 5115.75, 5705.25])
y = np.array([109,62,39,13,10,4,2,0,1,2])

def func(x, a, b, c, d):
return a*np.exp(b-c*x)+d

popt, pcov = curve_fit(func, x, y)


I get wrong coefficients popt



[a,b,c,d] = [1., 1., 1., 24.19999988]


What is the problem?










share|improve this question















I have two NumPy arrays x and y. When I try to fit my data using exponential function and curve_fit (SciPy) with this simple code



#!/usr/bin/env python
from pylab import *
from scipy.optimize import curve_fit

x = np.array([399.75, 989.25, 1578.75, 2168.25, 2757.75, 3347.25, 3936.75, 4526.25, 5115.75, 5705.25])
y = np.array([109,62,39,13,10,4,2,0,1,2])

def func(x, a, b, c, d):
return a*np.exp(b-c*x)+d

popt, pcov = curve_fit(func, x, y)


I get wrong coefficients popt



[a,b,c,d] = [1., 1., 1., 24.19999988]


What is the problem?







python numpy scipy curve-fitting






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 21 '16 at 20:16









Fermi paradox

2,91452752




2,91452752










asked Jan 29 '14 at 2:14









drastega

65131430




65131430












  • similar question stackoverflow.com/questions/17527869/…
    – Josef
    Jan 29 '14 at 2:54


















  • similar question stackoverflow.com/questions/17527869/…
    – Josef
    Jan 29 '14 at 2:54
















similar question stackoverflow.com/questions/17527869/…
– Josef
Jan 29 '14 at 2:54




similar question stackoverflow.com/questions/17527869/…
– Josef
Jan 29 '14 at 2:54












2 Answers
2






active

oldest

votes

















up vote
36
down vote



accepted










First comment: since a*exp(b - c*x) = (a*exp(b))*exp(-c*x) = A*exp(-c*x), a or b is redundant. I'll drop b and use:



def func(x, a, c, d):
return a*np.exp(-c*x)+d


That isn't the main issue. The problem is simply that curve_fit fails to converge to a solution to this problem when you use the default initial guess (which is all 1s). Check pcov; you'll see that it is inf. This is not surprising, because if c is 1, most of the values of exp(-c*x) underflow to 0:



In [32]: np.exp(-x)
Out[32]:
array([ 2.45912644e-174, 0.00000000e+000, 0.00000000e+000,
0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
0.00000000e+000])


This suggests that c should be small. A better initial guess is, say, p0 = (1, 1e-6, 1). Then I get:



In [36]: popt, pcov = curve_fit(func, x, y, p0=(1, 1e-6, 1))

In [37]: popt
Out[37]: array([ 1.63561656e+02, 9.71142196e-04, -1.16854450e+00])


This looks reasonable:



In [42]: xx = np.linspace(300, 6000, 1000)

In [43]: yy = func(xx, *popt)

In [44]: plot(x, y, 'ko')
Out[44]: [<matplotlib.lines.Line2D at 0x41c5ad0>]

In [45]: plot(xx, yy)
Out[45]: [<matplotlib.lines.Line2D at 0x41c5c10>]


fit plot






share|improve this answer























  • Why do you use -c instead of c? curve_fit can find a negative c if necessary, no?
    – Elliot Gorokhovsky
    Apr 28 '15 at 18:53










  • @RenéG: That's the convention that drastega used in the question.
    – Warren Weckesser
    Apr 29 '15 at 3:20










  • Another approach to initial parameters (using default values, that is) is normalizing x to (approximately) 0—1, e.g., ξ=x/k, estimate a, c' and d and eventually have c=c'/k.
    – gboffi
    Nov 8 at 11:26




















up vote
4
down vote













Firstly I would recommend modifying your equation to a*np.exp(-c*(x-b))+d, otherwise the exponential will always be centered on x=0 which may not always be the case.
You also need to specify reasonable initial conditions (the 4th argument to curve_fit specifies initial conditions for [a,b,c,d]).



This code fits nicely:



from pylab import *
from scipy.optimize import curve_fit

x = np.array([399.75, 989.25, 1578.75, 2168.25, 2757.75, 3347.25, 3936.75, 4526.25, 5115.75, 5705.25])
y = np.array([109,62,39,13,10,4,2,0,1,2])

def func(x, a, b, c, d):
return a*np.exp(-c*(x-b))+d

popt, pcov = curve_fit(func, x, y, [100,400,0.001,0])
print popt

plot(x,y)
x=linspace(400,6000,10000)
plot(x,func(x,*popt))
show()





share|improve this answer



















  • 1




    Where do initial conditions come from?
    – Marcin Zdunek
    Jan 2 '16 at 17:30










  • @MarcinZdunek this was a while ago so I don't remember exactly. The amplitude will have been estimated from the graph. The others may have been determined via trial and error, although the value for c can be estimated too (see the accepted answer of this question)
    – three_pineapples
    Jan 2 '16 at 22:08










  • @MarcinZdunek The default initial values are fine if you normalize both data ranges and afterwards denormalize the estimated parameters...
    – gboffi
    Nov 8 at 11:39











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21420792%2fexponential-curve-fitting-in-scipy%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
36
down vote



accepted










First comment: since a*exp(b - c*x) = (a*exp(b))*exp(-c*x) = A*exp(-c*x), a or b is redundant. I'll drop b and use:



def func(x, a, c, d):
return a*np.exp(-c*x)+d


That isn't the main issue. The problem is simply that curve_fit fails to converge to a solution to this problem when you use the default initial guess (which is all 1s). Check pcov; you'll see that it is inf. This is not surprising, because if c is 1, most of the values of exp(-c*x) underflow to 0:



In [32]: np.exp(-x)
Out[32]:
array([ 2.45912644e-174, 0.00000000e+000, 0.00000000e+000,
0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
0.00000000e+000])


This suggests that c should be small. A better initial guess is, say, p0 = (1, 1e-6, 1). Then I get:



In [36]: popt, pcov = curve_fit(func, x, y, p0=(1, 1e-6, 1))

In [37]: popt
Out[37]: array([ 1.63561656e+02, 9.71142196e-04, -1.16854450e+00])


This looks reasonable:



In [42]: xx = np.linspace(300, 6000, 1000)

In [43]: yy = func(xx, *popt)

In [44]: plot(x, y, 'ko')
Out[44]: [<matplotlib.lines.Line2D at 0x41c5ad0>]

In [45]: plot(xx, yy)
Out[45]: [<matplotlib.lines.Line2D at 0x41c5c10>]


fit plot






share|improve this answer























  • Why do you use -c instead of c? curve_fit can find a negative c if necessary, no?
    – Elliot Gorokhovsky
    Apr 28 '15 at 18:53










  • @RenéG: That's the convention that drastega used in the question.
    – Warren Weckesser
    Apr 29 '15 at 3:20










  • Another approach to initial parameters (using default values, that is) is normalizing x to (approximately) 0—1, e.g., ξ=x/k, estimate a, c' and d and eventually have c=c'/k.
    – gboffi
    Nov 8 at 11:26

















up vote
36
down vote



accepted










First comment: since a*exp(b - c*x) = (a*exp(b))*exp(-c*x) = A*exp(-c*x), a or b is redundant. I'll drop b and use:



def func(x, a, c, d):
return a*np.exp(-c*x)+d


That isn't the main issue. The problem is simply that curve_fit fails to converge to a solution to this problem when you use the default initial guess (which is all 1s). Check pcov; you'll see that it is inf. This is not surprising, because if c is 1, most of the values of exp(-c*x) underflow to 0:



In [32]: np.exp(-x)
Out[32]:
array([ 2.45912644e-174, 0.00000000e+000, 0.00000000e+000,
0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
0.00000000e+000])


This suggests that c should be small. A better initial guess is, say, p0 = (1, 1e-6, 1). Then I get:



In [36]: popt, pcov = curve_fit(func, x, y, p0=(1, 1e-6, 1))

In [37]: popt
Out[37]: array([ 1.63561656e+02, 9.71142196e-04, -1.16854450e+00])


This looks reasonable:



In [42]: xx = np.linspace(300, 6000, 1000)

In [43]: yy = func(xx, *popt)

In [44]: plot(x, y, 'ko')
Out[44]: [<matplotlib.lines.Line2D at 0x41c5ad0>]

In [45]: plot(xx, yy)
Out[45]: [<matplotlib.lines.Line2D at 0x41c5c10>]


fit plot






share|improve this answer























  • Why do you use -c instead of c? curve_fit can find a negative c if necessary, no?
    – Elliot Gorokhovsky
    Apr 28 '15 at 18:53










  • @RenéG: That's the convention that drastega used in the question.
    – Warren Weckesser
    Apr 29 '15 at 3:20










  • Another approach to initial parameters (using default values, that is) is normalizing x to (approximately) 0—1, e.g., ξ=x/k, estimate a, c' and d and eventually have c=c'/k.
    – gboffi
    Nov 8 at 11:26















up vote
36
down vote



accepted







up vote
36
down vote



accepted






First comment: since a*exp(b - c*x) = (a*exp(b))*exp(-c*x) = A*exp(-c*x), a or b is redundant. I'll drop b and use:



def func(x, a, c, d):
return a*np.exp(-c*x)+d


That isn't the main issue. The problem is simply that curve_fit fails to converge to a solution to this problem when you use the default initial guess (which is all 1s). Check pcov; you'll see that it is inf. This is not surprising, because if c is 1, most of the values of exp(-c*x) underflow to 0:



In [32]: np.exp(-x)
Out[32]:
array([ 2.45912644e-174, 0.00000000e+000, 0.00000000e+000,
0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
0.00000000e+000])


This suggests that c should be small. A better initial guess is, say, p0 = (1, 1e-6, 1). Then I get:



In [36]: popt, pcov = curve_fit(func, x, y, p0=(1, 1e-6, 1))

In [37]: popt
Out[37]: array([ 1.63561656e+02, 9.71142196e-04, -1.16854450e+00])


This looks reasonable:



In [42]: xx = np.linspace(300, 6000, 1000)

In [43]: yy = func(xx, *popt)

In [44]: plot(x, y, 'ko')
Out[44]: [<matplotlib.lines.Line2D at 0x41c5ad0>]

In [45]: plot(xx, yy)
Out[45]: [<matplotlib.lines.Line2D at 0x41c5c10>]


fit plot






share|improve this answer














First comment: since a*exp(b - c*x) = (a*exp(b))*exp(-c*x) = A*exp(-c*x), a or b is redundant. I'll drop b and use:



def func(x, a, c, d):
return a*np.exp(-c*x)+d


That isn't the main issue. The problem is simply that curve_fit fails to converge to a solution to this problem when you use the default initial guess (which is all 1s). Check pcov; you'll see that it is inf. This is not surprising, because if c is 1, most of the values of exp(-c*x) underflow to 0:



In [32]: np.exp(-x)
Out[32]:
array([ 2.45912644e-174, 0.00000000e+000, 0.00000000e+000,
0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
0.00000000e+000])


This suggests that c should be small. A better initial guess is, say, p0 = (1, 1e-6, 1). Then I get:



In [36]: popt, pcov = curve_fit(func, x, y, p0=(1, 1e-6, 1))

In [37]: popt
Out[37]: array([ 1.63561656e+02, 9.71142196e-04, -1.16854450e+00])


This looks reasonable:



In [42]: xx = np.linspace(300, 6000, 1000)

In [43]: yy = func(xx, *popt)

In [44]: plot(x, y, 'ko')
Out[44]: [<matplotlib.lines.Line2D at 0x41c5ad0>]

In [45]: plot(xx, yy)
Out[45]: [<matplotlib.lines.Line2D at 0x41c5c10>]


fit plot







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 29 '14 at 3:00

























answered Jan 29 '14 at 2:53









Warren Weckesser

67k792126




67k792126












  • Why do you use -c instead of c? curve_fit can find a negative c if necessary, no?
    – Elliot Gorokhovsky
    Apr 28 '15 at 18:53










  • @RenéG: That's the convention that drastega used in the question.
    – Warren Weckesser
    Apr 29 '15 at 3:20










  • Another approach to initial parameters (using default values, that is) is normalizing x to (approximately) 0—1, e.g., ξ=x/k, estimate a, c' and d and eventually have c=c'/k.
    – gboffi
    Nov 8 at 11:26




















  • Why do you use -c instead of c? curve_fit can find a negative c if necessary, no?
    – Elliot Gorokhovsky
    Apr 28 '15 at 18:53










  • @RenéG: That's the convention that drastega used in the question.
    – Warren Weckesser
    Apr 29 '15 at 3:20










  • Another approach to initial parameters (using default values, that is) is normalizing x to (approximately) 0—1, e.g., ξ=x/k, estimate a, c' and d and eventually have c=c'/k.
    – gboffi
    Nov 8 at 11:26


















Why do you use -c instead of c? curve_fit can find a negative c if necessary, no?
– Elliot Gorokhovsky
Apr 28 '15 at 18:53




Why do you use -c instead of c? curve_fit can find a negative c if necessary, no?
– Elliot Gorokhovsky
Apr 28 '15 at 18:53












@RenéG: That's the convention that drastega used in the question.
– Warren Weckesser
Apr 29 '15 at 3:20




@RenéG: That's the convention that drastega used in the question.
– Warren Weckesser
Apr 29 '15 at 3:20












Another approach to initial parameters (using default values, that is) is normalizing x to (approximately) 0—1, e.g., ξ=x/k, estimate a, c' and d and eventually have c=c'/k.
– gboffi
Nov 8 at 11:26






Another approach to initial parameters (using default values, that is) is normalizing x to (approximately) 0—1, e.g., ξ=x/k, estimate a, c' and d and eventually have c=c'/k.
– gboffi
Nov 8 at 11:26














up vote
4
down vote













Firstly I would recommend modifying your equation to a*np.exp(-c*(x-b))+d, otherwise the exponential will always be centered on x=0 which may not always be the case.
You also need to specify reasonable initial conditions (the 4th argument to curve_fit specifies initial conditions for [a,b,c,d]).



This code fits nicely:



from pylab import *
from scipy.optimize import curve_fit

x = np.array([399.75, 989.25, 1578.75, 2168.25, 2757.75, 3347.25, 3936.75, 4526.25, 5115.75, 5705.25])
y = np.array([109,62,39,13,10,4,2,0,1,2])

def func(x, a, b, c, d):
return a*np.exp(-c*(x-b))+d

popt, pcov = curve_fit(func, x, y, [100,400,0.001,0])
print popt

plot(x,y)
x=linspace(400,6000,10000)
plot(x,func(x,*popt))
show()





share|improve this answer



















  • 1




    Where do initial conditions come from?
    – Marcin Zdunek
    Jan 2 '16 at 17:30










  • @MarcinZdunek this was a while ago so I don't remember exactly. The amplitude will have been estimated from the graph. The others may have been determined via trial and error, although the value for c can be estimated too (see the accepted answer of this question)
    – three_pineapples
    Jan 2 '16 at 22:08










  • @MarcinZdunek The default initial values are fine if you normalize both data ranges and afterwards denormalize the estimated parameters...
    – gboffi
    Nov 8 at 11:39















up vote
4
down vote













Firstly I would recommend modifying your equation to a*np.exp(-c*(x-b))+d, otherwise the exponential will always be centered on x=0 which may not always be the case.
You also need to specify reasonable initial conditions (the 4th argument to curve_fit specifies initial conditions for [a,b,c,d]).



This code fits nicely:



from pylab import *
from scipy.optimize import curve_fit

x = np.array([399.75, 989.25, 1578.75, 2168.25, 2757.75, 3347.25, 3936.75, 4526.25, 5115.75, 5705.25])
y = np.array([109,62,39,13,10,4,2,0,1,2])

def func(x, a, b, c, d):
return a*np.exp(-c*(x-b))+d

popt, pcov = curve_fit(func, x, y, [100,400,0.001,0])
print popt

plot(x,y)
x=linspace(400,6000,10000)
plot(x,func(x,*popt))
show()





share|improve this answer



















  • 1




    Where do initial conditions come from?
    – Marcin Zdunek
    Jan 2 '16 at 17:30










  • @MarcinZdunek this was a while ago so I don't remember exactly. The amplitude will have been estimated from the graph. The others may have been determined via trial and error, although the value for c can be estimated too (see the accepted answer of this question)
    – three_pineapples
    Jan 2 '16 at 22:08










  • @MarcinZdunek The default initial values are fine if you normalize both data ranges and afterwards denormalize the estimated parameters...
    – gboffi
    Nov 8 at 11:39













up vote
4
down vote










up vote
4
down vote









Firstly I would recommend modifying your equation to a*np.exp(-c*(x-b))+d, otherwise the exponential will always be centered on x=0 which may not always be the case.
You also need to specify reasonable initial conditions (the 4th argument to curve_fit specifies initial conditions for [a,b,c,d]).



This code fits nicely:



from pylab import *
from scipy.optimize import curve_fit

x = np.array([399.75, 989.25, 1578.75, 2168.25, 2757.75, 3347.25, 3936.75, 4526.25, 5115.75, 5705.25])
y = np.array([109,62,39,13,10,4,2,0,1,2])

def func(x, a, b, c, d):
return a*np.exp(-c*(x-b))+d

popt, pcov = curve_fit(func, x, y, [100,400,0.001,0])
print popt

plot(x,y)
x=linspace(400,6000,10000)
plot(x,func(x,*popt))
show()





share|improve this answer














Firstly I would recommend modifying your equation to a*np.exp(-c*(x-b))+d, otherwise the exponential will always be centered on x=0 which may not always be the case.
You also need to specify reasonable initial conditions (the 4th argument to curve_fit specifies initial conditions for [a,b,c,d]).



This code fits nicely:



from pylab import *
from scipy.optimize import curve_fit

x = np.array([399.75, 989.25, 1578.75, 2168.25, 2757.75, 3347.25, 3936.75, 4526.25, 5115.75, 5705.25])
y = np.array([109,62,39,13,10,4,2,0,1,2])

def func(x, a, b, c, d):
return a*np.exp(-c*(x-b))+d

popt, pcov = curve_fit(func, x, y, [100,400,0.001,0])
print popt

plot(x,y)
x=linspace(400,6000,10000)
plot(x,func(x,*popt))
show()






share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 2 '16 at 22:05

























answered Jan 29 '14 at 2:51









three_pineapples

8,90132447




8,90132447








  • 1




    Where do initial conditions come from?
    – Marcin Zdunek
    Jan 2 '16 at 17:30










  • @MarcinZdunek this was a while ago so I don't remember exactly. The amplitude will have been estimated from the graph. The others may have been determined via trial and error, although the value for c can be estimated too (see the accepted answer of this question)
    – three_pineapples
    Jan 2 '16 at 22:08










  • @MarcinZdunek The default initial values are fine if you normalize both data ranges and afterwards denormalize the estimated parameters...
    – gboffi
    Nov 8 at 11:39














  • 1




    Where do initial conditions come from?
    – Marcin Zdunek
    Jan 2 '16 at 17:30










  • @MarcinZdunek this was a while ago so I don't remember exactly. The amplitude will have been estimated from the graph. The others may have been determined via trial and error, although the value for c can be estimated too (see the accepted answer of this question)
    – three_pineapples
    Jan 2 '16 at 22:08










  • @MarcinZdunek The default initial values are fine if you normalize both data ranges and afterwards denormalize the estimated parameters...
    – gboffi
    Nov 8 at 11:39








1




1




Where do initial conditions come from?
– Marcin Zdunek
Jan 2 '16 at 17:30




Where do initial conditions come from?
– Marcin Zdunek
Jan 2 '16 at 17:30












@MarcinZdunek this was a while ago so I don't remember exactly. The amplitude will have been estimated from the graph. The others may have been determined via trial and error, although the value for c can be estimated too (see the accepted answer of this question)
– three_pineapples
Jan 2 '16 at 22:08




@MarcinZdunek this was a while ago so I don't remember exactly. The amplitude will have been estimated from the graph. The others may have been determined via trial and error, although the value for c can be estimated too (see the accepted answer of this question)
– three_pineapples
Jan 2 '16 at 22:08












@MarcinZdunek The default initial values are fine if you normalize both data ranges and afterwards denormalize the estimated parameters...
– gboffi
Nov 8 at 11:39




@MarcinZdunek The default initial values are fine if you normalize both data ranges and afterwards denormalize the estimated parameters...
– gboffi
Nov 8 at 11:39


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21420792%2fexponential-curve-fitting-in-scipy%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()