Ошибка нулевого знаменателя Python supersmoother 0,4 ⇐ Python
-
Anonymous
Ошибка нулевого знаменателя Python supersmoother 0,4
I have some time-serial measurement data and I want to fit a smooth curve out of it. I tried to do it with supersmoother package. Below is my code:
from supersmoother import SuperSmoother import numpy as np cx = np.array([0,1,2,3,4]) cy = np.array([.7,.4,.6,.2,.8]) ssmoother = SuperSmoother(alpha=2) ssmoother.fit(cx,cy) ValueError: Zero denominator in linear smooth. This usually indicates that the input contains duplicate points.
However if I try
ssmoother.fit(cy, cx) Then it works. I don't understand why it fails with fit(cx,cy) but not with fit(cy,cx)
I tried to debug it but it seems the failure message comes from the design. But I can't find any explaination on how to avoid this error in the future.
Источник: https://stackoverflow.com/questions/781 ... ator-error
I have some time-serial measurement data and I want to fit a smooth curve out of it. I tried to do it with supersmoother package. Below is my code:
from supersmoother import SuperSmoother import numpy as np cx = np.array([0,1,2,3,4]) cy = np.array([.7,.4,.6,.2,.8]) ssmoother = SuperSmoother(alpha=2) ssmoother.fit(cx,cy) ValueError: Zero denominator in linear smooth. This usually indicates that the input contains duplicate points.
However if I try
ssmoother.fit(cy, cx) Then it works. I don't understand why it fails with fit(cx,cy) but not with fit(cy,cx)
I tried to debug it but it seems the failure message comes from the design. But I can't find any explaination on how to avoid this error in the future.
Источник: https://stackoverflow.com/questions/781 ... ator-error