use of org.knime.core.data.vector.bitvector.BitVectorValue in project knime-core by knime.
the class AbstractTreeEnsembleModel method createBitVectorPredictorRecord.
private PredictorRecord createBitVectorPredictorRecord(final DataRow filterRow) {
assert filterRow.getNumCells() == 1 : "Expected one cell as bit vector data";
DataCell c = filterRow.getCell(0);
if (c.isMissing()) {
return null;
}
BitVectorValue bv = (BitVectorValue) c;
final long length = bv.length();
if (length != getMetaData().getNrAttributes()) {
throw new IllegalArgumentException("The bit-vector in " + filterRow.getKey().getString() + " has the wrong length. (" + length + " instead of " + getMetaData().getNrAttributes() + ")");
}
Map<String, Object> valueMap = new LinkedHashMap<String, Object>((int) (length / 0.75 + 1.0));
for (int i = 0; i < length; i++) {
valueMap.put(TreeBitColumnMetaData.getAttributeName(i), Boolean.valueOf(bv.get(i)));
}
return new PredictorRecord(valueMap);
}
Aggregations