Utility functions

aeon has a number of modules dedicated to utilities:

  • aeon.pipeline, which contains functions for pipeline construction.

  • aeon.testing, which contains functions for estimator testing and data generation.

  • aeon.utils, which contains generic utility functions.

Pipeline

make_pipeline(*steps)

Create a pipeline from aeon and sklearn estimators.

sklearn_to_aeon(estimator)

Coerces an sklearn estimator to the aeon pipeline interface.

Testing

Data Generation

make_example_3d_numpy([n_cases, n_channels, ...])

Randomly generate 3D numpy X and numpy y data for testing.

make_example_2d_numpy_collection([n_cases, ...])

Randomly generate 2D numpy X and numpy y for testing.

make_example_3d_numpy_list([n_cases, ...])

Randomly generate 3D list of numpy X and numpy y for testing.

make_example_2d_numpy_list([n_cases, ...])

Randomly generate 2D list of numpy X and numpy y for testing.

make_example_dataframe_list([n_cases, ...])

Randomly generate list of DataFrame X and numpy y for testing.

make_example_2d_dataframe_collection([...])

Randomly generate 2D DataFrame X and numpy y for testing.

make_example_multi_index_dataframe([...])

Randomly generate multi-index pd.DataFrame X and numpy y data for testing.

make_example_1d_numpy([n_timepoints, ...])

Randomly generate 1D numpy X.

make_example_2d_numpy_series([n_timepoints, ...])

Randomly generate 2D numpy X.

make_example_pandas_series([n_timepoints, ...])

Randomly generate pandas Series X.

make_example_dataframe_series([...])

Randomly generate pandas DataFrame X.

Estimator Checking

check_estimator(estimator[, ...])

Check if estimator adheres to aeon conventions.

parametrize_with_checks(estimators[, ...])

Pytest specific decorator for parametrizing aeon estimator checks.

Mock Estimators

MockAnomalyDetector()

Mock anomaly detector.

MockAnomalyDetectorRequiresFit()

Mock anomaly detector that requires fit.

MockAnomalyDetectorRequiresY()

Mock anomaly detector that requires y.

MockClassifier()

Mock classifier for testing fit/predict.

MockClassifierPredictProba()

Mock classifier for testing fit/predict/predict_proba.

MockClassifierFullTags()

Mock classifier able to handle all input types.

MockClassifierParams([return_ones, value])

Mock classifier for testing fit/predict with multiple parameters.

MockClassifierComposite([mock])

Mock classifier which contains another mock classfier.

MockCluster()

Mock Cluster for testing base class fit/predict.

MockDeepClusterer([estimator, last_file_name])

Mock Deep Clusterer for testing empty base deep class save utilities.

MockCollectionTransformer()

BasecollectionTransformer for testing tags.

MockForecaster()

Mock forecaster for testing.

MockRegressor([random_state])

Dummy regressor for testing base class fit/predict.

MockRegressorFullTags([random_state])

Dummy regressor for testing base class fit/predict/predict_proba.

MockSegmenter()

Mock segmenter for testing.

MockSegmenterRequiresY()

Mock segmenter for testing.

MockSeriesTransformer()

MockSeriesTransformer to set tags.

MockUnivariateSeriesTransformer([constant, ...])

MockSeriesTransformer adds a random value and a constant to the input series.

MockMultivariateSeriesTransformer([...])

MockSeriesTransformer adds a random value and a constant to the input series.

MockSeriesTransformerNoFit([constant])

MockSeriesTransformerNoFit adds a value to all elements the input series.

MockSimilaritySearch([distance, ...])

Mock similarity search for testing base class predict.

Utilities

deep_equals(x, y[, ignore_index, return_msg])

Test two objects for equality in value.

suppress_output([suppress_stdout, ...])

Redirects stdout and/or stderr to devnull.

Utils

Estimator Discovery & Tags

get_identifier(estimator)

Determine identifier string of an estimator.

all_estimators([type_filter, exclude_types, ...])

Get a list of all estimators from aeon.

check_valid_tags(estimator[, tags, ...])

Check the validity of tags for an estimator.

all_tags_for_estimator(estimator[, names_only])

Get a filtered dictionary of tags given an estimator or estimator type.

Data Conversion & Validation

resolve_equal_length_inner_type(inner_types)

Hierarchy of preference for internal supported types for equal length.

resolve_unequal_length_inner_type(inner_types)

Hierarchy of preference for internal supported types for unequal length.

convert_collection(X, output_type)

Convert from one of collections compatible data structure to another.

convert_series(y, output_type)

Convert series y to the specified output_type.

is_int(x)

Check if x is of integer type, but not boolean.

is_float(x)

Check if x is of float type.

is_timedelta(x)

Check if x is of timedelta type.

is_date_offset(x)

Check if x is of pd.DateOffset type.

is_timedelta_or_date_offset(x)

Check if x is of timedelta or pd.DateOffset type.

check_n_jobs(n_jobs)

Check n_jobs parameter according to the scikit-learn convention.

check_window_length(window_length[, ...])

Validate window length.

get_n_cases(X)

Return the number of cases in a collectiom.

get_type(X)

Get the string identifier associated with different data structures.

