External Gradient Tool Spec - TeamCohen/ProPPR GitHub Wiki
This is the spec for a tool which will allow us to "farm out" updates to certain features using a method other than ProPPR's stochastic gradient descent. The basic sketch was designed by William Cohen, William Y. Wang, and Katie Mazaitis on 8 April, 2015.
All code mentions below refer to branch externalGradientTool. Line numbers are tagged with a git version hash.
Data Types
Proposed New Class
GradientProvider
(or call it whatever you want)
- defines method
int[] updateGraph(ArrayLearningGraph g)
which modifiesg
in-place and returns a list of feature IDs which should not be regularized - defines method
void updateGradient(TIntDoubleMap gradient)
which modifiesgradient
in-place (setting the gradient of externally handled features to 0)
Arguments & Return Values
Graph: edu.cmu.ml.proppr.graph.ArrayLearningGraph
// looping through all edges with a particular label:
ArrayLearningGraph g = ...;
for (int i=0; i<g.label_feature_id.length; i++) {
// test feature string against some condition
if (meetsCondition( g.featureLibrary.getSymbol(g.label_feature_id[i]) )) {
// update feature edge weight in graph
g.label_feature_weight[i] = ...;
}
}
Feature stoplist: int[]
where indices are pulled from g.featureLibrary.getId(featureString)
Gradient: TIntDoubleMap
where keys are pulled from g.featureLibrary.getId(featureString)
Communication
First round: Make corrections to graph
A worker thread running in SRW
will call externalGradientTool.updateGraph(in.x.graph)
, retaining the returned int[]
feature stoplist. (inside SRW$SgdExample():370@5531c69
)
Scaffolding required (Katie todos):
- DONE
SRW
access toexternalGradientTool
- BREADCRUMBS
externalGradientTool
instantiation process inModuleConfiguration
- DRAFT Command line syntax for
externalGradientTool
Second round: Make corrections to gradient
SRW
will build the gradient of the parameter vector and then call externalGradientTool.updateGradient(gradient)
. (before SRW:330@373d20
)
Scaffolding required (Katie todos):
- DONE Wipe stoplisted elements back to zero after regularization call on
SRW:285