openfl.pipelines.skc_pipeline.KmeansTransformer
- class openfl.pipelines.skc_pipeline.KmeansTransformer(n_cluster=6)
Bases:
TransformerA transformer class to quantize input data.
- Class Attributes:
n_cluster (int) – The number of clusters for the K-means.
lossy (bool) – A flag indicating if the transformation is lossy.
Methods
Recover data array back to the original numerical type.
Quantize data into n_cluster levels of values.
- backward(data, metadata, **kwargs)
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:
metadata – dictionary to contain information for recovering back to original data array.
data – an numpy array with original numerical type.
- forward(data, **kwargs)
Quantize data into n_cluster levels of values.
- Parameters:
data – an flattened numpy array.
- Returns:
int_data – an numpy array being quantized.
metadata – dictionary to store a list of meta information.