def test_univariate_without_time(show=False):
    k = 3
    n = 100
    y = hospital(n=n)
    x, x_std, forecast, m = prophet_iskater_factory(y=y, k=k)
    assert len(x) == k
    x1, x_std1, forecast1, m1 = prophet_fit_and_predict_simple(y=y, k=k)
    assert nearlysame(x1, x, 0.0001)
    if show:
        m.plot(forecast)
        m1.plot(forecast1)
        import matplotlib.pyplot as plt
        plt.show()
def test_univariate_with_time_and_advance_time(show=False):
    k = 3
    n = 100
    y = hospital(n=n)
    t = [i * 15 * 50 for i in range(len(y) + k)]
    x, x_std, forecast, m = prophet_iskater_factory(y=y, k=k, t=t)
    assert len(x) == k
    x1, x_std1, forecast1, m1 = prophet_fit_and_predict_with_time_and_advance_time(
        y=y, k=k, t=t)
    assert nearlysame(x1, x, 0.0001)
    if show:
        m.plot(forecast)
        m1.plot(forecast1)
        import matplotlib.pyplot as plt
        plt.show()
def test_with_exog_and_advance_vars(show=False):
    k = 3
    n = 100
    y, a = hospital_with_exog(k=k, n=n)
    y = y[:-k]
    t = [i * 15 * 50 for i in range(len(y) + k)]
    x, x_std, forecast, m = prophet_iskater_factory(y=y, k=k, t=t, a=a)
    assert len(x) == k
    x1, x_std1, forecast1, m1 = prophet_fit_and_predict_with_exog_and_advance_vars(
        y=y, k=k, t=t, a=a)
    assert nearlysame(x1, x, 0.0001)
    if show:
        m.plot(forecast)
        m1.plot(forecast1)
        import matplotlib.pyplot as plt
        plt.show()
def test_with_exog_and_advance_vars_no_t(show=False):
    k = 3
    n = 100
    y, a = hospital_with_exog(k=k, n=n)
    y = y[:-k]
    freq = '15min'
    x, x_std, forecast, m = prophet_iskater_factory(y=y, k=k, freq=freq, a=a)
    assert len(x) == k
    x1, x_std1, forecast1, m1 = prophet_fit_and_predict_with_exog_and_advance_vars_no_t(
        y=y, k=k, freq=freq, a=a)
    if not nearlysame(x1, x, 0.0001):
        print(forecast.tail())
        print(forecast1.tail())
        pass
    if show:
        m.plot(forecast)
        m1.plot(forecast1)
        import matplotlib.pyplot as plt
        plt.show()