Esempio n. 1
0
def test_base_dlt_init(estimator):
    dlt = DLT(estimator=estimator)

    is_fitted = dlt.is_fitted()

    model_data_input = dlt.get_training_data_input()
    model_param_names = dlt._model.get_model_param_names()
    init_values = dlt._model.get_init_values()

    # model is not yet fitted
    assert not is_fitted
    # should only be initialized and not set
    assert not model_data_input
    # model param names should already be set
    assert model_param_names
    # callable is not implemented yet
    assert not init_values
Esempio n. 2
0
def test_dlt_is_fitted(iclaims_training_data, estimator, keep_samples, point_method):
    df = iclaims_training_data
    df['claims'] = np.log(df['claims'])
    regressor_col = ['trend.unemploy']

    dlt = DLT(
        response_col='claims',
        date_col='week',
        regressor_col=regressor_col,
        seasonality=52,
        seed=8888,
        num_warmup=50,
        num_sample=50,
        verbose=False,
        estimator=estimator
    )

    dlt.fit(df, keep_samples=keep_samples, point_method=point_method)
    is_fitted = dlt.is_fitted()

    # still True when keep_samples is False
    assert is_fitted