Пример #1
0
def test_output_dimensions():
    # test with univariate
    X = _make_nested_from_array(np.ones(12), n_instances=10, n_columns=1)

    p = PAA(num_intervals=5).fit(X)
    res = p.transform(X)

    # get the dimension of the generated dataframe.
    corr_time_series_length = res.iloc[0, 0].shape[0]
    num_rows = res.shape[0]
    num_cols = res.shape[1]

    assert corr_time_series_length == 5
    assert num_rows == 10
    assert num_cols == 1

    # test with multivariate
    X = _make_nested_from_array(np.ones(12), n_instances=10, n_columns=5)

    p = PAA(num_intervals=5).fit(X)
    res = p.transform(X)

    # get the dimension of the generated dataframe.
    corr_time_series_length = res.iloc[0, 0].shape[0]
    num_rows = res.shape[0]
    num_cols = res.shape[1]

    assert corr_time_series_length == 5
    assert num_rows == 10
    assert num_cols == 5
Пример #2
0
def test_paa_performs_correcly_along_each_dim():
    X = _make_nested_from_array(np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
                                n_instances=1,
                                n_columns=2)

    p = PAA(num_intervals=3).fit(X)
    res = p.transform(X)
    orig = convert_list_to_dataframe([[2.2, 5.5, 8.8], [2.2, 5.5, 8.8]])
    orig.columns = X.columns
    assert check_if_dataframes_are_equal(res, orig)
Пример #3
0
def test_output_of_transformer():
    X = _make_nested_from_array(np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
                                n_instances=1,
                                n_columns=1)

    p = PAA(num_intervals=3).fit(X)
    res = p.transform(X)
    orig = convert_list_to_dataframe([[2.2, 5.5, 8.8]])
    orig.columns = X.columns
    assert check_if_dataframes_are_equal(res, orig)