Class - TernaryTransformer#

class openfl.pipelines.stc_pipeline.TernaryTransformer[source]#

Bases: Transformer

A transformer class to ternarize input data.

lossy#

A flag indicating if the transformation is lossy.

Type:

bool

__init__()[source]#

Initialize.

Methods

__init__()

Initialize.

backward(data, metadata, **kwargs)

Recover data array back to the original numerical type.

forward(data, **kwargs)

Ternerize data into positive mean value, negative mean value and zero value.

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

forward(data, **kwargs)[source]#

Ternerize data into positive mean value, negative mean value and zero value.

Parameters:

data – an flattened numpy array

Returns:

an numpy array being terneraized. metadata: dictionary to store a list of meta information.

Return type:

int_data