DataDog / piecewise

## Auto-archived due to inactivity. ## Functions for piecewise regression on time series data
BSD 3-Clause "New" or "Revised" License
104 stars 35 forks source link

IndexError: index out of range #10

Open roussetjc opened 5 years ago

roussetjc commented 5 years ago

When trying to make this work with the given example, I get: next_merge = heapq.heappop(merges) IndexError: index out of range Am I doing something wrong? Thanks!

StephenKappel commented 5 years ago

Hi @roussetjc - I'm trying to reproduce your error but haven't been able to. I tried running the example in the readme with a clean installation of this repo with both Python 3.7.3 and Python 2.7.16. I get the expected results. To make sure I understand, you are running the following code?

import numpy as np

t = np.arange(10)
v = np.array(
    [2*i for i in range(5)] +
    [10-i for i in range(5, 10)]
) + np.random.normal(0, 1, 10)

from piecewise import piecewise

model = piecewise(t, v)
print(model)