Package edu.pitt.csb.mgm
Class MGM
java.lang.Object
edu.pitt.csb.mgm.ConvexProximal
edu.pitt.csb.mgm.MGM
- All Implemented Interfaces:
GraphSearch
Implementation of Lee and Hastie's (2012) pseudolikelihood method for learning
Mixed Gaussian-Categorical Graphical Models
Created by ajsedgewick on 7/15/15.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncern.colt.matrix.DoubleMatrix2DConverts MGM to matrix of doubles.static cern.colt.matrix.DoubleMatrix1Dflatten(cern.colt.matrix.DoubleMatrix2D m) longReturn time of execution for learning.Converts MGM object to Graph object with edges if edge parameters are non-zero.voidlearn(double epsilon, int iterLimit) Learn MGM traditional way with objective function tolerance.voidlearnEdges(int iterLimit) Learn MGM using edge convergence using default 3 iterations of no edge changes.voidlearnEdges(int iterLimit, int edgeChangeTol) Learn MGM using edge convergence using edgeChangeTol (see ProximalGradient for documentation).static voiddoublenonSmooth(double t, cern.colt.matrix.DoubleMatrix1D X, cern.colt.matrix.DoubleMatrix1D pX) Calculates penalty term and proximal operator at the same time for speeddoublenonSmoothValue(cern.colt.matrix.DoubleMatrix1D parIn) Calculates penalty term of objective functioncern.colt.matrix.DoubleMatrix1DproximalOperator(double t, cern.colt.matrix.DoubleMatrix1D X) A proximal operator for the MGMsearch()Simple search command for GraphSearch implementation.voidsetParams(MGM.MGMParams newParams) doublesmooth(cern.colt.matrix.DoubleMatrix1D parIn, cern.colt.matrix.DoubleMatrix1D gradOutVec) non-penalized -log(pseudolikelihood) this is the smooth function g(x) in prox gradient this overloaded version calculates both nll and the smooth gradient at the same time any value in gradOut will be replaced by the new calculationscern.colt.matrix.DoubleMatrix1DsmoothGradient(cern.colt.matrix.DoubleMatrix1D parIn) Gradient of the pseudolikelihooddoublesmoothValue(cern.colt.matrix.DoubleMatrix1D parIn) non-penalized -log(pseudolikelihood) this is the smooth function g(x) in prox gradientstatic cern.colt.matrix.DoubleMatrix2DupperTri(cern.colt.matrix.DoubleMatrix2D mat, int di)
-
Constructor Details
-
MGM
-
MGM
-
-
Method Details
-
setParams
-
flatten
public static cern.colt.matrix.DoubleMatrix1D flatten(cern.colt.matrix.DoubleMatrix2D m) -
smoothValue
public double smoothValue(cern.colt.matrix.DoubleMatrix1D parIn) non-penalized -log(pseudolikelihood) this is the smooth function g(x) in prox gradient- Parameters:
parIn-- Returns:
-
smooth
public double smooth(cern.colt.matrix.DoubleMatrix1D parIn, cern.colt.matrix.DoubleMatrix1D gradOutVec) non-penalized -log(pseudolikelihood) this is the smooth function g(x) in prox gradient this overloaded version calculates both nll and the smooth gradient at the same time any value in gradOut will be replaced by the new calculations- Overrides:
smoothin classConvexProximal- Parameters:
parIn-gradOutVec-- Returns:
-
nonSmoothValue
public double nonSmoothValue(cern.colt.matrix.DoubleMatrix1D parIn) Calculates penalty term of objective function- Parameters:
parIn-- Returns:
-
smoothGradient
public cern.colt.matrix.DoubleMatrix1D smoothGradient(cern.colt.matrix.DoubleMatrix1D parIn) Gradient of the pseudolikelihood- Parameters:
parIn-- Returns:
-
proximalOperator
public cern.colt.matrix.DoubleMatrix1D proximalOperator(double t, cern.colt.matrix.DoubleMatrix1D X) A proximal operator for the MGM- Parameters:
t- parameter for operator, must be positiveX- input vector to operator- Returns:
- output vector, same dimension as X
-
nonSmooth
public double nonSmooth(double t, cern.colt.matrix.DoubleMatrix1D X, cern.colt.matrix.DoubleMatrix1D pX) Calculates penalty term and proximal operator at the same time for speed- Overrides:
nonSmoothin classConvexProximal- Parameters:
t- proximal operator parameterX- inputpX- prox operator solution- Returns:
- value of penalty term
-
learn
public void learn(double epsilon, int iterLimit) Learn MGM traditional way with objective function tolerance. Recommended for inference applications that need accurate pseudolikelihood- Parameters:
epsilon- tolerance in change of objective functioniterLimit- iteration limit
-
learnEdges
public void learnEdges(int iterLimit) Learn MGM using edge convergence using default 3 iterations of no edge changes. Recommended when we only care about edge existence.- Parameters:
iterLimit-
-
learnEdges
public void learnEdges(int iterLimit, int edgeChangeTol) Learn MGM using edge convergence using edgeChangeTol (see ProximalGradient for documentation). Recommended when we only care about edge existence.- Parameters:
iterLimit-edgeChangeTol-
-
graphFromMGM
Converts MGM object to Graph object with edges if edge parameters are non-zero. Loses all edge param information- Returns:
-
adjMatFromMGM
public cern.colt.matrix.DoubleMatrix2D adjMatFromMGM()Converts MGM to matrix of doubles. uses 2-norm to combine c-d edge parameters into single value and f-norm for d-d edge parameters.- Returns:
-
search
Simple search command for GraphSearch implementation. Uses default edge convergence, 1000 iter limit.- Specified by:
searchin interfaceGraphSearch- Returns:
-
getElapsedTime
public long getElapsedTime()Return time of execution for learning.- Returns:
-
upperTri
public static cern.colt.matrix.DoubleMatrix2D upperTri(cern.colt.matrix.DoubleMatrix2D mat, int di) -
main
-