minor fix

This commit is contained in:
yanqingmen 2015-07-06 20:56:17 +08:00
parent f73bcd427d
commit e99ab0d1dd
2 changed files with 7 additions and 2 deletions

View File

@ -76,14 +76,16 @@ public final class Booster {
* @throws org.dmlc.xgboost4j.util.XgboostError * @throws org.dmlc.xgboost4j.util.XgboostError
*/ */
public Booster(Iterable<Entry<String, Object>> params, String modelPath) throws XgboostError { public Booster(Iterable<Entry<String, Object>> params, String modelPath) throws XgboostError {
long[] out = new long[1];
init(null); init(null);
if(modelPath == null) {
throw new NullPointerException("modelPath : null");
}
loadModel(modelPath); loadModel(modelPath);
setParam("seed","0"); setParam("seed","0");
setParams(params); setParams(params);
} }
private void init(DMatrix[] dMatrixs) throws XgboostError { private void init(DMatrix[] dMatrixs) throws XgboostError {

View File

@ -55,6 +55,9 @@ public class DMatrix {
* @throws org.dmlc.xgboost4j.util.XgboostError * @throws org.dmlc.xgboost4j.util.XgboostError
*/ */
public DMatrix(String dataPath) throws XgboostError { public DMatrix(String dataPath) throws XgboostError {
if(dataPath == null) {
throw new NullPointerException("dataPath: null");
}
long[] out = new long[1]; long[] out = new long[1];
ErrorHandle.checkCall(XgboostJNI.XGDMatrixCreateFromFile(dataPath, 1, out)); ErrorHandle.checkCall(XgboostJNI.XGDMatrixCreateFromFile(dataPath, 1, out));
handle = out[0]; handle = out[0];