public class ParamservUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
PS_FUNC_PREFIX |
static long |
SEED |
Constructor and Description |
---|
ParamservUtils() |
Modifier and Type | Method and Description |
---|---|
static ListObject |
accrueGradients(ListObject accGradients,
ListObject gradients,
boolean cleanup)
Accumulate the given gradients into the accrued gradients
|
static ListObject |
accrueGradients(ListObject accGradients,
ListObject gradients,
boolean par,
boolean cleanup)
Accumulate the given gradients into the accrued gradients
|
static org.apache.spark.api.java.JavaPairRDD<Long,scala.Tuple2<MatrixBlock,MatrixBlock>> |
assembleTrainingData(org.apache.spark.api.java.JavaPairRDD<MatrixIndexes,MatrixBlock> featuresRDD,
org.apache.spark.api.java.JavaPairRDD<MatrixIndexes,MatrixBlock> labelsRDD)
Assemble the matrix of features and labels according to the rowID
|
static MatrixBlock |
cbindMatrix(MatrixBlock left,
MatrixBlock right) |
static void |
cleanupData(ExecutionContext ec,
Data data) |
static void |
cleanupData(ExecutionContext ec,
String varName) |
static void |
cleanupListObject(ExecutionContext ec,
ListObject lo) |
static void |
cleanupListObject(ExecutionContext ec,
ListObject lo,
boolean[] status) |
static void |
cleanupListObject(ExecutionContext ec,
String lName)
Clean up the list object according to its own data status
|
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)
|
static void |
cleanupListObject(ListObject lo) |
static List<ExecutionContext> |
copyExecutionContext(ExecutionContext ec,
int num) |
static ListObject |
copyList(ListObject lo,
boolean cleanup)
Deep copy the list object
|
static ExecutionContext |
createExecutionContext(ExecutionContext ec,
LocalVariableMap varsMap,
String updFunc,
String aggFunc,
int k) |
static MatrixObject |
createShallowCopy(MatrixObject mo) |
static org.apache.spark.api.java.JavaPairRDD<Integer,scala.Tuple2<MatrixBlock,MatrixBlock>> |
doPartitionOnSpark(SparkExecutionContext sec,
MatrixObject features,
MatrixObject labels,
Statement.PSScheme scheme,
int workerNum) |
static MatrixBlock |
generatePermutation(int numEntries,
long seed)
Generate the permutation
|
static MatrixObject |
newMatrixObject(MatrixBlock mb) |
static MatrixObject |
newMatrixObject(MatrixBlock mb,
boolean cleanup) |
static void |
recompileProgramBlocks(int k,
List<ProgramBlock> pbs) |
static MatrixObject |
sliceMatrix(MatrixObject mo,
long rl,
long rh)
Slice the matrix
|
static MatrixBlock |
sliceMatrixBlock(MatrixBlock mb,
long rl,
long rh)
Slice the matrix block and return a matrix block
(used in spark)
|
public static final String PS_FUNC_PREFIX
public static long SEED
public static ListObject copyList(ListObject lo, boolean cleanup)
lo
- list objectcleanup
- clean up the given list objectpublic static void cleanupListObject(ExecutionContext ec, String lName)
ec
- execution contextlName
- list var namepublic static void cleanupListObject(ExecutionContext ec, String lName, boolean[] status)
ec
- execution contextlName
- list var namestatus
- data statuspublic static void cleanupListObject(ExecutionContext ec, ListObject lo)
public static void cleanupListObject(ExecutionContext ec, ListObject lo, boolean[] status)
public static void cleanupData(ExecutionContext ec, Data data)
public static void cleanupData(ExecutionContext ec, String varName)
public static void cleanupListObject(ListObject lo)
public static MatrixObject newMatrixObject(MatrixBlock mb)
public static MatrixObject newMatrixObject(MatrixBlock mb, boolean cleanup)
public static MatrixObject createShallowCopy(MatrixObject mo)
public static MatrixObject sliceMatrix(MatrixObject mo, long rl, long rh)
mo
- input matrixrl
- low boundaryrh
- high boundarypublic static MatrixBlock sliceMatrixBlock(MatrixBlock mb, long rl, long rh)
mb
- input matrixrl
- low boundaryrh
- high boundarypublic static MatrixBlock generatePermutation(int numEntries, long seed)
numEntries
- permutation sizeseed
- seed used to generate random numberpublic static ExecutionContext createExecutionContext(ExecutionContext ec, LocalVariableMap varsMap, String updFunc, String aggFunc, int k)
public static List<ExecutionContext> copyExecutionContext(ExecutionContext ec, int num)
public static void recompileProgramBlocks(int k, List<ProgramBlock> pbs)
public static MatrixBlock cbindMatrix(MatrixBlock left, MatrixBlock right)
public static org.apache.spark.api.java.JavaPairRDD<Long,scala.Tuple2<MatrixBlock,MatrixBlock>> assembleTrainingData(org.apache.spark.api.java.JavaPairRDD<MatrixIndexes,MatrixBlock> featuresRDD, org.apache.spark.api.java.JavaPairRDD<MatrixIndexes,MatrixBlock> labelsRDD)
featuresRDD
- indexed features matrix blocklabelsRDD
- indexed labels matrix blockpublic static org.apache.spark.api.java.JavaPairRDD<Integer,scala.Tuple2<MatrixBlock,MatrixBlock>> doPartitionOnSpark(SparkExecutionContext sec, MatrixObject features, MatrixObject labels, Statement.PSScheme scheme, int workerNum)
public static ListObject accrueGradients(ListObject accGradients, ListObject gradients, boolean cleanup)
accGradients
- accrued gradients list objectgradients
- given gradients list objectcleanup
- clean up the given gradients list objectpublic static ListObject accrueGradients(ListObject accGradients, ListObject gradients, boolean par, boolean cleanup)
accGradients
- accrued gradients list objectgradients
- given gradients list objectpar
- parallel executioncleanup
- clean up the given gradients list objectCopyright © 2020 The Apache Software Foundation. All rights reserved.