Description
A mojo model created on a workstation with LITTLE ENDIAN architecture, gives the following error when used to predict a score on a server with BIG ENDIAN architecture:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 10496
at hex.genmodel.algos.tree.SharedTreeMojoModel.scoreTree(SharedTreeMojoModel.java:136)
at hex.genmodel.algos.tree.SharedTreeMojoModel.scoreAllTrees(SharedTreeMojoModel.java:453)
at hex.genmodel.algos.gbm.GbmMojoModel.score0(GbmMojoModel.java:26)
at hex.genmodel.algos.gbm.GbmMojoModel.score0(GbmMojoModel.java:50)
at hex.genmodel.easy.EasyPredictModelWrapper.predict(EasyPredictModelWrapper.java:663)
at hex.genmodel.easy.EasyPredictModelWrapper.preamble(EasyPredictModelWrapper.java:535)
at hex.genmodel.easy.EasyPredictModelWrapper.predictBinomial(EasyPredictModelWrapper.java:368)
The problem is related with the 'endianness' used by the ByteBufferWrapper class to parse compressed trees; this class is implemented to use native byte order of the server, causing error when the byte order is different from the byte order used in compressing model's trees.
We suggest to use the 'endianness' saved in the model.ini file of mojo zip to configure the endianness in the ByteBufferWrapper and correctly read model's binary data.