Package edu.pitt.csb.mgm
Class MixedUtils
java.lang.Object
edu.pitt.csb.mgm.MixedUtils
Created by ajsedgewick on 7/29/15.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int[][]allEdgeStats(Graph pT, Graph pE) static int[][]static double[]arrayPermute(double[] a) static int[]arrayPermute(int[] a) static int[]colMax(cern.colt.matrix.DoubleMatrix2D m) return vector of the maximum of each column in m (as ints, i.e.static DataSetMakes a deep copy of a dataset (Nodes copied as well).static double[]evenSplitVector(double w, int L) static GeneralizedSemImstatic GeneralizedSemImGaussianCategoricalIm(GeneralizedSemPm pm, boolean discParamRand) This method is needed to normalize edge parameters for an Instantiated Mixed Model Generates edge parameters for c-d and d-d edges from a single weight, abs(w), drawn by the normal IM constructor.static GeneralizedSemPmGaussianCategoricalPm(Graph trueGraph, String paramTemplate) static GeneralizedSemPmGaussianTrinaryPm(Graph trueGraph, HashMap<String, String> nodeDists, int maxSample, String paramTemplate) static double[]generateMixedEdgeParams(double w, int L) static DataSetstatic int[]getContinuousInds(List<Node> nodes) static int[]getDiscLevels(DataSet ds) static DataSetstatic int[]getDiscreteInds(List<Node> nodes) getEdgeParams(Node n1, Node n2, GeneralizedSemPm pm) getEdgeParams(String s1, String s2, GeneralizedSemPm pm) static cern.colt.matrix.DoubleMatrix2DgraphToMatrix(Graph graph) static cern.colt.matrix.DoubleMatrix2DgraphToMatrix(Graph graph, double undirectedWeight, double directedWeight) static IndependenceTestIndTestFromString(String name, DataSet data, double alpha) Returns independence tests by name located in edu.cmu.tetrad.search and edu.pitt.csb.mgm also supports shorthand for LRT ("lrt) and t-tests ("tlin" for prefer linear (fastest) or "tlog" for prefer logistic)static booleanisColinear(DataSet ds, boolean verbose) Check each pair of variables to see if correlation is 1.static DataSetstatic DataSetloadDataSet(String dir, String filename) static DataSetstatic voidstatic DataSetmakeContinuousData(DataSet dsMix) static DataSetmakeMixedData(DataSet dsCont, Map<String, Integer> nodeDists) static DataSetmakeMixedData(DataSet dsCont, Map<String, String> nodeDists, int numCategories) static GraphmakeMixedGraph(Graph g, Map<String, Integer> m) static doublenumVals(cern.colt.matrix.DoubleMatrix1D vec) static voidsetStartsWith(String sta, String template, GeneralizedSemPm pm) Set all existing parameters that begins with sta to template and also set template for any new parametersstatic cern.colt.matrix.DoubleMatrix2DskeletonToMatrix(Graph graph) static StringstringFrom2dArray(int[][] arr) valSet(cern.colt.matrix.DoubleMatrix1D vec) static doublevecMax(cern.colt.matrix.DoubleMatrix1D vec)
-
Field Details
-
EdgeStatHeader
- See Also:
-
-
Constructor Details
-
MixedUtils
public MixedUtils()
-
-
Method Details
-
getDiscreteInds
-
getContinuousInds
-
makeContinuousData
-
makeMixedData
-
makeMixedData
-
deepCopy
Makes a deep copy of a dataset (Nodes copied as well). Useful for paralellization- Parameters:
ds- dataset to be copied
-
getContinousData
-
getDiscreteData
-
getDiscLevels
-
colMax
public static int[] colMax(cern.colt.matrix.DoubleMatrix2D m) return vector of the maximum of each column in m (as ints, i.e. for discrete data)- Parameters:
m-- Returns:
-
vecMax
public static double vecMax(cern.colt.matrix.DoubleMatrix1D vec) -
numVals
public static double numVals(cern.colt.matrix.DoubleMatrix1D vec) -
valSet
-
GaussianTrinaryPm
public static GeneralizedSemPm GaussianTrinaryPm(Graph trueGraph, HashMap<String, String> nodeDists, int maxSample, String paramTemplate) throws IllegalStateException- Throws:
IllegalStateException
-
GaussianCategoricalPm
public static GeneralizedSemPm GaussianCategoricalPm(Graph trueGraph, String paramTemplate) throws IllegalStateException - Throws:
IllegalStateException
-
setStartsWith
Set all existing parameters that begins with sta to template and also set template for any new parameters -
GaussianCategoricalIm
-
GaussianCategoricalIm
This method is needed to normalize edge parameters for an Instantiated Mixed Model Generates edge parameters for c-d and d-d edges from a single weight, abs(w), drawn by the normal IM constructor. Abs(w) is used for d-d edges.For deterministic, c-d are evenly spaced between -w and w, and d-d are a matrix with w on the diagonal and -w/(categories-1) in the rest. For random, c-d params are uniformly drawn from 0 to 1 then transformed to have w as max value and sum to 0.
- Parameters:
pm-discParamRand- true for random edge generation behavior, false for deterministic- Returns:
-
getEdgeParams
-
arrayPermute
public static double[] arrayPermute(double[] a) -
arrayPermute
public static int[] arrayPermute(int[] a) -
evenSplitVector
public static double[] evenSplitVector(double w, int L) -
getEdgeParams
-
generateMixedEdgeParams
public static double[] generateMixedEdgeParams(double w, int L) -
allEdgeStats
-
allEdgeStats
-
makeMixedGraph
-
stringFrom2dArray
-
loadDataSet
- Throws:
IOException
-
loadDelim
- Throws:
IOException
-
getNodeDists
-
loadData
- Throws:
IOException
-
isColinear
Check each pair of variables to see if correlation is 1. WARNING: calculates correlation matrix, memory heavy when there are lots of variables- Parameters:
ds-verbose-- Returns:
-
graphToMatrix
public static cern.colt.matrix.DoubleMatrix2D graphToMatrix(Graph graph, double undirectedWeight, double directedWeight) -
skeletonToMatrix
-
graphToMatrix
-
IndTestFromString
Returns independence tests by name located in edu.cmu.tetrad.search and edu.pitt.csb.mgm also supports shorthand for LRT ("lrt) and t-tests ("tlin" for prefer linear (fastest) or "tlog" for prefer logistic)- Parameters:
name-- Returns:
-
main
-