Fix native/Native consistency in comments
This commit is contained in:
parent
fd3baf68f1
commit
375c106fcc
@ -59,7 +59,7 @@ public final class Booster {
|
||||
* init Booster from dMatrixs
|
||||
* @param params parameters
|
||||
* @param dMatrixs DMatrix array
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public Booster(Iterable<Entry<String, Object>> params, DMatrix[] dMatrixs) throws XGBoostError {
|
||||
init(dMatrixs);
|
||||
@ -73,7 +73,7 @@ public final class Booster {
|
||||
* load model from modelPath
|
||||
* @param params parameters
|
||||
* @param modelPath booster modelPath (model generated by booster.saveModel)
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public Booster(Iterable<Entry<String, Object>> params, String modelPath) throws XGBoostError {
|
||||
init(null);
|
||||
@ -103,7 +103,7 @@ public final class Booster {
|
||||
* set parameter
|
||||
* @param key param name
|
||||
* @param value param value
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public final void setParam(String key, String value) throws XGBoostError {
|
||||
ErrorHandle.checkCall(XgboostJNI.XGBoosterSetParam(handle, key, value));
|
||||
@ -112,7 +112,7 @@ public final class Booster {
|
||||
/**
|
||||
* set parameters
|
||||
* @param params parameters key-value map
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public void setParams(Iterable<Entry<String, Object>> params) throws XGBoostError {
|
||||
if(params!=null) {
|
||||
@ -127,7 +127,7 @@ public final class Booster {
|
||||
* Update (one iteration)
|
||||
* @param dtrain training data
|
||||
* @param iter current iteration number
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public void update(DMatrix dtrain, int iter) throws XGBoostError {
|
||||
ErrorHandle.checkCall(XgboostJNI.XGBoosterUpdateOneIter(handle, iter, dtrain.getHandle()));
|
||||
@ -138,7 +138,7 @@ public final class Booster {
|
||||
* @param dtrain training data
|
||||
* @param iter current iteration number
|
||||
* @param obj customized objective class
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public void update(DMatrix dtrain, int iter, IObjective obj) throws XGBoostError {
|
||||
float[][] predicts = predict(dtrain, true);
|
||||
@ -151,7 +151,7 @@ public final class Booster {
|
||||
* @param dtrain training data
|
||||
* @param grad first order of gradient
|
||||
* @param hess seconde order of gradient
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public void boost(DMatrix dtrain, float[] grad, float[] hess) throws XGBoostError {
|
||||
if(grad.length != hess.length) {
|
||||
@ -166,7 +166,7 @@ public final class Booster {
|
||||
* @param evalNames name for eval dmatrixs, used for check results
|
||||
* @param iter current eval iteration
|
||||
* @return eval information
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public String evalSet(DMatrix[] evalMatrixs, String[] evalNames, int iter) throws XGBoostError {
|
||||
long[] handles = dMatrixs2handles(evalMatrixs);
|
||||
@ -182,7 +182,7 @@ public final class Booster {
|
||||
* @param iter number of interations
|
||||
* @param eval custom evaluator
|
||||
* @return eval information
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public String evalSet(DMatrix[] evalMatrixs, String[] evalNames, int iter, IEvaluation eval) throws XGBoostError {
|
||||
String evalInfo = "";
|
||||
@ -202,7 +202,7 @@ public final class Booster {
|
||||
* @param evalNames name for eval dmatrixs, used for check results
|
||||
* @param iter current eval iteration
|
||||
* @return eval information
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public String evalSet(long[] dHandles, String[] evalNames, int iter) throws XGBoostError {
|
||||
String[] evalInfo = new String[1];
|
||||
@ -217,7 +217,7 @@ public final class Booster {
|
||||
* @param evalName evaluation name
|
||||
* @param iter number of iterations
|
||||
* @return eval information
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public String eval(DMatrix evalMat, String evalName, int iter) throws XGBoostError {
|
||||
DMatrix[] evalMats = new DMatrix[] {evalMat};
|
||||
@ -259,7 +259,7 @@ public final class Booster {
|
||||
* Predict with data
|
||||
* @param data dmatrix storing the input
|
||||
* @return predict result
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public float[][] predict(DMatrix data) throws XGBoostError {
|
||||
return pred(data, false, 0, false);
|
||||
@ -270,7 +270,7 @@ public final class Booster {
|
||||
* @param data dmatrix storing the input
|
||||
* @param outPutMargin Whether to output the raw untransformed margin value.
|
||||
* @return predict result
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public float[][] predict(DMatrix data, boolean outPutMargin) throws XGBoostError {
|
||||
return pred(data, outPutMargin, 0, false);
|
||||
@ -282,7 +282,7 @@ public final class Booster {
|
||||
* @param outPutMargin Whether to output the raw untransformed margin value.
|
||||
* @param treeLimit Limit number of trees in the prediction; defaults to 0 (use all trees).
|
||||
* @return predict result
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public float[][] predict(DMatrix data, boolean outPutMargin, int treeLimit) throws XGBoostError {
|
||||
return pred(data, outPutMargin, treeLimit, false);
|
||||
@ -297,7 +297,7 @@ public final class Booster {
|
||||
Note that the leaf index of a tree is unique per tree, so you may find leaf 1
|
||||
in both tree 1 and tree 0.
|
||||
* @return predict result
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public float[][] predict(DMatrix data , int treeLimit, boolean predLeaf) throws XGBoostError {
|
||||
return pred(data, false, treeLimit, predLeaf);
|
||||
@ -319,7 +319,7 @@ public final class Booster {
|
||||
* get the dump of the model as a string array
|
||||
* @param withStats Controls whether the split statistics are output.
|
||||
* @return dumped model information
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public String[] getDumpInfo(boolean withStats) throws XGBoostError {
|
||||
int statsFlag = 0;
|
||||
@ -336,7 +336,7 @@ public final class Booster {
|
||||
* @param featureMap featureMap file
|
||||
* @param withStats Controls whether the split statistics are output.
|
||||
* @return dumped model information
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public String[] getDumpInfo(String featureMap, boolean withStats) throws XGBoostError {
|
||||
int statsFlag = 0;
|
||||
@ -356,7 +356,7 @@ public final class Booster {
|
||||
* @throws FileNotFoundException file not found
|
||||
* @throws UnsupportedEncodingException unsupported feature
|
||||
* @throws IOException error with model writing
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public void dumpModel(String modelPath, boolean withStats) throws FileNotFoundException, UnsupportedEncodingException, IOException, XGBoostError {
|
||||
File tf = new File(modelPath);
|
||||
@ -383,7 +383,7 @@ public final class Booster {
|
||||
* @throws FileNotFoundException exception
|
||||
* @throws UnsupportedEncodingException exception
|
||||
* @throws IOException exception
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public void dumpModel(String modelPath, String featureMap, boolean withStats) throws FileNotFoundException, UnsupportedEncodingException, IOException, XGBoostError {
|
||||
File tf = new File(modelPath);
|
||||
@ -404,7 +404,7 @@ public final class Booster {
|
||||
/**
|
||||
* get importance of each feature
|
||||
* @return featureMap key: feature index, value: feature importance score
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public Map<String, Integer> getFeatureScore() throws XGBoostError {
|
||||
String[] modelInfos = getDumpInfo(false);
|
||||
@ -433,7 +433,7 @@ public final class Booster {
|
||||
* get importance of each feature
|
||||
* @param featureMap file to save dumped model info
|
||||
* @return featureMap key: feature index, value: feature importance score
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public Map<String, Integer> getFeatureScore(String featureMap) throws XGBoostError {
|
||||
String[] modelInfos = getDumpInfo(featureMap, false);
|
||||
|
||||
@ -52,7 +52,7 @@ public class DMatrix {
|
||||
/**
|
||||
* init DMatrix from file (svmlight format)
|
||||
* @param dataPath path of data file
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public DMatrix(String dataPath) throws XGBoostError {
|
||||
if(dataPath == null) {
|
||||
@ -69,7 +69,7 @@ public class DMatrix {
|
||||
* @param indices Indices (colIndexs for CSR or rowIndexs for CSC)
|
||||
* @param data non zero values (sequence by row for CSR or by col for CSC)
|
||||
* @param st sparse matrix type (CSR or CSC)
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public DMatrix(long[] headers, int[] indices, float[] data, SparseType st) throws XGBoostError {
|
||||
long[] out = new long[1];
|
||||
@ -130,7 +130,7 @@ public class DMatrix {
|
||||
* if specified, xgboost will start from this init margin
|
||||
* can be used to specify initial prediction to boost from
|
||||
* @param baseMargin base margin
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public void setBaseMargin(float[] baseMargin) throws XGBoostError {
|
||||
ErrorHandle.checkCall(XgboostJNI.XGDMatrixSetFloatInfo(handle, "base_margin", baseMargin));
|
||||
@ -140,7 +140,7 @@ public class DMatrix {
|
||||
* if specified, xgboost will start from this init margin
|
||||
* can be used to specify initial prediction to boost from
|
||||
* @param baseMargin base margin
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public void setBaseMargin(float[][] baseMargin) throws XGBoostError {
|
||||
float[] flattenMargin = flatten(baseMargin);
|
||||
@ -150,7 +150,7 @@ public class DMatrix {
|
||||
/**
|
||||
* Set group sizes of DMatrix (used for ranking)
|
||||
* @param group group size as array
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public void setGroup(int[] group) throws XGBoostError {
|
||||
ErrorHandle.checkCall(XgboostJNI.XGDMatrixSetGroup(handle, group));
|
||||
@ -171,7 +171,7 @@ public class DMatrix {
|
||||
/**
|
||||
* get label values
|
||||
* @return label
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public float[] getLabel() throws XGBoostError {
|
||||
return getFloatInfo("label");
|
||||
@ -180,7 +180,7 @@ public class DMatrix {
|
||||
/**
|
||||
* get weight of the DMatrix
|
||||
* @return weights
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public float[] getWeight() throws XGBoostError {
|
||||
return getFloatInfo("weight");
|
||||
@ -189,7 +189,7 @@ public class DMatrix {
|
||||
/**
|
||||
* get base margin of the DMatrix
|
||||
* @return base margin
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public float[] getBaseMargin() throws XGBoostError {
|
||||
return getFloatInfo("base_margin");
|
||||
@ -199,7 +199,7 @@ public class DMatrix {
|
||||
* Slice the DMatrix and return a new DMatrix that only contains `rowIndex`.
|
||||
* @param rowIndex row index
|
||||
* @return sliced new DMatrix
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public DMatrix slice(int[] rowIndex) throws XGBoostError {
|
||||
long[] out = new long[1];
|
||||
@ -212,7 +212,7 @@ public class DMatrix {
|
||||
/**
|
||||
* get the row number of DMatrix
|
||||
* @return number of rows
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public long rowNum() throws XGBoostError {
|
||||
long[] rowNum = new long[1];
|
||||
|
||||
@ -21,8 +21,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.dmlc.xgboost4j.wrapper.XgboostJNI;
|
||||
|
||||
/**
|
||||
* error handle for Xgboost
|
||||
* @author hzx
|
||||
* Error handle for Xgboost.
|
||||
*/
|
||||
public class ErrorHandle {
|
||||
private static final Log logger = LogFactory.getLog(ErrorHandle.class);
|
||||
@ -38,9 +37,9 @@ public class ErrorHandle {
|
||||
}
|
||||
|
||||
/**
|
||||
* check the return value of C API
|
||||
* Check the return value of C API.
|
||||
* @param ret return valud of xgboostJNI C API call
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError Native error
|
||||
* @throws org.dmlc.xgboost4j.util.XGBoostError native error
|
||||
*/
|
||||
public static void checkCall(int ret) throws XGBoostError {
|
||||
if(ret != 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user