tdaad.utils package๏
Submodules๏
tdaad.utils.local_elliptic_envelope module๏
Pandas Elliptic Envelope.
- tdaad.utils.local_elliptic_envelope.pandas_mahalanobis(self, X)[source]๏
Compute the negative Mahalanobis distances of embedding matrix X.
- Parameters:
X (array-like of shape (n_samples, n_features)) โ The embedding matrix.
- Returns:
negative_mahal_distances โ Opposite of the Mahalanobis distances.
- Return type:
pandas.DataFrame of shape (n_samples,)
- tdaad.utils.local_elliptic_envelope.pandas_score_samples(self, X)[source]๏
Compute the negative Mahalanobis distances.
- Parameters:
X (array-like of shape (n_samples, n_features)) โ The data matrix.
- Returns:
negative_mahal_distances โ Opposite of the Mahalanobis distances.
- Return type:
array-like of shape (n_samples,)
tdaad.utils.local_pipeline module๏
Window Functions.
- class tdaad.utils.local_pipeline.LocalPipeline(steps, *, transform_input=None, memory=None, verbose=False)[source]๏
Bases:
Pipeline
Local pipeline modification for added functionality.
- set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') LocalPipeline ๏
Request metadata passed to the
score
method.Note that this method is only relevant if
enable_metadata_routing=True
(seesklearn.set_config()
). Please see User Guide on how the routing mechanism works.The options for each parameter are:
True
: metadata is requested, and passed toscore
if provided. The request is ignored if metadata is not provided.False
: metadata is not requested and the meta-estimator will not pass it toscore
.None
: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str
: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED
) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
Note
This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a
Pipeline
. Otherwise it has no effect.- Parameters:
sample_weight (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) โ Metadata routing for
sample_weight
parameter inscore
.- Returns:
self โ The updated object.
- Return type:
object
tdaad.utils.remapping_functions module๏
Remapping Functions.
tdaad.utils.window_functions module๏
Window Functions.
- tdaad.utils.window_functions.sliding_window_ppl(data, pipeline, step=5, window_size=120)[source]๏
Applies a pipeline to timeseries data chunks using the Sliding Window algorithm.
@param data: pd.DataFrame with index to apply named_pipeline to. @param window_size: size of the sliding window algorithm to extract subsequences as input to named_pipeline. @param step: size of the sliding window steps between each window. @param pipeline: pipeline (sequence of operators that have a name attribute) to apply to each window. @return: pd.DataFrame that maps data to the result of applying named_pipeline to window view of data.