Class - KCPipeline#
- class openfl.pipelines.kc_pipeline.KCPipeline(p_sparsity=0.01, n_clusters=6, **kwargs)[source]#
Bases:
TransformationPipelineA pipeline class to compress data lossly using k-means and GZIP methods.
- p#
The amount of sparsity for compression.
- Type:
float
- n_cluster#
The number of K-mean clusters.
- Type:
int
- __init__(p_sparsity=0.01, n_clusters=6, **kwargs)[source]#
Initialize a pipeline of transformers.
- Parameters:
p_sparsity (float, optional) – The amount of sparsity for compression. Defaults to 0.01.
n_clusters (int, optional) – The number of K-mean clusters. Defaults to 6.
**kwargs – Additional keyword arguments.
Methods
__init__([p_sparsity, n_clusters])Initialize a pipeline of transformers.
backward(data, transformer_metadata, **kwargs)Backward pass of pipeline data transformer.
forward(data, **kwargs)Forward pass of pipeline data transformer.
is_lossy()If any of the transformers are lossy, then the pipeline is lossy.
- backward(data, transformer_metadata, **kwargs)[source]#
Backward pass of pipeline data transformer.
- Parameters:
data – The transformed data.
transformer_metadata – The metadata for the transformation.
**kwargs – Additional keyword arguments for the transformation.
- Returns:
The original data before the transformation.