Search in sources :

Example 1 with CellTable

use of edu.cmu.tetrad.data.CellTable in project tetrad by cmu-phil.

the class TestCellTable method setUp.

public final void setUp() {
    this.table = new CellTable(dims);
    // // Add data to table.
    List<Node> variables = new LinkedList<>();
    variables.add(new DiscreteVariable("X1", 2));
    variables.add(new DiscreteVariable("X2", 2));
    variables.add(new DiscreteVariable("X3", 2));
    variables.add(new DiscreteVariable("X4", 2));
    DataSet dataSet = new ColtDataSet(data.length, variables);
    for (int i = 0; i < data.length; i++) {
        for (int j = 0; j < data[0].length; j++) {
            dataSet.setInt(i, j, data[i][j]);
        }
    }
    int[] indices = new int[] { 0, 1, 2, 3 };
    this.table.addToTable(dataSet, indices);
}
Also used : DiscreteVariable(edu.cmu.tetrad.data.DiscreteVariable) ColtDataSet(edu.cmu.tetrad.data.ColtDataSet) CellTable(edu.cmu.tetrad.data.CellTable) DataSet(edu.cmu.tetrad.data.DataSet) ColtDataSet(edu.cmu.tetrad.data.ColtDataSet) Node(edu.cmu.tetrad.graph.Node) LinkedList(java.util.LinkedList)

Aggregations

CellTable (edu.cmu.tetrad.data.CellTable)1 ColtDataSet (edu.cmu.tetrad.data.ColtDataSet)1 DataSet (edu.cmu.tetrad.data.DataSet)1 DiscreteVariable (edu.cmu.tetrad.data.DiscreteVariable)1 Node (edu.cmu.tetrad.graph.Node)1 LinkedList (java.util.LinkedList)1