[jvm-packages] Expose json formatted booster dumps (#2233) (#2234)

* Change Booster dump from XGBoosterDumpModel to XGBoosterDumpModelEx

Allows exposing multiple formatting options of model dumping.
This commit is contained in:
ebernhardson
2017-04-29 20:23:09 -07:00
committed by Nan Zhu
parent c441d0916e
commit d3b866e3fd
5 changed files with 31 additions and 11 deletions

View File

@@ -231,6 +231,16 @@ public class BoosterImplTest {
testWithFastHisto(trainMat, watches, 10, paramMap, 0.0f);
}
@Test
public void testDumpModelJson() throws XGBoostError {
DMatrix trainMat = new DMatrix("../../demo/data/agaricus.txt.train");
DMatrix testMat = new DMatrix("../../demo/data/agaricus.txt.test");
Booster booster = trainBooster(trainMat, testMat);
String[] dump = booster.getModelDump("", false, "json");
TestCase.assertEquals(" { \"nodeid\":", dump[0].substring(0, 13));
}
@Test
public void testFastHistoDepthwiseMaxDepth() throws XGBoostError {
DMatrix trainMat = new DMatrix("../../demo/data/agaricus.txt.train");