transformers
This module gathers all classes and methods used to transform data to new scales.
- class ClosestTransformer
Bases:
Transformer
This transformer associates out-of-scale values with closest preferred ones in discrete ordinal scales.
- classmethod normalize(data, in_scales=None)
Normalize input data.
Output type is the same as input data type.
- Parameters
data (Union[Any, Series, Values, CommensurableValues, DataFrame, AdjacencyValueMatrix, PerformanceTable, PartialValueMatrix]) –
in_scales (Optional[Union[Mapping[Any, Scale], Scale]]) – input scales (must be used when data doesn’t have scales attribute)
- Returns
normalized data (new object)
- Raises
TypeError – if type of arguments are not supported
- Return type
Union[Any, Series, Values[QuantitativeScale], CommensurableValues[QuantitativeScale], DataFrame, AdjacencyValueMatrix[QuantitativeScale], PerformanceTable[QuantitativeScale], PartialValueMatrix[QuantitativeScale]]
- classmethod transform(data, out_scales, in_scales=None)
Transform input data to new scales.
Output type is the same as input data type.
- Parameters
data (Union[Any, Series, Values, CommensurableValues, DataFrame, AdjacencyValueMatrix, PerformanceTable, PartialValueMatrix]) –
out_scales (Union[S, Mapping[Any, S]]) – output scales
in_scales (Optional[Union[Mapping[Any, Scale], Scale]]) – input scales (must be used when data doesn’t have scales attribute)
- Returns
transformed data (new object)
- Raises
TypeError – if type of arguments are not supported
- Return type
Union[Any, Series, Values[S], CommensurableValues[S], DataFrame, AdjacencyValueMatrix[S], PerformanceTable[S], PartialValueMatrix[S]]
- class Transformer
Bases:
ITransformer
This class defines the basic transformer methods.
It uses normalization and denormalization methods to transform values between scales, based on quantitative interval boundaries mapping.
- classmethod normalize(data, in_scales=None)
Normalize input data.
Output type is the same as input data type.
- Parameters
data (Union[Any, Series, Values, CommensurableValues, DataFrame, AdjacencyValueMatrix, PerformanceTable, PartialValueMatrix]) –
in_scales (Optional[Union[Mapping[Any, Scale], Scale]]) – input scales (must be used when data doesn’t have scales attribute)
- Returns
normalized data (new object)
- Raises
TypeError – if type of arguments are not supported
- Return type
Union[Any, Series, Values[QuantitativeScale], CommensurableValues[QuantitativeScale], DataFrame, AdjacencyValueMatrix[QuantitativeScale], PerformanceTable[QuantitativeScale], PartialValueMatrix[QuantitativeScale]]
- classmethod transform(data, out_scales, in_scales=None)
Transform input data to new scales.
Output type is the same as input data type.
- Parameters
data (Union[Any, Series, Values, CommensurableValues, DataFrame, AdjacencyValueMatrix, PerformanceTable, PartialValueMatrix]) –
out_scales (Union[S, Mapping[Any, S]]) – output scales
in_scales (Optional[Union[Mapping[Any, Scale], Scale]]) – input scales (must be used when data doesn’t have scales attribute)
- Returns
transformed data (new object)
- Raises
TypeError – if type of arguments are not supported
- Return type
Union[Any, Series, Values[S], CommensurableValues[S], DataFrame, AdjacencyValueMatrix[S], PerformanceTable[S], PartialValueMatrix[S]]
- normalize(data, in_scales=None)
Normalize input data.
Output type is the same as input data type.
- Parameters
data (Union[Any, Series, Values, CommensurableValues, DataFrame, AdjacencyValueMatrix, PerformanceTable, PartialValueMatrix]) –
in_scales (Optional[Union[Mapping[Any, Scale], Scale]]) – input scales (must be used when data doesn’t have scales attribute)
- Returns
normalized data (new object)
- Raises
TypeError – if type of arguments are not supported
- Return type
Union[Any, Series, Values[QuantitativeScale], CommensurableValues[QuantitativeScale], DataFrame, AdjacencyValueMatrix[QuantitativeScale], PerformanceTable[QuantitativeScale], PartialValueMatrix[QuantitativeScale]]
- transform(data, out_scales, in_scales=None)
Transform input data to new scales.
Output type is the same as input data type.
- Parameters
data (Union[Any, Series, Values, CommensurableValues, DataFrame, AdjacencyValueMatrix, PerformanceTable, PartialValueMatrix]) –
out_scales (Union[S, Mapping[Any, S]]) – output scales
in_scales (Optional[Union[Mapping[Any, Scale], Scale]]) – input scales (must be used when data doesn’t have scales attribute)
- Returns
transformed data (new object)
- Raises
TypeError – if type of arguments are not supported
- Return type
Union[Any, Series, Values[S], CommensurableValues[S], DataFrame, AdjacencyValueMatrix[S], PerformanceTable[S], PartialValueMatrix[S]]