Class ParamservUtils


  • public class ParamservUtils
    extends Object
    • Constructor Detail

      • ParamservUtils

        public ParamservUtils()
    • Method Detail

      • copyList

        public static ListObject copyList​(ListObject lo,
                                          boolean cleanup)
        Deep copy the list object
        Parameters:
        lo - list object
        cleanup - clean up the given list object
        Returns:
        a new copied list object
      • cleanupListObject

        public static void cleanupListObject​(ExecutionContext ec,
                                             String lName)
        Clean up the list object according to its own data status
        Parameters:
        ec - execution context
        lName - list var name
      • cleanupListObject

        public static void cleanupListObject​(ExecutionContext ec,
                                             String lName,
                                             boolean[] status)
        Clean up the list object according to the given array of data status (i.e., false => not be removed)
        Parameters:
        ec - execution context
        lName - list var name
        status - data status
      • cleanupListObject

        public static void cleanupListObject​(ListObject lo)
      • sliceMatrix

        public static MatrixObject sliceMatrix​(MatrixObject mo,
                                               long rl,
                                               long rh)
        Slice the matrix
        Parameters:
        mo - input matrix
        rl - low boundary
        rh - high boundary
        Returns:
        new sliced matrix
      • sliceMatrixBlock

        public static MatrixBlock sliceMatrixBlock​(MatrixBlock mb,
                                                   long rl,
                                                   long rh)
        Slice the matrix block and return a matrix block (used in spark)
        Parameters:
        mb - input matrix
        rl - low boundary
        rh - high boundary
        Returns:
        new sliced matrix block
      • generatePermutation

        public static MatrixBlock generatePermutation​(int numEntries,
                                                      long seed)
        Generate the permutation
        Parameters:
        numEntries - permutation size
        seed - seed used to generate random number
        Returns:
        permutation matrix
      • generateSubsampleMatrix

        public static MatrixBlock generateSubsampleMatrix​(int nsamples,
                                                          int nrows,
                                                          long seed)
        Generates a matrix which when left multiplied with the input matrix will subsample
        Parameters:
        nsamples - number of samples
        nrows - number of rows in input matrix
        seed - seed used to generate random number
        Returns:
        subsample matrix
      • generateReplicationMatrix

        public static MatrixBlock generateReplicationMatrix​(int nsamples,
                                                            int nrows,
                                                            long seed)
        Generates a matrix which when left multiplied with the input matrix will replicate n data rows
        Parameters:
        nsamples - number of samples
        nrows - number of rows in input matrix
        seed - seed used to generate random number
        Returns:
        replication matrix
      • recompileProgramBlocks

        public static void recompileProgramBlocks​(int k,
                                                  List<ProgramBlock> pbs)
      • recompileProgramBlocks

        public static void recompileProgramBlocks​(int k,
                                                  List<ProgramBlock> pbs,
                                                  boolean forceExecTypeCP)
      • accrueGradients

        public static ListObject accrueGradients​(ListObject accGradients,
                                                 ListObject gradients,
                                                 boolean cleanup)
        Accumulate the given gradients into the accrued gradients
        Parameters:
        accGradients - accrued gradients list object
        gradients - given gradients list object
        cleanup - clean up the given gradients list object
        Returns:
        new accrued gradients list object
      • accrueGradients

        public static ListObject accrueGradients​(ListObject accGradients,
                                                 ListObject gradients,
                                                 boolean par,
                                                 boolean cleanup)
        Accumulate the given gradients into the accrued gradients
        Parameters:
        accGradients - accrued gradients list object
        gradients - given gradients list object
        par - parallel execution
        cleanup - clean up the given gradients list object
        Returns:
        new accrued gradients list object
      • accrueModels

        public static ListObject accrueModels​(ListObject accModels,
                                              ListObject model,
                                              boolean cleanup)
        Accumulate the given models into the accrued accrueModels
        Parameters:
        accModels - accrued models list object
        model - given models list object
        cleanup - clean up the given models list object
        Returns:
        new accrued models list object
      • accrueModels

        public static ListObject accrueModels​(ListObject accModels,
                                              ListObject model,
                                              boolean par,
                                              boolean cleanup)
        Accumulate the given models into the accrued models
        Parameters:
        accModels - accrued models list object
        model - given models list object
        par - parallel execution
        cleanup - clean up the given models list object
        Returns:
        new accrued models list object