Class TableStats


  • public class TableStats
    extends java.lang.Object
    Aggregates column statistics for a table. Factory methods are provided to accumulate statistics from table data.
    Since:
    3 Dec 2020
    Author:
    Mark Taylor
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static double MAD_SCALE
      Value by which Median Absolute Deviation is scaled to estimate SD.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static double[] calculateMads​(uk.ac.starlink.table.StarTable table, uk.ac.starlink.table.RowRunner runner, java.util.function.Supplier<Quantiler> qSupplier, double[] medians)
      Calculates Median Absolute Deviations for each table column.
      static TableStats calculateStats​(uk.ac.starlink.table.StarTable table, uk.ac.starlink.table.RowRunner runner, java.util.function.Supplier<Quantiler> qSupplier, boolean doCard)
      Calculates statistics from a given table.
      UnivariateStats[] getColumnStats()
      Returns the array of per-column statistics accumulators.
      long getRowCount()
      Returns the number of rows for which statistics have been accumulated.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MAD_SCALE

        public static final double MAD_SCALE
        Value by which Median Absolute Deviation is scaled to estimate SD.
        See Also:
        Constant Field Values
    • Constructor Detail

      • TableStats

        public TableStats​(UnivariateStats[] colStats)
        Constructor.
        Parameters:
        colStats - array of per-column statistics accumulators
    • Method Detail

      • getColumnStats

        public UnivariateStats[] getColumnStats()
        Returns the array of per-column statistics accumulators.
        Returns:
        column stats
      • getRowCount

        public long getRowCount()
        Returns the number of rows for which statistics have been accumulated.
        Returns:
        row count
      • calculateStats

        public static TableStats calculateStats​(uk.ac.starlink.table.StarTable table,
                                                uk.ac.starlink.table.RowRunner runner,
                                                java.util.function.Supplier<Quantiler> qSupplier,
                                                boolean doCard)
                                         throws java.io.IOException
        Calculates statistics from a given table.
        Parameters:
        table - table supplying data
        runner - controls sequential/parallel processing
        qSupplier - supplies quantile accumulators if quantiles are required, otherwise null
        doCard - whether to count distinct values
        Throws:
        java.io.IOException
      • calculateMads

        public static double[] calculateMads​(uk.ac.starlink.table.StarTable table,
                                             uk.ac.starlink.table.RowRunner runner,
                                             java.util.function.Supplier<Quantiler> qSupplier,
                                             double[] medians)
                                      throws java.io.IOException
        Calculates Median Absolute Deviations for each table column.
        Parameters:
        table - input table
        runner - controls sequential/parallel processing
        qSupplier - supplies quantile accumulators
        medians - per-column array of median values; MADs will be calculated only for elements with non-null values
        Returns:
        per-column array of MADs
        Throws:
        java.io.IOException