is_equal_length(X)

Test if X contains equal length time series.

has_missing(X)

Check if X has missing values.

is_univariate(X[, is_collection])

Check if X is multivariate.

is_univariate_series(y)

Check if series is univariate.

is_single_series(y)

Check if input is a single time series.

is_collection(X[, include_2d])

Check X is a valid collection data structure.

is_tabular(X)

Check if input is a 2D table.

is_hierarchical(y)

Check to see if y is in a hierarchical dataframe.

Numba

unique_count(X)

Numba unique value count function for a 1d numpy array.

first_order_differences(X)

Numba first order differences function for a 1d numpy array.

first_order_differences_2d(X)

Numba first order differences function for a 2d numpy array.

first_order_differences_3d(X)

Numba first order differences function for a 3d numpy array.

z_normalise_series_with_mean(X, series_mean)

Numba series normalization function for a 1d numpy array with mean.

z_normalise_series(X)

Numba series normalization function for a 1d numpy array.

z_normalise_series_2d(X)

Numba series normalization function for a 2d numpy array.

z_normalise_series_3d(X)

Numba series normalization function for a 3d numpy array.

set_numba_random_seed(seed)

Set the random seed for numba.

choice_log(n_choice, n_sample, random_generator)

Random choice function with log probability rather than uniform.

get_subsequence(X, i_start, length, dilation)

Get a subsequence from a time series given a starting index.

get_subsequence_with_mean_std(X, i_start, ...)

Get a subsequence, its mean and std from a time series given a starting index.

sliding_mean_std_one_series(X, length, dilation)

Return the mean and standard deviation for all subsequence (l,d) in X.

combinations_1d(x, y)

Return the unique pairs of the 2D array made by concatenating x and y.

slope_derivative(X)

Numba slope derivative transformation for a 1d numpy array.

slope_derivative_2d(X)

Numba slope derivative transformation for a 2d numpy array.

slope_derivative_3d(X)

Numba slope derivative transformation for a 3d numpy array.

generate_combinations(n, k)

Generate combination for n rows of k.

mean(X)

Numba mean function for a 1d numpy array.

row_mean(X)

Numba mean function for a 2d numpy array.

count_mean_crossing(X)

Numba count above mean of first order differences for a 1d numpy array.

row_count_mean_crossing(X)

Numba count above mean of first order differences for a 2d numpy array.

count_above_mean(X)

Numba count above mean for a 1d numpy array.

row_count_above_mean(X)

Numba count above mean for a 2d numpy array.

quantile(X, q)

Numba quantile function for a 1d numpy array.

row_quantile(X, q)

Numba quantile function for a 2d numpy array.

median(X)

Numba median function for a 1d numpy array.

row_median(X)

Numba median function for a 2d numpy array.

quantile25(X)

Numba 0.25 quantile function for a 1d numpy array.

row_quantile25(X)

Numba 0.25 quantile function for a 2d numpy array.

quantile75(X)

Numba 0.75 quantile function for a 1d numpy array.

row_quantile75(X)

Numba 0.75 quantile function for a 2d numpy array.

std(X)

Numba standard deviation function for a 1d numpy array.

std2(X, X_mean)

Numba standard deviation function for a 1d numpy array with pre-calculated mean.

row_std(X)

Numba standard deviation function for a 2d numpy array.

numba_min(X)

Numba min function for a 1d numpy array.

row_numba_min(X)

Numba min function for a 2d numpy array.

numba_max(X)

Numba max function for a 1d numpy array.

row_numba_max(X)

Numba max function for a 2d numpy array.

slope(X)

Numba slope function for a 1d numpy array.

row_slope(X)

Numba slope function for a 2d numpy array.

iqr(X)

Numba interquartile range function for a 1d numpy array.

row_iqr(X)

Numba interquartile range function for a 2d numpy array.

ppv(X)

Numba proportion of positive values function for a 1d numpy array.

row_ppv(X)

Numba proportion of positive values function for a 2d numpy array.

fisher_score(X, y)

Numba Fisher score function.

prime_up_to(n)

Check if any number from 1 to n is a prime number and return the ones which are.

is_prime(n)

Check if the input number is a prime number.

haar_transform(x)

Perform the discrete Haar wavelet transform on a given signal.

multilevel_haar_transform(x[, levels])

Perform the multilevel discrete Haar wavelet transform on a given signal.

Other

show_versions([as_str])

Print useful debugging information.

is_sklearn_estimator(obj)

Check whether obj is an sklearn estimator.

sklearn_estimator_identifier(obj[, var_name])

Return sklearn identifier.

is_sklearn_transformer(obj)

Check whether obj is an sklearn transformer.

is_sklearn_classifier(obj)

Check whether obj is an sklearn classifier.

is_sklearn_regressor(obj)

Check whether obj is an sklearn regressor.

is_sklearn_clusterer(obj)

Check whether obj is an sklearn clusterer.

split_series(X, n_intervals)

Split a time series into approximately equal intervals.

sliding_windows(X, window_size[, stride, axis])

Create sliding windows of a time series.

reverse_windowing(y, window_size[, ...])

Aggregate windowed results for each point of the original time series.