use of edu.cmu.tetrad.data.BoxDataSet in project tetrad by cmu-phil.
the class DataConvertUtils method toMixedDataBox.
public static DataModel toMixedDataBox(MixedTabularDataset mixedTabularDataset) {
int numOfRows = mixedTabularDataset.getNumOfRows();
MixedVarInfo[] mixedVarInfos = mixedTabularDataset.getMixedVarInfos();
double[][] continuousData = mixedTabularDataset.getContinuousData();
int[][] discreteData = mixedTabularDataset.getDiscreteData();
List<Node> nodes = new LinkedList<>();
for (MixedVarInfo mixedVarInfo : mixedVarInfos) {
if (mixedVarInfo.isContinuous()) {
nodes.add(new ContinuousVariable(mixedVarInfo.getName()));
} else {
nodes.add(new DiscreteVariable(mixedVarInfo.getName(), mixedVarInfo.getCategories()));
}
}
return new BoxDataSet(new MixedDataBox(nodes, numOfRows, continuousData, discreteData), nodes);
}
use of edu.cmu.tetrad.data.BoxDataSet in project tetrad by cmu-phil.
the class DataConvertUtils method toContinuousDataModel.
public static DataModel toContinuousDataModel(ContinuousTabularDataset dataset) {
DataBox dataBox = new DoubleDataBox(dataset.getData());
List<Node> variables = toNodes(dataset.getVariables());
return new BoxDataSet(dataBox, variables);
}
use of edu.cmu.tetrad.data.BoxDataSet in project tetrad by cmu-phil.
the class DataConvertUtils method toVerticalDiscreteDataModel.
public static DataModel toVerticalDiscreteDataModel(VerticalDiscreteTabularDataset dataset) {
DataBox dataBox = new VerticalIntDataBox(dataset.getData());
List<Node> variables = toNodes(dataset.getVariableInfos());
return new BoxDataSet(dataBox, variables);
}
Aggregations