org.apache.sysds.runtime.compress.estim

## Class CompressedSizeEstimatorSample

- java.lang.Object
- - org.apache.sysds.runtime.compress.estim.CompressedSizeEstimator
  - - org.apache.sysds.runtime.compress.estim.CompressedSizeEstimatorSample

    public class CompressedSizeEstimatorSample
    extends CompressedSizeEstimator

### Constructor Summary

Constructors
Constructor and Description
`CompressedSizeEstimatorSample(MatrixBlock data, CompressionSettings cs, int sampleSize)` CompressedSizeEstimatorSample, samples from the input data and estimates the size of the compressed matrix.

### Method Summary

All Methods Instance Methods Concrete Methods
`CompressedSizeInfoColGroup` `estimateCompressedColGroupSize(int[] colIndexes, int nrUniqueUpperBound)` A method to extract the Compressed Size Info for a given list of columns, This method further limits the estimated number of unique values, since in some cases the estimated number of uniques is estimated higher than the number estimated in sub groups of the given colIndexes.
`CompressedSizeInfoColGroup` `estimateJoinCompressedSize(int[] joined, CompressedSizeInfoColGroup g1, CompressedSizeInfoColGroup g2)`
`MatrixBlock` `getSample()`
`MatrixBlock` `sampleData(int sampleSize)`
`String` `toString()`

### Methods inherited from class org.apache.sysds.runtime.compress.estim.CompressedSizeEstimator

`computeCompressedSizeInfos, computeCompressedSizeInfos, computeCompressedSizeInfos, estimateCompressedColGroupSize, estimateCompressedColGroupSize, estimateCompressedColGroupSize, estimateCompressedColGroupSize, estimateJoinCompressedSize, getNumColumns, getNumRows`

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

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

### Constructor Detail

#### CompressedSizeEstimatorSample

    public CompressedSizeEstimatorSample(MatrixBlock data,
                                         CompressionSettings cs,
                                         int sampleSize)

CompressedSizeEstimatorSample, samples from the input data and estimates the size of the compressed matrix.

Parameters:
  `data` - The input data toSample from
  `cs` - The Settings used for the sampling, and compression, contains information such as seed.
  `sampleSize` - The size to sample from the data.

### Method Detail

#### getSample

    public MatrixBlock getSample()

#### sampleData

    public MatrixBlock sampleData(int sampleSize)

#### estimateCompressedColGroupSize

    public CompressedSizeInfoColGroup estimateCompressedColGroupSize(int[] colIndexes,
                                                                     int nrUniqueUpperBound)

Description copied from class: `CompressedSizeEstimator`
A method to extract the Compressed Size Info for a given list of columns, This method further limits the estimated number of unique values, since in some cases the estimated number of uniques is estimated higher than the number estimated in sub groups of the given colIndexes.

Specified by:
  `estimateCompressedColGroupSize` in class `CompressedSizeEstimator`
Parameters:
  `colIndexes` - The columns to extract compression information from
  `nrUniqueUpperBound` - The upper bound of unique elements allowed in the estimate, can be calculated from the number of unique elements estimated in sub columns multiplied together. This is flexible in the sense that if the sample is small then this unique can be manually edited like in CoCodeCostMatrixMult.
Returns:
  The CompressedSizeInfoColGroup fro the given column indexes.

#### estimateJoinCompressedSize

    public CompressedSizeInfoColGroup estimateJoinCompressedSize(int[] joined,
                                                                 CompressedSizeInfoColGroup g1,
                                                                 CompressedSizeInfoColGroup g2)

#### toString

    public String toString()

Overrides:
  `toString` in class `CompressedSizeEstimator`