Closed SebastianHD closed 5 years ago
Nevermind. I understand the issue. It just looks like that because the break is between two data points.
x2 = np.linspace(0,2,100)
plt.plot(x,y,'o')
plt.plot(x2,my_pwlf.predict(x2))
plt.title('number of segments: '+str(my_pwlf.n_segments))
plt.show()
I've noticed that for small data sets, sometimes the predict function gives a result that appears to have the incorrect number of segments, even though .n_segments, .slopes, .fit_breaks, all seem to indicate the correct number of segments.
Here is an example which seems to give consistently the incorrect results
Which has the following results