pymfe.relative.MFERelativeLandmarking

class pymfe.relative.MFERelativeLandmarking[source]

Keep methods for metafeatures of landmarking group.

The convention adopted for metafeature extraction related methods is to always start with ft_ prefix to allow automatic method detection. This prefix is predefined within _internal module.

All method signature follows the conventions and restrictions listed below:

  1. For independent attribute data, X means every type of attribute, N means Numeric attributes only and C stands for Categorical attributes only. It is important to note that the categorical attribute sets between X and C and the numerical attribute sets between X and N may differ due to data transformations, performed while fitting data into MFE model, enabled by, respectively, transform_num and transform_cat arguments from fit (MFE method).

  2. Only arguments in MFE _custom_args_ft attribute (set up inside fit method) are allowed to be required method arguments. All other arguments must be strictly optional (i.e., has a predefined default value).

  3. The initial assumption is that the user can change any optional argument, without any previous verification of argument value or its type, via kwargs argument of extract method of MFE class.

  4. The return value of all feature extraction methods should be a single value or a generic List (preferably a np.ndarray) type with numeric values.

There is another type of method adopted for automatic detection. It is adopted the prefix precompute_ for automatic detection of these methods. These methods run while fitting some data into an MFE model automatically, and their objective is to precompute some common value shared between more than one feature extraction method. This strategy is a trade-off between more system memory consumption and speeds up of feature extraction. Their return value must always be a dictionary whose keys are possible extra arguments for both feature extraction methods and other precomputation methods. Note that there is a share of precomputed values between all valid feature-extraction modules (e.g., class_freqs computed in module statistical can freely be used for any precomputation or feature extraction method of module landmarking).

__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

group_mtf_by_summary(mtf_names, mtf_vals, ...)

Group metafeatures by its correspondent summary method.

postprocess_landmarking_relative(mtf_names, ...)

Generate Relative Landmarking from Landmarking metafeatures.

classmethod group_mtf_by_summary(mtf_names: List[str], mtf_vals: List[float], class_indexes: List[int]) Tuple[Dict[str, List[float]], Dict[str, List[int]]][source]

Group metafeatures by its correspondent summary method.

It is assumed that every distinct suffix after the first separator . in the metafeature name corresponds to a different summary method, even if it is, for example, due to different bins of a histogram summarization.

classmethod postprocess_landmarking_relative(mtf_names: List[str], mtf_vals: List[float], mtf_time: List[float], class_indexes: List[int], groups: Tuple[str, ...], inserted_group_dep: FrozenSet[str], **kwargs) Optional[Tuple[List[str], List[float], List[float]]][source]

Generate Relative Landmarking from Landmarking metafeatures.

Parameters
mtf_namesstr

Name of each generated metafeature (after extraction and summarization).

mtf_valsstr

Value of each generated metafeature (after extraction and summarization).

mtf_timestr

Time elapsed to generate each metafeature (after extraction and summarization).

class_indexeslist of int

List of indexes corresponding to metafeatures associated to metafeature groups present in this postprocessing method name (Landmarking and Relative.)

groupstuple of str

User-selected and automatic inserted (due to group dependencies) groups of metafeatures.

inserted_group_deptuple of str

Tuple with all automatic inserted metafeature groups due to dependency between groups.

**kwargs: to keep consistency with the framework postprocessing

signature. Not used in this method.

Returns
If either landmarking or relative is not selected by the user
as a metafeature group:

Returns None.

Else:

Returns three lists for generated relative landmarking metafeature names, values and time elapsed (in this order.)