use of edu.cmu.tetrad.data.DiscreteVariable in project tetrad by cmu-phil.
the class TestColtDataSet method testDiscrete.
@Test
public void testDiscrete() {
int rows = 10;
int cols = 5;
List<Node> variables = new LinkedList<>();
for (int i = 0; i < cols; i++) {
DiscreteVariable variable = new DiscreteVariable("X" + (i + 1), 3);
variables.add(variable);
}
DataSet dataSet = new ColtDataSet(rows, variables);
RandomUtil randomUtil = RandomUtil.getInstance();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
dataSet.setInt(i, j, randomUtil.nextInt(3));
}
}
ColtDataSet _dataSet = new ColtDataSet((ColtDataSet) dataSet);
assertEquals(dataSet, _dataSet);
}
Aggregations