def _run_aggr_dist_test(x, y):
    # default parameters
    default_params = AggrDist(transformer=ScipyDist())
    default_params_transformation = np.around((default_params.transform(x, y)),
                                              decimals=3)

    assert np.array_equal(
        np.array([
            [1.649, 1.525, 1.518, 1.934, 1.636],
            [1.39, 1.395, 1.313, 1.617, 1.418],
            [1.492, 1.489, 1.323, 1.561, 1.437],
            [1.559, 1.721, 1.544, 1.589, 1.642],
        ]),
        default_params_transformation,
    ), "Error occurred testing on default parameters, result is not correct"

    for transformer in PAIRWISE_TRANSFORMERS_TAB:
        for aggfunc in AGGFUNCS:
            aggfunc_params = AggrDist(transformer=transformer(),
                                      aggfunc=aggfunc)
            aggfunc_params_transformation = aggfunc_params.transform(x, y)
            assert isinstance(
                aggfunc_params_transformation,
                np.ndarray), (f"Error occurred testing on following parameters"
                              f"transformer={transformer}, aggfunc={aggfunc}")
def _run_aggr_dist_test(x, y):
    # default parametersc
    default_params = AggrDist(transformer=ScipyDist())
    default_params_transformation = np.around((default_params.transform(x, y)),
                                              decimals=3)

    assert np.array_equal(
        np.array([
            [1.714, 1.49, 1.53, 1.699, 1.849],
            [1.479, 1.36, 1.358, 1.476, 1.471],
            [1.553, 1.476, 1.354, 1.523, 1.425],
            [1.641, 1.704, 1.603, 1.698, 1.37],
        ]),
        default_params_transformation,
    ), "Error occurred testing on default parameters, result is not correct"

    for transformer in PAIRWISE_TRANSFORMERS_TAB:
        for aggfunc in AGGFUNCS:
            aggfunc_params = AggrDist(transformer=transformer(),
                                      aggfunc=aggfunc)
            aggfunc_params_transformation = aggfunc_params.transform(x, y)
            assert isinstance(
                aggfunc_params_transformation,
                np.ndarray), (f"Error occurred testing on following parameters"
                              f"transformer={transformer}, aggfunc={aggfunc}")
Exemplo n.º 3
0
def _run_scipy_dist_test(x, y):
    # default parameters
    default_params = ScipyDist()
    default_params_transformation = np.around((default_params.transform(x, y)),
                                              decimals=3)
    assert np.array_equal(
        np.array([
            [2.318, 1.657, 1.582, 1.502, 1.461],
            [1.79, 1.249, 1.715, 1.656, 1.449],
            [2.424, 2.083, 2.28, 1.735, 1.73],
            [1.602, 1.012, 1.658, 1.167, 0.901],
            [2.219, 1.643, 1.373, 1.005, 1.216],
        ]),
        default_params_transformation,
    ), "Error occurred testing on default parameters, result is not correct"

    for metric in METRIC_VALUES:
        for p in P_VALUES:
            for colalign in COLALIGN_VALUES:
                metric_params = ScipyDist(metric=metric,
                                          p=p,
                                          colalign=colalign)
                metric_params_transformation = metric_params.transform(x, y)
                assert isinstance(metric_params_transformation, np.ndarray), (
                    f"Error occurred testing on following parameters"
                    f"metric={metric}, p={p}, colalign={colalign}")
Exemplo n.º 4
0
    },
    HampelFilter: {
        "window_length": 3
    },
    OptionalPassthrough: {
        "transformer": BoxCoxTransformer(),
        "passthrough": False
    },
    FeatureSelection: {
        "method": "all"
    },
    ColumnwiseTransformer: {
        "transformer": Detrender()
    },
    AggrDist: {
        "transformer": ScipyDist()
    },
    PyODAnnotator: {
        "estimator": ANOMALY_DETECTOR
    },
    ClaSPSegmentation: {
        "period_length": 5,
        "n_cps": 1
    },
    ClaSPTransformer: {
        "window_length": 5
    },
}

# We use estimator tags in addition to class hierarchies to further distinguish
# estimators into different categories. This is useful for defining and running
Exemplo n.º 5
0
    },
    Prophet: {
        "n_changepoints": 0,
        "yearly_seasonality": False,
        "weekly_seasonality": False,
        "daily_seasonality": False,
        "uncertainty_samples": 1000,
        "verbose": False,
    },
    PartialAutoCorrelationTransformer: {"n_lags": 1},
    AutoCorrelationTransformer: {"n_lags": 1},
    Imputer: {"method": "mean"},
    HampelFilter: {"window_length": 3},
    OptionalPassthrough: {"transformer": BoxCoxTransformer(), "passthrough": True},
    ColumnwiseTransformer: {"transformer": Detrender()},
    AggrDist: {"transformer": ScipyDist()},
    PyODAnnotator: {"estimator": ANOMALY_DETECTOR},
}

# We use estimator tags in addition to class hierarchies to further distinguish
# estimators into different categories. This is useful for defining and running
# common tests for estimators with the same tags.
VALID_ESTIMATOR_TAGS = tuple(ESTIMATOR_TAG_LIST)

# These methods should not change the state of the estimator, that is, they should
# not change fitted parameters or hyper-parameters. They are also the methods that
# "apply" the fitted estimator to data and useful for checking results.
NON_STATE_CHANGING_METHODS = (
    "predict",
    "predict_proba",
    "decision_function",