Package org.apache.sysds.runtime.transform.encode

## Interface Encoder

All Superinterfaces:
  `Externalizable`, `Serializable`

All Known Implementing Classes:
  `ColumnEncoder`, `ColumnEncoderBagOfWords`, `ColumnEncoderBin`, `ColumnEncoderComposite`, `ColumnEncoderDummycode`, `ColumnEncoderFeatureHash`, `ColumnEncoderPassThrough`, `ColumnEncoderRecode`, `ColumnEncoderUDF`, `ColumnEncoderWordEmbedding`, `MultiColumnEncoder`

    public interface Encoder
    extends Externalizable

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `allocateMetaData​(FrameBlock meta)` Pre-allocate a FrameBlock for metadata collection.
`MatrixBlock` `apply​(CacheBlock<?> in, MatrixBlock out, int outputCol)` Apply the generated metadata to the FrameBlock and saved the result in out.
`void` `build​(CacheBlock<?> in)` Build the transform meta data for the given block input.
`void` `buildPartial​(FrameBlock in)` Partial build of internal data structures (e.g., in distributed spark operations).
`FrameBlock` `getMetaData​(FrameBlock out)` Construct a frame block out of the transform meta data.
`void` `initMetaData​(FrameBlock meta)` Sets up the required meta data for a subsequent call to apply.
`void` `prepareBuildPartial()` Allocates internal data structures for partial build.
`void` `updateIndexRanges​(long[] beginDims, long[] endDims, int offset)` Update index-ranges to after encoding.

### Methods inherited from interface java.io.Externalizable

`readExternal, writeExternal`

### Method Detail

#### build

    void build​(CacheBlock<?> in)

Build the transform meta data for the given block input. This call modifies and keeps meta data as encoder state.

Parameters:
  `in` - input frame block

#### apply

    MatrixBlock apply​(CacheBlock<?> in,
                      MatrixBlock out,
                      int outputCol)

Apply the generated metadata to the FrameBlock and saved the result in out.

Parameters:
  `in` - input frame block
  `out` - output matrix block
  `outputCol` - is a offset in the output matrix. column in FrameBlock + outputCol = column in out
Returns:
  output matrix block

#### allocateMetaData

    void allocateMetaData​(FrameBlock meta)

Pre-allocate a FrameBlock for metadata collection.

Parameters:
  `meta` - frame block

#### getMetaData

    FrameBlock getMetaData​(FrameBlock out)

Construct a frame block out of the transform meta data.

Parameters:
  `out` - output frame block
Returns:
  output frame block?

#### initMetaData

    void initMetaData​(FrameBlock meta)

Sets up the required meta data for a subsequent call to apply.

Parameters:
  `meta` - frame block

#### prepareBuildPartial

    void prepareBuildPartial()

Allocates internal data structures for partial build.

#### buildPartial

    void buildPartial​(FrameBlock in)

Partial build of internal data structures (e.g., in distributed spark operations).

Parameters:
  `in` - input frame block

#### updateIndexRanges

    void updateIndexRanges​(long[] beginDims,
                           long[] endDims,
                           int offset)

Update index-ranges to after encoding. Note that only Dummycoding changes the ranges.

Parameters:
  `beginDims` - begin dimensions of range
  `endDims` - end dimensions of range
  `offset` - is applied to begin and endDims