Class - KmeansTransformer#
- class openfl.pipelines.skc_pipeline.KmeansTransformer(n_cluster=6)[source]#
Bases:
TransformerA transformer class to quantize input data.
- n_cluster#
The number of clusters for the K-means.
- Type:
int
- lossy#
A flag indicating if the transformation is lossy.
- Type:
bool
- __init__(n_cluster=6)[source]#
Initialize KmeansTransformer.
- Parameters:
n_cluster (int, optional) – The number of clusters for the K-means. Defaults to 6.
Methods
__init__([n_cluster])Initialize KmeansTransformer.
backward(data, metadata, **kwargs)Recover data array back to the original numerical type.
forward(data, **kwargs)Quantize data into n_cluster levels of values.
- backward(data, metadata, **kwargs)[source]#
Recover data array back to the original numerical type.
- Parameters:
data – an numpy array with non-zero values.
metadata – dictionary to contain information for recovering back to original data array.
- Returns:
- dictionary to contain information for recovering back
to original data array.
data: an numpy array with original numerical type.
- Return type:
metadata