handwriting_features.interface.featurizer package
Submodules
handwriting_features.interface.featurizer.exceptions module
handwriting_features.interface.featurizer.handlers module
- class handwriting_features.interface.featurizer.handlers.BaseFeatureExtractorHandler[source]
Bases:
objectBase class for the feature extractor handlers
- features
alias of
HandwritingFeatures
- mapping
alias of
HandwritingFeaturesMapping
- pipeline_utils
alias of
FeaturesPipelineUtils
- validation
alias of
HandwritingFeaturesValidation
- class handwriting_features.interface.featurizer.handlers.MultiSubjectFeatureExtractorHandler[source]
Bases:
BaseFeatureExtractorHandlerClass implementing the multi-subject features extractor handler
- classmethod extract(data_values, data_labels=None, pipeline=None, **configuration)[source]
Extracts the features specified in the pipeline for multiple subjects.
- Parameters
data_values (numpy.ndarray) – samples values to extract the features from
data_labels (list, optional) – labels for data samples, defaults to None
pipeline (list, optional) – pipeline of the features, defaults to None
configuration (**kwargs) – common extractor configuration
- Returns
extracted features and labels
- Return type
dict {“features”: …, “labels”: …}
- extractor
alias of
SingleSubjectFeatureExtractorHandler
- utils
alias of
MultiSubjectFeatureUtils
- class handwriting_features.interface.featurizer.handlers.SingleSubjectFeatureExtractorHandler[source]
Bases:
BaseFeatureExtractorHandlerClass implementing the single-subject features extractor handler
- classmethod extract(data_values, data_labels=None, pipeline=None, preparation=True, **configuration)[source]
Extracts the features specified in the pipeline for a single subject.
- Parameters
data_values (numpy.ndarray) – sample values to extract the features from
data_labels (list, optional) – labels for data samples, defaults to None
pipeline (list, optional) – pipeline of the features, defaults to None
preparation (bool, optional) – prepare the pipeline of features, defaults to True
configuration (**kwargs) – common extractor configuration
- Returns
extracted features and labels
- Return type
dict {“features”: …, “labels”: …}
- utils
alias of
SingleSubjectFeatureUtils
handwriting_features.interface.featurizer.utils module
- class handwriting_features.interface.featurizer.utils.FeaturesPipelineUtils[source]
Bases:
objectClass implementing features pipeline utils
- arguments_to_prepare = ['axis', 'in_air']
- class handwriting_features.interface.featurizer.utils.MultiSubjectFeatureUtils[source]
Bases:
objectClass implementing multi-subject feature values/labels utils
- class handwriting_features.interface.featurizer.utils.SingleSubjectFeatureUtils[source]
Bases:
objectClass implementing single-subject feature values/labels utils
- features_settings
alias of
HandwritingFeaturesSettings
- classmethod prepare_feature_labels(extracted, feature_name, feature_args=None)[source]
Prepares the feature labels.
- Parameters
extracted (numpy.ndarray) – extracted feature values
feature_name (str) – feature name
feature_args (dict, optional) – feature arguments, defaults to None
- Returns
prepared feature labels
- Return type
list
Module contents
- class handwriting_features.interface.featurizer.FeatureExtractor(values, labels=None, **configuration)[source]
Bases:
objectClass implementing the features extractor interface for the Featurizer API.
For more information about featurizer, see the following repositories: 1. [server side](#github.com/BDALab/featurizer-api) 1. [client side](#github.com/BDALab/featurizer-api-client)
For more information about the attributes, see:
extract(...)- extract(pipeline)[source]
Interface method: extract the features.
Data
data is of type:
numpy.ndarray.data is mandatory.
data shape: In general, data to have the shape (M, …, D). Where M stands for subjects (i.e. subjects are in the first dimension), and D stands for D data samples (of shape …).
in the case of data having the following shape: (D, ), the API assumes it is a vector of D data sample points for one subject. It transforms the data to a row vector: (1, D) to add the dimension for the subject.
- 2: in the case of data having the following shape: (M, …, D),
the API does not transform the data, but it assumes there are M subjects abd D data samples, each having (…) dimensionality, e.g. if data has the shape (M, 3, 10) it means that there are M subjects and each of the subjects has 10 data samples (each being three dimensional).
Labels
labels are of type:
list.labels are optional.
labels are of length D (for each data sample, there is one label)
Configuration
configuration are of type:
dict.configuration is optional.
configuration provides common kwargs for feature extraction
Pipeline
pipeline is of type:
list.pipeline is mandatory.
each element in the pipeline is of type:
dict.each element in the pipeline has the following keys: a)
nameto hold the name of the feature to be computed, and b)argsto hold the arguments (kwargs) for the specific feature extraction method that is going to be used (it is of type:dict).
Output
The extracted features follow the same shape convention as the input data: the subjects are in the first dimension, and the features are in the last dimension (each feature having shape …).
- Parameters
pipeline (list) – pipeline of the features to be extracted
- Returns
extracted features and labels
- Return type
dict {“features”: …, “labels”: …}