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

## Class EncoderMVImpute

- java.lang.Object
- - org.apache.sysds.runtime.transform.encode.LegacyEncoder
  - - org.apache.sysds.runtime.transform.encode.EncoderMVImpute

- All Implemented Interfaces:
    `Externalizable`, `Serializable`

      public class EncoderMVImpute
      extends LegacyEncoder

  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `EncoderMVImpute.MVMethod` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `EncoderMVImpute()` |
    `EncoderMVImpute​(int[] colList, EncoderMVImpute.MVMethod[] mvMethodList, String[] replacementList, KahanObject[] meanList, long[] countList, List<Integer> rcList, int clen)` |
    `EncoderMVImpute​(org.apache.wink.json4j.JSONObject parsedSpec, String[] colnames, int clen, int minCol, int maxCol)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `MatrixBlock` | `apply​(FrameBlock in, MatrixBlock out)` | Encode input data blockwise according to existing transform meta data (transform apply).
    `void` | `build​(FrameBlock in)` | Build the transform meta data for the given block input.
    `MatrixBlock` | `encode​(FrameBlock in, MatrixBlock out)` | Block encode: build and apply (transform encode).
    `HashMap<String,​Long>` | `getHistogram​(int colID)` | Exposes the internal histogram after build.
    `KahanObject[]` | `getMeans()` |
    `FrameBlock` | `getMetaData​(FrameBlock out)` | Construct a frame block out of the transform meta data.
    `EncoderMVImpute.MVMethod` | `getMethod​(int colID)` |
    `long` | `getNonMVCount​(int colID)` |
    `String` | `getReplacement​(int colID)` |
    `String[]` | `getReplacements()` |
    `void` | `initMetaData​(FrameBlock meta)` | Sets up the required meta data for a subsequent call to apply.
    `void` | `initRecodeIDList​(List<Integer> rcList)` |
    `void` | `mergeAt​(LegacyEncoder other, int row, int col)` | Merges another encoder, of a compatible type, in after a certain position.
    `void` | `readExternal​(ObjectInput in)` | Redirects the default java serialization via externalizable to our default hadoop writable serialization for efficient broadcast/rdd deserialization.
    `LegacyEncoder` | `subRangeEncoder​(IndexRange ixRange)` | Returns a new Encoder that only handles a sub range of columns.
    `void` | `writeExternal​(ObjectOutput out)` | Redirects the default java serialization via externalizable to our default hadoop writable serialization for efficient broadcast/rdd serialization.

    - ### Methods inherited from class org.apache.sysds.runtime.transform.encode.LegacyEncoder

      `buildPartial, getColList, getColMapping, initColList, initColList, isApplicable, isApplicable, prepareBuildPartial, setColList, shiftCols, updateIndexRanges`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EncoderMVImpute

          public EncoderMVImpute​(org.apache.wink.json4j.JSONObject parsedSpec,
                                 String[] colnames,
                                 int clen,
                                 int minCol,
                                 int maxCol)
                          throws org.apache.wink.json4j.JSONException

      Throws:
        `org.apache.wink.json4j.JSONException`

    - #### EncoderMVImpute

          public EncoderMVImpute()

    - #### EncoderMVImpute

          public EncoderMVImpute​(int[] colList,
                                 EncoderMVImpute.MVMethod[] mvMethodList,
                                 String[] replacementList,
                                 KahanObject[] meanList,
                                 long[] countList,
                                 List<Integer> rcList,
                                 int clen)

  - ### Method Detail

    - #### getReplacements

          public String[] getReplacements()

    - #### getMeans

          public KahanObject[] getMeans()

    - #### getMethod

          public EncoderMVImpute.MVMethod getMethod​(int colID)

    - #### getNonMVCount

          public long getNonMVCount​(int colID)

    - #### getReplacement

          public String getReplacement​(int colID)

    - #### encode

          public MatrixBlock encode​(FrameBlock in,
                                    MatrixBlock out)

      Description copied from class: `LegacyEncoder`
      Block encode: build and apply (transform encode).
      Specified by:
        `encode` in class `LegacyEncoder`
      Parameters:
        `in` - input frame block
        `out` - output matrix block
      Returns:
        output matrix block

    - #### build

          public void build​(FrameBlock in)

      Description copied from class: `LegacyEncoder`
      Build the transform meta data for the given block input. This call modifies and keeps meta data as encoder state.
      Specified by:
        `build` in class `LegacyEncoder`
      Parameters:
        `in` - input frame block

    - #### apply

          public MatrixBlock apply​(FrameBlock in,
                                   MatrixBlock out)

      Description copied from class: `LegacyEncoder`
      Encode input data blockwise according to existing transform meta data (transform apply).
      Specified by:
        `apply` in class `LegacyEncoder`
      Parameters:
        `in` - input frame block
        `out` - output matrix block
      Returns:
        output matrix block

    - #### subRangeEncoder

          public LegacyEncoder subRangeEncoder​(IndexRange ixRange)

      Description copied from class: `LegacyEncoder`
      Returns a new Encoder that only handles a sub range of columns.
      Overrides:
        `subRangeEncoder` in class `LegacyEncoder`
      Parameters:
        `ixRange` - the range (1-based, begin inclusive, end exclusive)
      Returns:
        an encoder of the same type, just for the sub-range

    - #### mergeAt

          public void mergeAt​(LegacyEncoder other,
                              int row,
                              int col)

      Description copied from class: `LegacyEncoder`
      Merges another encoder, of a compatible type, in after a certain position. Resizes as necessary. `Encoders` are compatible with themselves and `EncoderComposite` is compatible with every other `Encoder`.
      Overrides:
        `mergeAt` in class `LegacyEncoder`
      Parameters:
        `other` - the encoder that should be merged in
        `row` - the row where it should be placed (1-based)
        `col` - the col where it should be placed (1-based)

    - #### getMetaData

          public FrameBlock getMetaData​(FrameBlock out)

      Description copied from class: `LegacyEncoder`
      Construct a frame block out of the transform meta data.
      Specified by:
        `getMetaData` in class `LegacyEncoder`
      Parameters:
        `out` - output frame block
      Returns:
        output frame block?

    - #### initMetaData

          public void initMetaData​(FrameBlock meta)

      Description copied from class: `LegacyEncoder`
      Sets up the required meta data for a subsequent call to apply.
      Specified by:
        `initMetaData` in class `LegacyEncoder`
      Parameters:
        `meta` - frame block

    - #### initRecodeIDList

          public void initRecodeIDList​(List<Integer> rcList)

    - #### getHistogram

          public HashMap<String,​Long> getHistogram​(int colID)

      Exposes the internal histogram after build.
      Parameters:
        `colID` - column ID
      Returns:
        histogram (map of string keys and long values)

    - #### writeExternal

          public void writeExternal​(ObjectOutput out)
                             throws IOException

      Description copied from class: `LegacyEncoder`
      Redirects the default java serialization via externalizable to our default hadoop writable serialization for efficient broadcast/rdd serialization.
      Specified by:
        `writeExternal` in interface `Externalizable`
      Overrides:
        `writeExternal` in class `LegacyEncoder`
      Parameters:
        `out` - object output
      Throws:
        `IOException` - if IOException occurs

    - #### readExternal

          public void readExternal​(ObjectInput in)
                            throws IOException

      Description copied from class: `LegacyEncoder`
      Redirects the default java serialization via externalizable to our default hadoop writable serialization for efficient broadcast/rdd deserialization.
      Specified by:
        `readExternal` in interface `Externalizable`
      Overrides:
        `readExternal` in class `LegacyEncoder`
      Parameters:
        `in` - object input
      Throws:
        `IOException` - if IOException occur