* Change Booster dump from XGBoosterDumpModel to XGBoosterDumpModelEx Allows exposing multiple formatting options of model dumping.
This commit is contained in:
@@ -333,6 +333,11 @@ public class Booster implements Serializable, KryoSerializable {
|
||||
* @throws XGBoostError native error
|
||||
*/
|
||||
public String[] getModelDump(String featureMap, boolean withStats) throws XGBoostError {
|
||||
return getModelDump(featureMap, withStats, "text");
|
||||
}
|
||||
|
||||
public String[] getModelDump(String featureMap, boolean withStats, String format)
|
||||
throws XGBoostError {
|
||||
int statsFlag = 0;
|
||||
if (featureMap == null) {
|
||||
featureMap = "";
|
||||
@@ -340,9 +345,12 @@ public class Booster implements Serializable, KryoSerializable {
|
||||
if (withStats) {
|
||||
statsFlag = 1;
|
||||
}
|
||||
if (format == null) {
|
||||
format = "text";
|
||||
}
|
||||
String[][] modelInfos = new String[1][];
|
||||
JNIErrorHandle.checkCall(
|
||||
XGBoostJNI.XGBoosterDumpModel(handle, featureMap, statsFlag, modelInfos));
|
||||
XGBoostJNI.XGBoosterDumpModelEx(handle, featureMap, statsFlag, format, modelInfos));
|
||||
return modelInfos[0];
|
||||
}
|
||||
|
||||
@@ -389,7 +397,8 @@ public class Booster implements Serializable, KryoSerializable {
|
||||
statsFlag = 1;
|
||||
}
|
||||
String[][] modelInfos = new String[1][];
|
||||
JNIErrorHandle.checkCall(XGBoostJNI.XGBoosterDumpModel(handle, "", statsFlag, modelInfos));
|
||||
JNIErrorHandle.checkCall(XGBoostJNI.XGBoosterDumpModelEx(handle, "", statsFlag, "text",
|
||||
modelInfos));
|
||||
return modelInfos[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,8 @@ class XGBoostJNI {
|
||||
|
||||
public final static native int XGBoosterGetModelRaw(long handle, byte[][] out_bytes);
|
||||
|
||||
public final static native int XGBoosterDumpModel(long handle, String fmap, int with_stats,
|
||||
String[][] out_strings);
|
||||
public final static native int XGBoosterDumpModelEx(long handle, String fmap, int with_stats,
|
||||
String format, String[][] out_strings);
|
||||
|
||||
public final static native int XGBoosterGetAttr(long handle, String key, String[] out_string);
|
||||
public final static native int XGBoosterSetAttr(long handle, String key, String value);
|
||||
|
||||
Reference in New Issue
Block a user