Esempio n. 1
0
def test_pmdarima_constancy_validation(data):

    constancy = PmdarimaAnalyzer(df=data.df,
                                 group_key_columns=data.key_columns,
                                 y_col="y",
                                 datetime_col="ds").calculate_is_constant()

    assert len(constancy) == SERIES_TEST_COUNT
    for value in constancy.values():
        assert not value
Esempio n. 2
0
def test_pmdarima_calculate_pacf_minimal_args(data):

    pacf_data = PmdarimaAnalyzer(df=data.df,
                                 group_key_columns=data.key_columns,
                                 y_col="y",
                                 datetime_col="ds").calculate_pacf()

    for payload in pacf_data.values():
        assert {"pacf"}.issubset(payload.keys())
        assert [key not in payload.keys() for key in ["confidence_intervals"]]
        assert len(payload.get("pacf")) == 32
Esempio n. 3
0
def test_pmdarima_generate_diff(data):

    diff = PmdarimaAnalyzer(df=data.df,
                            group_key_columns=data.key_columns,
                            y_col="y",
                            datetime_col="ds").generate_diff(lag=2,
                                                             differences=1)

    for data in diff.values():
        assert len(data["diff"]) == (365 * 4) - 2
        assert data["series_start"] > 0
        assert isinstance(data["series_start"], float)
Esempio n. 4
0
def test_pmdarima_calculate_pacf_full_args(data):

    pacf_data = PmdarimaAnalyzer(df=data.df,
                                 group_key_columns=data.key_columns,
                                 y_col="y",
                                 datetime_col="ds").calculate_pacf(nlags=90,
                                                                   method="yw",
                                                                   alpha=0.05)

    for payload in pacf_data.values():
        assert {"pacf", "confidence_intervals"}.issubset(payload.keys())
        assert len(payload.get("pacf")) == 91
        assert len(payload.get("confidence_intervals")) == 91
Esempio n. 5
0
def test_pmdarima_calculate_acf_minimal_args(data):

    acf_data = PmdarimaAnalyzer(df=data.df,
                                group_key_columns=data.key_columns,
                                y_col="y",
                                datetime_col="ds").calculate_acf(
                                    unbiased=False,
                                    nlags=90,
                                    qstat=False,
                                    fft=False,
                                    alpha=None)
    for payload in acf_data.values():
        assert {"acf"}.issubset(payload.keys())
        assert [
            key not in payload.keys()
            for key in ["qstat", "pvalues", "confidence_intervals"]
        ]
        assert len(payload.get("acf")) == 91
Esempio n. 6
0
def test_pmdarima_calculate_acf_full_args(data):

    acf_data = PmdarimaAnalyzer(df=data.df,
                                group_key_columns=data.key_columns,
                                y_col="y",
                                datetime_col="ds").calculate_acf(unbiased=True,
                                                                 nlags=90,
                                                                 qstat=True,
                                                                 fft=True,
                                                                 alpha=0.1)

    for payload in acf_data.values():
        assert {"acf", "qstat", "pvalues",
                "confidence_intervals"}.issubset(payload.keys())
        assert len(payload.get("acf")) == 91
        assert len(payload.get("qstat")) == 90
        assert len(payload.get("confidence_intervals")) == 91
        assert len(payload.get("pvalues")) == 90