in liblinear-addon/src/main/java/LiblinearModel.java [65:93]
public LiblinearModel(InputStream in) throws IOException {
try (DataInputStream di = new DataInputStream(in)) {
int modelByteLength = di.readInt();
// TODO: We should have a fixed memory limit here ...
byte[] modelBytes = new byte[modelByteLength];
di.read(modelBytes);
int outcomeLabelLength = di.readInt();
outcomeLabels = new String[outcomeLabelLength];
for (int i = 0; i < outcomeLabelLength; i++) {
outcomeLabels[i] = di.readUTF();
}
predMap = new HashMap<>();
int predMapSize = di.readInt();
for (int i = 0; i < predMapSize; i++) {
String key = di.readUTF();
int value = di.readInt();
predMap.put(key, value);
}
model = Linear.loadModel(new InputStreamReader(new ByteArrayInputStream(modelBytes), LIBLINEAR_MODEL_ENCODING));
}
}