使用 python 绘制 SN 曲线(非线性回归模型)
plot SN curve (non-linear regression model) using python
输入数据和函数形式已知。您必须找出函数的系数。这些需要确定的系数的值也是已知的(60.351、4.388、4.806)。在编写代码时,我受到以下启发:
唯一的区别在于输入数据和函数定义。
xData = numpy.array([1, 23385, 35800, 63699, 106798, 222064, 4272000, 20296, 461351, 175300, 11815])
yData = numpy.array([198.9, 112.2, 100.3, 89.8, 80.3, 69.8, 60.8, 120.1, 65.3, 74.9, 127.7])
def func(x, a, b, Offset): # Sigmoid A With Offset from zunzun.com
return Offset + 139.0/ ((numpy.exp((log10(x))/a))**b)
我认为在使用 log10() 函数时初始参数存在一些问题。
错误如下:
error capture
经过多次搜索([Whosebug[1]),我重新定义了函数:
Offset + 139.0/ ((numpy.exp(np.log10(np.abs(x))/a))**b)
像 math.log10() 这样的非 numpy 函数不能很好地处理 numpy 数组
输入数据和函数形式已知。您必须找出函数的系数。这些需要确定的系数的值也是已知的(60.351、4.388、4.806)。在编写代码时,我受到以下启发:
xData = numpy.array([1, 23385, 35800, 63699, 106798, 222064, 4272000, 20296, 461351, 175300, 11815])
yData = numpy.array([198.9, 112.2, 100.3, 89.8, 80.3, 69.8, 60.8, 120.1, 65.3, 74.9, 127.7])
def func(x, a, b, Offset): # Sigmoid A With Offset from zunzun.com
return Offset + 139.0/ ((numpy.exp((log10(x))/a))**b)
我认为在使用 log10() 函数时初始参数存在一些问题。 错误如下: error capture
经过多次搜索([Whosebug[1]),我重新定义了函数:
Offset + 139.0/ ((numpy.exp(np.log10(np.abs(x))/a))**b)
像 math.log10() 这样的非 numpy 函数不能很好地处理 numpy 数组