【发布时间】:2022-01-03 16:01:13
【问题描述】:
【问题讨论】:
-
首先编写没有优化的函数,然后看看是否可以使用 0 到 168 之间的 t 值来计算函数。展示你的尝试。可能是 t168 可以使用 t0 来定义,即 fct (n) = transform from fct(n-168)
标签: python machine-learning scikit-learn regression
【问题讨论】:
标签: python machine-learning scikit-learn regression
试试这个:
from math import cos, pi
def f(t, a, b, m):
# t is a number
# a is a list of 5 numbers
# b and m are lists of 4 numbers
return a[0] + sum(a[i + 1] * cos((t / m[i] + b[i] / 24) * 2 * pi)
for i in range(4))
现在你可以计算你的函数了:
>>> a = [10, 11, 11, 12, 12]
>>> b = [1, 2, 3, 4]
>>> m = [12, 24, 168, 672]
>>> f(170, a, b, m)
15.671777368560361
【讨论】: