rename files/packages
This commit is contained in:
parent
55e36893cd
commit
f8fff6c6fc
2
Makefile
2
Makefile
@ -84,7 +84,7 @@ $(DMLC_CORE)/libdmlc.a:
|
|||||||
$(RABIT)/lib/$(LIB_RABIT):
|
$(RABIT)/lib/$(LIB_RABIT):
|
||||||
+ cd $(RABIT); make lib/$(LIB_RABIT); cd $(ROOTDIR)
|
+ cd $(RABIT); make lib/$(LIB_RABIT); cd $(ROOTDIR)
|
||||||
|
|
||||||
jvm-packages: jvm-packages/lib/libxgboost4j.so
|
jvm: jvm-packages/lib/libxgboost4j.so
|
||||||
|
|
||||||
SRC = $(wildcard src/*.cc src/*/*.cc)
|
SRC = $(wildcard src/*.cc src/*/*.cc)
|
||||||
ALL_OBJ = $(patsubst src/%.cc, build/%.o, $(SRC)) $(PLUGIN_OBJS)
|
ALL_OBJ = $(patsubst src/%.cc, build/%.o, $(SRC)) $(PLUGIN_OBJS)
|
||||||
|
|||||||
@ -29,5 +29,5 @@
|
|||||||
|
|
||||||
<suppressions>
|
<suppressions>
|
||||||
<suppress checks=".*"
|
<suppress checks=".*"
|
||||||
files="xgboost4j/src/main/java/org/dmlc/xgboost4j/XgboostJNI.java"/>
|
files="xgboost4j/src/main/java/ml/dmlc/xgboost4j/XgboostJNI.java"/>
|
||||||
</suppressions>
|
</suppressions>
|
||||||
|
|||||||
@ -17,4 +17,4 @@ exit
|
|||||||
:end
|
:end
|
||||||
echo "source library not found, please build it first from ..\windows\xgboost.sln"
|
echo "source library not found, please build it first from ..\windows\xgboost.sln"
|
||||||
pause
|
pause
|
||||||
exit
|
exit
|
||||||
@ -16,7 +16,7 @@ if [ $(uname) == "Darwin" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
make jvm-packages no_omp=${dis_omp}
|
make jvm no_omp=${dis_omp}
|
||||||
cd jvm-packages
|
cd jvm-packages
|
||||||
echo "move native lib"
|
echo "move native lib"
|
||||||
|
|
||||||
@ -13,17 +13,19 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j.demo;
|
package ml.dmlc.xgboost4j.demo;
|
||||||
|
|
||||||
import org.dmlc.xgboost4j.*;
|
|
||||||
import org.dmlc.xgboost4j.demo.util.DataLoader;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import ml.dmlc.xgboost4j.Booster;
|
||||||
|
import ml.dmlc.xgboost4j.DMatrix;
|
||||||
|
import ml.dmlc.xgboost4j.XGBoost;
|
||||||
|
import ml.dmlc.xgboost4j.XGBoostError;
|
||||||
|
import ml.dmlc.xgboost4j.demo.util.DataLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a simple example of java wrapper for xgboost
|
* a simple example of java wrapper for xgboost
|
||||||
*
|
*
|
||||||
@ -13,12 +13,15 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j.demo;
|
package ml.dmlc.xgboost4j.demo;
|
||||||
|
|
||||||
import org.dmlc.xgboost4j.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import ml.dmlc.xgboost4j.Booster;
|
||||||
|
import ml.dmlc.xgboost4j.DMatrix;
|
||||||
|
import ml.dmlc.xgboost4j.XGBoost;
|
||||||
|
import ml.dmlc.xgboost4j.XGBoostError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* example for start from a initial base prediction
|
* example for start from a initial base prediction
|
||||||
*
|
*
|
||||||
@ -13,15 +13,15 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j.demo;
|
package ml.dmlc.xgboost4j.demo;
|
||||||
|
|
||||||
import org.dmlc.xgboost4j.DMatrix;
|
|
||||||
import org.dmlc.xgboost4j.XGBoost;
|
|
||||||
import org.dmlc.xgboost4j.XGBoostError;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import ml.dmlc.xgboost4j.DMatrix;
|
||||||
|
import ml.dmlc.xgboost4j.XGBoost;
|
||||||
|
import ml.dmlc.xgboost4j.XGBoostError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* an example of cross validation
|
* an example of cross validation
|
||||||
*
|
*
|
||||||
@ -13,16 +13,16 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j.demo;
|
package ml.dmlc.xgboost4j.demo;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.dmlc.xgboost4j.*;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import ml.dmlc.xgboost4j.*;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* an example user define objective and eval
|
* an example user define objective and eval
|
||||||
* NOTE: when you do customized loss function, the default prediction value is margin
|
* NOTE: when you do customized loss function, the default prediction value is margin
|
||||||
@ -64,7 +64,7 @@ public class CustomObjective {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<float[]> getGradient(float[][] predicts, org.dmlc.xgboost4j.DMatrix dtrain) {
|
public List<float[]> getGradient(float[][] predicts, DMatrix dtrain) {
|
||||||
int nrow = predicts.length;
|
int nrow = predicts.length;
|
||||||
List<float[]> gradients = new ArrayList<float[]>();
|
List<float[]> gradients = new ArrayList<float[]>();
|
||||||
float[] labels;
|
float[] labels;
|
||||||
@ -114,7 +114,7 @@ public class CustomObjective {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float eval(float[][] predicts, org.dmlc.xgboost4j.DMatrix dmat) {
|
public float eval(float[][] predicts, DMatrix dmat) {
|
||||||
float error = 0f;
|
float error = 0f;
|
||||||
float[] labels;
|
float[] labels;
|
||||||
try {
|
try {
|
||||||
@ -138,11 +138,9 @@ public class CustomObjective {
|
|||||||
|
|
||||||
public static void main(String[] args) throws XGBoostError {
|
public static void main(String[] args) throws XGBoostError {
|
||||||
//load train mat (svmlight format)
|
//load train mat (svmlight format)
|
||||||
org.dmlc.xgboost4j.DMatrix trainMat =
|
DMatrix trainMat = new DMatrix("../../demo/data/agaricus.txt.train");
|
||||||
new org.dmlc.xgboost4j.DMatrix("../../demo/data/agaricus.txt.train");
|
|
||||||
//load valid mat (svmlight format)
|
//load valid mat (svmlight format)
|
||||||
org.dmlc.xgboost4j.DMatrix testMat =
|
DMatrix testMat = new DMatrix("../../demo/data/agaricus.txt.test");
|
||||||
new org.dmlc.xgboost4j.DMatrix("../../demo/data/agaricus.txt.test");
|
|
||||||
|
|
||||||
HashMap<String, Object> params = new HashMap<String, Object>();
|
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||||
params.put("eta", 1.0);
|
params.put("eta", 1.0);
|
||||||
@ -154,8 +152,7 @@ public class CustomObjective {
|
|||||||
int round = 2;
|
int round = 2;
|
||||||
|
|
||||||
//specify watchList
|
//specify watchList
|
||||||
HashMap<String, org.dmlc.xgboost4j.DMatrix> watches =
|
HashMap<String, DMatrix> watches = new HashMap<String, DMatrix>();
|
||||||
new HashMap<String, org.dmlc.xgboost4j.DMatrix>();
|
|
||||||
watches.put("train", trainMat);
|
watches.put("train", trainMat);
|
||||||
watches.put("test", testMat);
|
watches.put("test", testMat);
|
||||||
|
|
||||||
@ -13,12 +13,15 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j.demo;
|
package ml.dmlc.xgboost4j.demo;
|
||||||
|
|
||||||
import org.dmlc.xgboost4j.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import ml.dmlc.xgboost4j.Booster;
|
||||||
|
import ml.dmlc.xgboost4j.DMatrix;
|
||||||
|
import ml.dmlc.xgboost4j.XGBoost;
|
||||||
|
import ml.dmlc.xgboost4j.XGBoostError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* simple example for using external memory version
|
* simple example for using external memory version
|
||||||
*
|
*
|
||||||
@ -13,10 +13,13 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j.demo;
|
package ml.dmlc.xgboost4j.demo;
|
||||||
|
|
||||||
import org.dmlc.xgboost4j.*;
|
import ml.dmlc.xgboost4j.Booster;
|
||||||
import org.dmlc.xgboost4j.demo.util.CustomEval;
|
import ml.dmlc.xgboost4j.DMatrix;
|
||||||
|
import ml.dmlc.xgboost4j.XGBoost;
|
||||||
|
import ml.dmlc.xgboost4j.XGBoostError;
|
||||||
|
import ml.dmlc.xgboost4j.demo.util.CustomEval;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
@ -13,13 +13,16 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j.demo;
|
package ml.dmlc.xgboost4j.demo;
|
||||||
|
|
||||||
import org.dmlc.xgboost4j.*;
|
|
||||||
import org.dmlc.xgboost4j.demo.util.CustomEval;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import ml.dmlc.xgboost4j.Booster;
|
||||||
|
import ml.dmlc.xgboost4j.DMatrix;
|
||||||
|
import ml.dmlc.xgboost4j.XGBoost;
|
||||||
|
import ml.dmlc.xgboost4j.XGBoostError;
|
||||||
|
import ml.dmlc.xgboost4j.demo.util.CustomEval;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* predict first ntree
|
* predict first ntree
|
||||||
*
|
*
|
||||||
@ -13,13 +13,16 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j.demo;
|
package ml.dmlc.xgboost4j.demo;
|
||||||
|
|
||||||
import org.dmlc.xgboost4j.*;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import ml.dmlc.xgboost4j.Booster;
|
||||||
|
import ml.dmlc.xgboost4j.DMatrix;
|
||||||
|
import ml.dmlc.xgboost4j.XGBoost;
|
||||||
|
import ml.dmlc.xgboost4j.XGBoostError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* predict leaf indices
|
* predict leaf indices
|
||||||
*
|
*
|
||||||
@ -13,13 +13,13 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j.demo.util;
|
package ml.dmlc.xgboost4j.demo.util;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.dmlc.xgboost4j.DMatrix;
|
import ml.dmlc.xgboost4j.DMatrix;
|
||||||
import org.dmlc.xgboost4j.IEvaluation;
|
import ml.dmlc.xgboost4j.IEvaluation;
|
||||||
import org.dmlc.xgboost4j.XGBoostError;
|
import ml.dmlc.xgboost4j.XGBoostError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a util evaluation class for examples
|
* a util evaluation class for examples
|
||||||
@ -13,7 +13,7 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j.demo.util;
|
package ml.dmlc.xgboost4j.demo.util;
|
||||||
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
@ -32,4 +32,4 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package org.dmlc.xgboost4j;
|
package ml.dmlc.xgboost4j;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -13,7 +13,7 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j;
|
package ml.dmlc.xgboost4j;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@ -13,7 +13,7 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j;
|
package ml.dmlc.xgboost4j;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* interface for customized evaluation
|
* interface for customized evaluation
|
||||||
@ -13,7 +13,7 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j;
|
package ml.dmlc.xgboost4j;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -13,7 +13,7 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j;
|
package ml.dmlc.xgboost4j;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@ -13,7 +13,7 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j;
|
package ml.dmlc.xgboost4j;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@ -13,7 +13,7 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j;
|
package ml.dmlc.xgboost4j;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@ -13,7 +13,7 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j;
|
package ml.dmlc.xgboost4j;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@ -13,7 +13,7 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j;
|
package ml.dmlc.xgboost4j;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* custom error class for xgboost
|
* custom error class for xgboost
|
||||||
@ -13,7 +13,7 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j;
|
package ml.dmlc.xgboost4j;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xgboost jni wrapper functions for xgboost_wrapper.h
|
* xgboost jni wrapper functions for xgboost_wrapper.h
|
||||||
@ -14,13 +14,14 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.dmlc.xgboost4j.scala
|
package ml.dmlc.xgboost4j.scala
|
||||||
|
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
import scala.collection.mutable
|
import scala.collection.mutable
|
||||||
|
|
||||||
import org.dmlc.xgboost4j.{IEvaluation, IObjective, XGBoostError}
|
import ml.dmlc.xgboost4j.XGBoostError
|
||||||
|
|
||||||
|
|
||||||
trait Booster {
|
trait Booster {
|
||||||
|
|
||||||
@ -58,7 +59,7 @@ trait Booster {
|
|||||||
* @param obj customized objective class
|
* @param obj customized objective class
|
||||||
*/
|
*/
|
||||||
@throws(classOf[XGBoostError])
|
@throws(classOf[XGBoostError])
|
||||||
def update(dtrain: DMatrix, obj: IObjective)
|
def update(dtrain: DMatrix, obj: ObjectiveTrait)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* update with give grad and hess
|
* update with give grad and hess
|
||||||
@ -90,7 +91,7 @@ trait Booster {
|
|||||||
* @return eval information
|
* @return eval information
|
||||||
*/
|
*/
|
||||||
@throws(classOf[XGBoostError])
|
@throws(classOf[XGBoostError])
|
||||||
def evalSet(evalMatrixs: Array[DMatrix], evalNames: Array[String], eval: IEvaluation): String
|
def evalSet(evalMatrixs: Array[DMatrix], evalNames: Array[String], eval: EvalTrait): String
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Predict with data
|
* Predict with data
|
||||||
@ -14,9 +14,9 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.dmlc.xgboost4j.scala
|
package ml.dmlc.xgboost4j.scala
|
||||||
|
|
||||||
import org.dmlc.xgboost4j.{DMatrix => JDMatrix, XGBoostError}
|
import ml.dmlc.xgboost4j.{DMatrix => JDMatrix, XGBoostError}
|
||||||
|
|
||||||
class DMatrix private(private[scala] val jDMatrix: JDMatrix) {
|
class DMatrix private(private[scala] val jDMatrix: JDMatrix) {
|
||||||
|
|
||||||
@ -14,9 +14,9 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.dmlc.xgboost4j.scala
|
package ml.dmlc.xgboost4j.scala
|
||||||
|
|
||||||
import org.dmlc.xgboost4j.IEvaluation
|
import ml.dmlc.xgboost4j.IEvaluation
|
||||||
|
|
||||||
trait EvalTrait extends IEvaluation {
|
trait EvalTrait extends IEvaluation {
|
||||||
|
|
||||||
@ -14,9 +14,9 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.dmlc.xgboost4j.scala
|
package ml.dmlc.xgboost4j.scala
|
||||||
|
|
||||||
import org.dmlc.xgboost4j.IObjective
|
import ml.dmlc.xgboost4j.IObjective
|
||||||
|
|
||||||
trait ObjectiveTrait extends IObjective {
|
trait ObjectiveTrait extends IObjective {
|
||||||
/**
|
/**
|
||||||
@ -14,12 +14,12 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.dmlc.xgboost4j.scala
|
package ml.dmlc.xgboost4j.scala
|
||||||
|
|
||||||
import scala.collection.JavaConverters._
|
import scala.collection.JavaConverters._
|
||||||
import scala.collection.mutable
|
import scala.collection.mutable
|
||||||
|
|
||||||
import org.dmlc.xgboost4j.{Booster => JBooster, IEvaluation, IObjective}
|
import ml.dmlc.xgboost4j.{Booster => JBooster, IEvaluation, IObjective}
|
||||||
|
|
||||||
private[scala] class ScalaBoosterImpl private[xgboost4j](booster: JBooster) extends Booster {
|
private[scala] class ScalaBoosterImpl private[xgboost4j](booster: JBooster) extends Booster {
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ private[scala] class ScalaBoosterImpl private[xgboost4j](booster: JBooster) exte
|
|||||||
booster.update(dtrain.jDMatrix, iter)
|
booster.update(dtrain.jDMatrix, iter)
|
||||||
}
|
}
|
||||||
|
|
||||||
override def update(dtrain: DMatrix, obj: IObjective): Unit = {
|
override def update(dtrain: DMatrix, obj: ObjectiveTrait): Unit = {
|
||||||
booster.update(dtrain.jDMatrix, obj)
|
booster.update(dtrain.jDMatrix, obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ private[scala] class ScalaBoosterImpl private[xgboost4j](booster: JBooster) exte
|
|||||||
booster.evalSet(evalMatrixs.map(_.jDMatrix), evalNames, iter)
|
booster.evalSet(evalMatrixs.map(_.jDMatrix), evalNames, iter)
|
||||||
}
|
}
|
||||||
|
|
||||||
override def evalSet(evalMatrixs: Array[DMatrix], evalNames: Array[String], eval: IEvaluation):
|
override def evalSet(evalMatrixs: Array[DMatrix], evalNames: Array[String], eval: EvalTrait):
|
||||||
String = {
|
String = {
|
||||||
booster.evalSet(evalMatrixs.map(_.jDMatrix), evalNames, eval)
|
booster.evalSet(evalMatrixs.map(_.jDMatrix), evalNames, eval)
|
||||||
}
|
}
|
||||||
@ -14,15 +14,15 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.dmlc.xgboost4j.scala
|
package ml.dmlc.xgboost4j.scala
|
||||||
|
|
||||||
import _root_.scala.collection.JavaConverters._
|
import _root_.scala.collection.JavaConverters._
|
||||||
import org.dmlc.xgboost4j.{IEvaluation, IObjective, XGBoost => JXGBoost}
|
import ml.dmlc.xgboost4j.{XGBoost => JXGBoost}
|
||||||
|
|
||||||
object XGBoost {
|
object XGBoost {
|
||||||
|
|
||||||
def train(params: Map[String, AnyRef], dtrain: DMatrix, round: Int,
|
def train(params: Map[String, AnyRef], dtrain: DMatrix, round: Int,
|
||||||
watches: Map[String, DMatrix], obj: IObjective, eval: IEvaluation): Booster = {
|
watches: Map[String, DMatrix], obj: ObjectiveTrait, eval: EvalTrait): Booster = {
|
||||||
val jWatches = watches.map{case (name, matrix) => (name, matrix.jDMatrix)}
|
val jWatches = watches.map{case (name, matrix) => (name, matrix.jDMatrix)}
|
||||||
val xgboostInJava = JXGBoost.train(params.asJava, dtrain.jDMatrix, round, jWatches.asJava,
|
val xgboostInJava = JXGBoost.train(params.asJava, dtrain.jDMatrix, round, jWatches.asJava,
|
||||||
obj, eval)
|
obj, eval)
|
||||||
@ -35,10 +35,9 @@ object XGBoost {
|
|||||||
round: Int,
|
round: Int,
|
||||||
nfold: Int,
|
nfold: Int,
|
||||||
metrics: Array[String],
|
metrics: Array[String],
|
||||||
obj: EvalTrait,
|
obj: ObjectiveTrait,
|
||||||
eval: ObjectiveTrait): Array[String] = {
|
eval: EvalTrait): Array[String] = {
|
||||||
JXGBoost.crossValiation(params.asJava, data.jDMatrix, round, nfold, metrics,
|
JXGBoost.crossValiation(params.asJava, data.jDMatrix, round, nfold, metrics, obj, eval)
|
||||||
obj.asInstanceOf[IObjective], eval.asInstanceOf[IEvaluation])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def initBoostModel(params: Map[String, AnyRef], dMatrixs: Array[DMatrix]): Booster = {
|
def initBoostModel(params: Map[String, AnyRef], dMatrixs: Array[DMatrix]): Booster = {
|
||||||
@ -24,7 +24,7 @@ void setHandle(JNIEnv *jenv, jlongArray jhandle, void* handle) {
|
|||||||
jenv->SetLongArrayRegion(jhandle, 0, 1, (const jlong*) out);
|
jenv->SetLongArrayRegion(jhandle, 0, 1, (const jlong*) out);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBGetLastError
|
JNIEXPORT jstring JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBGetLastError
|
||||||
(JNIEnv *jenv, jclass jcls) {
|
(JNIEnv *jenv, jclass jcls) {
|
||||||
jstring jresult = 0 ;
|
jstring jresult = 0 ;
|
||||||
const char* result = XGBGetLastError();
|
const char* result = XGBGetLastError();
|
||||||
@ -32,7 +32,7 @@ JNIEXPORT jstring JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBGetLastError
|
|||||||
return jresult;
|
return jresult;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromFile
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromFile
|
||||||
(JNIEnv *jenv, jclass jcls, jstring jfname, jint jsilent, jlongArray jout) {
|
(JNIEnv *jenv, jclass jcls, jstring jfname, jint jsilent, jlongArray jout) {
|
||||||
DMatrixHandle result;
|
DMatrixHandle result;
|
||||||
const char* fname = jenv->GetStringUTFChars(jfname, 0);
|
const char* fname = jenv->GetStringUTFChars(jfname, 0);
|
||||||
@ -43,11 +43,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromFil
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixCreateFromCSR
|
* Method: XGDMatrixCreateFromCSR
|
||||||
* Signature: ([J[J[F)J
|
* Signature: ([J[J[F)J
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromCSR
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromCSR
|
||||||
(JNIEnv *jenv, jclass jcls, jlongArray jindptr, jintArray jindices, jfloatArray jdata, jlongArray jout) {
|
(JNIEnv *jenv, jclass jcls, jlongArray jindptr, jintArray jindices, jfloatArray jdata, jlongArray jout) {
|
||||||
DMatrixHandle result;
|
DMatrixHandle result;
|
||||||
jlong* indptr = jenv->GetLongArrayElements(jindptr, 0);
|
jlong* indptr = jenv->GetLongArrayElements(jindptr, 0);
|
||||||
@ -65,11 +65,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromCSR
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixCreateFromCSC
|
* Method: XGDMatrixCreateFromCSC
|
||||||
* Signature: ([J[J[F)J
|
* Signature: ([J[J[F)J
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromCSC
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromCSC
|
||||||
(JNIEnv *jenv, jclass jcls, jlongArray jindptr, jintArray jindices, jfloatArray jdata, jlongArray jout) {
|
(JNIEnv *jenv, jclass jcls, jlongArray jindptr, jintArray jindices, jfloatArray jdata, jlongArray jout) {
|
||||||
DMatrixHandle result;
|
DMatrixHandle result;
|
||||||
jlong* indptr = jenv->GetLongArrayElements(jindptr, NULL);
|
jlong* indptr = jenv->GetLongArrayElements(jindptr, NULL);
|
||||||
@ -89,11 +89,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromCSC
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixCreateFromMat
|
* Method: XGDMatrixCreateFromMat
|
||||||
* Signature: ([FIIF)J
|
* Signature: ([FIIF)J
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromMat
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromMat
|
||||||
(JNIEnv *jenv, jclass jcls, jfloatArray jdata, jint jnrow, jint jncol, jfloat jmiss, jlongArray jout) {
|
(JNIEnv *jenv, jclass jcls, jfloatArray jdata, jint jnrow, jint jncol, jfloat jmiss, jlongArray jout) {
|
||||||
DMatrixHandle result;
|
DMatrixHandle result;
|
||||||
jfloat* data = jenv->GetFloatArrayElements(jdata, 0);
|
jfloat* data = jenv->GetFloatArrayElements(jdata, 0);
|
||||||
@ -107,11 +107,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromMat
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixSliceDMatrix
|
* Method: XGDMatrixSliceDMatrix
|
||||||
* Signature: (J[I)J
|
* Signature: (J[I)J
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixSliceDMatrix
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixSliceDMatrix
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle, jintArray jindexset, jlongArray jout) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle, jintArray jindexset, jlongArray jout) {
|
||||||
DMatrixHandle result;
|
DMatrixHandle result;
|
||||||
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
||||||
@ -128,11 +128,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixSliceDMatrix
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixFree
|
* Method: XGDMatrixFree
|
||||||
* Signature: (J)V
|
* Signature: (J)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixFree
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixFree
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle) {
|
||||||
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
||||||
int ret = XGDMatrixFree(handle);
|
int ret = XGDMatrixFree(handle);
|
||||||
@ -140,11 +140,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixFree
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixSaveBinary
|
* Method: XGDMatrixSaveBinary
|
||||||
* Signature: (JLjava/lang/String;I)V
|
* Signature: (JLjava/lang/String;I)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixSaveBinary
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixSaveBinary
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jfname, jint jsilent) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jfname, jint jsilent) {
|
||||||
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
||||||
const char* fname = jenv->GetStringUTFChars(jfname, 0);
|
const char* fname = jenv->GetStringUTFChars(jfname, 0);
|
||||||
@ -154,11 +154,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixSaveBinary
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixSetFloatInfo
|
* Method: XGDMatrixSetFloatInfo
|
||||||
* Signature: (JLjava/lang/String;[F)V
|
* Signature: (JLjava/lang/String;[F)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixSetFloatInfo
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixSetFloatInfo
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jfield, jfloatArray jarray) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jfield, jfloatArray jarray) {
|
||||||
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
||||||
const char* field = jenv->GetStringUTFChars(jfield, 0);
|
const char* field = jenv->GetStringUTFChars(jfield, 0);
|
||||||
@ -173,11 +173,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixSetFloatInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixSetUIntInfo
|
* Method: XGDMatrixSetUIntInfo
|
||||||
* Signature: (JLjava/lang/String;[I)V
|
* Signature: (JLjava/lang/String;[I)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixSetUIntInfo
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixSetUIntInfo
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jfield, jintArray jarray) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jfield, jintArray jarray) {
|
||||||
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
||||||
const char* field = jenv->GetStringUTFChars(jfield, 0);
|
const char* field = jenv->GetStringUTFChars(jfield, 0);
|
||||||
@ -192,11 +192,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixSetUIntInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixSetGroup
|
* Method: XGDMatrixSetGroup
|
||||||
* Signature: (J[I)V
|
* Signature: (J[I)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixSetGroup
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixSetGroup
|
||||||
(JNIEnv * jenv, jclass jcls, jlong jhandle, jintArray jarray) {
|
(JNIEnv * jenv, jclass jcls, jlong jhandle, jintArray jarray) {
|
||||||
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
||||||
jint* array = jenv->GetIntArrayElements(jarray, NULL);
|
jint* array = jenv->GetIntArrayElements(jarray, NULL);
|
||||||
@ -208,11 +208,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixSetGroup
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixGetFloatInfo
|
* Method: XGDMatrixGetFloatInfo
|
||||||
* Signature: (JLjava/lang/String;)[F
|
* Signature: (JLjava/lang/String;)[F
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixGetFloatInfo
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixGetFloatInfo
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jfield, jobjectArray jout) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jfield, jobjectArray jout) {
|
||||||
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
||||||
const char* field = jenv->GetStringUTFChars(jfield, 0);
|
const char* field = jenv->GetStringUTFChars(jfield, 0);
|
||||||
@ -230,11 +230,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixGetFloatInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixGetUIntInfo
|
* Method: XGDMatrixGetUIntInfo
|
||||||
* Signature: (JLjava/lang/String;)[I
|
* Signature: (JLjava/lang/String;)[I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixGetUIntInfo
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixGetUIntInfo
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jfield, jobjectArray jout) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jfield, jobjectArray jout) {
|
||||||
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
||||||
const char* field = jenv->GetStringUTFChars(jfield, 0);
|
const char* field = jenv->GetStringUTFChars(jfield, 0);
|
||||||
@ -251,11 +251,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixGetUIntInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixNumRow
|
* Method: XGDMatrixNumRow
|
||||||
* Signature: (J)J
|
* Signature: (J)J
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixNumRow
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixNumRow
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle, jlongArray jout) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle, jlongArray jout) {
|
||||||
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
DMatrixHandle handle = (DMatrixHandle) jhandle;
|
||||||
bst_ulong result[1];
|
bst_ulong result[1];
|
||||||
@ -265,11 +265,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixNumRow
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterCreate
|
* Method: XGBoosterCreate
|
||||||
* Signature: ([J)J
|
* Signature: ([J)J
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterCreate
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterCreate
|
||||||
(JNIEnv *jenv, jclass jcls, jlongArray jhandles, jlongArray jout) {
|
(JNIEnv *jenv, jclass jcls, jlongArray jhandles, jlongArray jout) {
|
||||||
DMatrixHandle* handles;
|
DMatrixHandle* handles;
|
||||||
bst_ulong len = 0;
|
bst_ulong len = 0;
|
||||||
@ -298,11 +298,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterCreate
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterFree
|
* Method: XGBoosterFree
|
||||||
* Signature: (J)V
|
* Signature: (J)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterFree
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterFree
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle) {
|
||||||
BoosterHandle handle = (BoosterHandle) jhandle;
|
BoosterHandle handle = (BoosterHandle) jhandle;
|
||||||
return XGBoosterFree(handle);
|
return XGBoosterFree(handle);
|
||||||
@ -310,11 +310,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterFree
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterSetParam
|
* Method: XGBoosterSetParam
|
||||||
* Signature: (JLjava/lang/String;Ljava/lang/String;)V
|
* Signature: (JLjava/lang/String;Ljava/lang/String;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterSetParam
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterSetParam
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jname, jstring jvalue) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jname, jstring jvalue) {
|
||||||
BoosterHandle handle = (BoosterHandle) jhandle;
|
BoosterHandle handle = (BoosterHandle) jhandle;
|
||||||
const char* name = jenv->GetStringUTFChars(jname, 0);
|
const char* name = jenv->GetStringUTFChars(jname, 0);
|
||||||
@ -327,11 +327,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterSetParam
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterUpdateOneIter
|
* Method: XGBoosterUpdateOneIter
|
||||||
* Signature: (JIJ)V
|
* Signature: (JIJ)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterUpdateOneIter
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterUpdateOneIter
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle, jint jiter, jlong jdtrain) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle, jint jiter, jlong jdtrain) {
|
||||||
BoosterHandle handle = (BoosterHandle) jhandle;
|
BoosterHandle handle = (BoosterHandle) jhandle;
|
||||||
DMatrixHandle dtrain = (DMatrixHandle) jdtrain;
|
DMatrixHandle dtrain = (DMatrixHandle) jdtrain;
|
||||||
@ -339,11 +339,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterUpdateOneIter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterBoostOneIter
|
* Method: XGBoosterBoostOneIter
|
||||||
* Signature: (JJ[F[F)V
|
* Signature: (JJ[F[F)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterBoostOneIter
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterBoostOneIter
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle, jlong jdtrain, jfloatArray jgrad, jfloatArray jhess) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle, jlong jdtrain, jfloatArray jgrad, jfloatArray jhess) {
|
||||||
BoosterHandle handle = (BoosterHandle) jhandle;
|
BoosterHandle handle = (BoosterHandle) jhandle;
|
||||||
DMatrixHandle dtrain = (DMatrixHandle) jdtrain;
|
DMatrixHandle dtrain = (DMatrixHandle) jdtrain;
|
||||||
@ -358,11 +358,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterBoostOneIter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterEvalOneIter
|
* Method: XGBoosterEvalOneIter
|
||||||
* Signature: (JI[J[Ljava/lang/String;)Ljava/lang/String;
|
* Signature: (JI[J[Ljava/lang/String;)Ljava/lang/String;
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterEvalOneIter
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterEvalOneIter
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle, jint jiter, jlongArray jdmats, jobjectArray jevnames, jobjectArray jout) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle, jint jiter, jlongArray jdmats, jobjectArray jevnames, jobjectArray jout) {
|
||||||
BoosterHandle handle = (BoosterHandle) jhandle;
|
BoosterHandle handle = (BoosterHandle) jhandle;
|
||||||
DMatrixHandle* dmats = 0;
|
DMatrixHandle* dmats = 0;
|
||||||
@ -406,11 +406,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterEvalOneIter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterPredict
|
* Method: XGBoosterPredict
|
||||||
* Signature: (JJIJ)[F
|
* Signature: (JJIJ)[F
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterPredict
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterPredict
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle, jlong jdmat, jint joption_mask, jint jntree_limit, jobjectArray jout) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle, jlong jdmat, jint joption_mask, jint jntree_limit, jobjectArray jout) {
|
||||||
BoosterHandle handle = (BoosterHandle) jhandle;
|
BoosterHandle handle = (BoosterHandle) jhandle;
|
||||||
DMatrixHandle dmat = (DMatrixHandle) jdmat;
|
DMatrixHandle dmat = (DMatrixHandle) jdmat;
|
||||||
@ -426,11 +426,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterPredict
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterLoadModel
|
* Method: XGBoosterLoadModel
|
||||||
* Signature: (JLjava/lang/String;)V
|
* Signature: (JLjava/lang/String;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterLoadModel
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterLoadModel
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jfname) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jfname) {
|
||||||
BoosterHandle handle = (BoosterHandle) jhandle;
|
BoosterHandle handle = (BoosterHandle) jhandle;
|
||||||
const char* fname = jenv->GetStringUTFChars(jfname, 0);
|
const char* fname = jenv->GetStringUTFChars(jfname, 0);
|
||||||
@ -441,11 +441,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterLoadModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterSaveModel
|
* Method: XGBoosterSaveModel
|
||||||
* Signature: (JLjava/lang/String;)V
|
* Signature: (JLjava/lang/String;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterSaveModel
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterSaveModel
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jfname) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jfname) {
|
||||||
BoosterHandle handle = (BoosterHandle) jhandle;
|
BoosterHandle handle = (BoosterHandle) jhandle;
|
||||||
const char* fname = jenv->GetStringUTFChars(jfname, 0);
|
const char* fname = jenv->GetStringUTFChars(jfname, 0);
|
||||||
@ -457,11 +457,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterSaveModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterLoadModelFromBuffer
|
* Method: XGBoosterLoadModelFromBuffer
|
||||||
* Signature: (JJJ)V
|
* Signature: (JJJ)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterLoadModelFromBuffer
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterLoadModelFromBuffer
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle, jlong jbuf, jlong jlen) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle, jlong jbuf, jlong jlen) {
|
||||||
BoosterHandle handle = (BoosterHandle) jhandle;
|
BoosterHandle handle = (BoosterHandle) jhandle;
|
||||||
void *buf = (void*) jbuf;
|
void *buf = (void*) jbuf;
|
||||||
@ -469,11 +469,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterLoadModelFrom
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterGetModelRaw
|
* Method: XGBoosterGetModelRaw
|
||||||
* Signature: (J)Ljava/lang/String;
|
* Signature: (J)Ljava/lang/String;
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterGetModelRaw
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterGetModelRaw
|
||||||
(JNIEnv * jenv, jclass jcls, jlong jhandle, jobjectArray jout) {
|
(JNIEnv * jenv, jclass jcls, jlong jhandle, jobjectArray jout) {
|
||||||
BoosterHandle handle = (BoosterHandle) jhandle;
|
BoosterHandle handle = (BoosterHandle) jhandle;
|
||||||
bst_ulong len = 0;
|
bst_ulong len = 0;
|
||||||
@ -488,11 +488,11 @@ JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterGetModelRaw
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterDumpModel
|
* Method: XGBoosterDumpModel
|
||||||
* Signature: (JLjava/lang/String;I)[Ljava/lang/String;
|
* Signature: (JLjava/lang/String;I)[Ljava/lang/String;
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterDumpModel
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterDumpModel
|
||||||
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jfmap, jint jwith_stats, jobjectArray jout) {
|
(JNIEnv *jenv, jclass jcls, jlong jhandle, jstring jfmap, jint jwith_stats, jobjectArray jout) {
|
||||||
BoosterHandle handle = (BoosterHandle) jhandle;
|
BoosterHandle handle = (BoosterHandle) jhandle;
|
||||||
const char *fmap = jenv->GetStringUTFChars(jfmap, 0);
|
const char *fmap = jenv->GetStringUTFChars(jfmap, 0);
|
||||||
|
|||||||
@ -1,218 +1,218 @@
|
|||||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
/* Header for class org_dmlc_xgboost4j_XgboostJNI */
|
/* Header for class ml_dmlc_xgboost4j_XgboostJNI */
|
||||||
|
|
||||||
#ifndef _Included_org_dmlc_xgboost4j_XgboostJNI
|
#ifndef _Included_ml_dmlc_xgboost4j_XgboostJNI
|
||||||
#define _Included_org_dmlc_xgboost4j_XgboostJNI
|
#define _Included_ml_dmlc_xgboost4j_XgboostJNI
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBGetLastError
|
* Method: XGBGetLastError
|
||||||
* Signature: ()Ljava/lang/String;
|
* Signature: ()Ljava/lang/String;
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jstring JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBGetLastError
|
JNIEXPORT jstring JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBGetLastError
|
||||||
(JNIEnv *, jclass);
|
(JNIEnv *, jclass);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixCreateFromFile
|
* Method: XGDMatrixCreateFromFile
|
||||||
* Signature: (Ljava/lang/String;I[J)I
|
* Signature: (Ljava/lang/String;I[J)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromFile
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromFile
|
||||||
(JNIEnv *, jclass, jstring, jint, jlongArray);
|
(JNIEnv *, jclass, jstring, jint, jlongArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixCreateFromCSR
|
* Method: XGDMatrixCreateFromCSR
|
||||||
* Signature: ([J[I[F[J)I
|
* Signature: ([J[I[F[J)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromCSR
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromCSR
|
||||||
(JNIEnv *, jclass, jlongArray, jintArray, jfloatArray, jlongArray);
|
(JNIEnv *, jclass, jlongArray, jintArray, jfloatArray, jlongArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixCreateFromCSC
|
* Method: XGDMatrixCreateFromCSC
|
||||||
* Signature: ([J[I[F[J)I
|
* Signature: ([J[I[F[J)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromCSC
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromCSC
|
||||||
(JNIEnv *, jclass, jlongArray, jintArray, jfloatArray, jlongArray);
|
(JNIEnv *, jclass, jlongArray, jintArray, jfloatArray, jlongArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixCreateFromMat
|
* Method: XGDMatrixCreateFromMat
|
||||||
* Signature: ([FIIF[J)I
|
* Signature: ([FIIF[J)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromMat
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixCreateFromMat
|
||||||
(JNIEnv *, jclass, jfloatArray, jint, jint, jfloat, jlongArray);
|
(JNIEnv *, jclass, jfloatArray, jint, jint, jfloat, jlongArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixSliceDMatrix
|
* Method: XGDMatrixSliceDMatrix
|
||||||
* Signature: (J[I[J)I
|
* Signature: (J[I[J)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixSliceDMatrix
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixSliceDMatrix
|
||||||
(JNIEnv *, jclass, jlong, jintArray, jlongArray);
|
(JNIEnv *, jclass, jlong, jintArray, jlongArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixFree
|
* Method: XGDMatrixFree
|
||||||
* Signature: (J)I
|
* Signature: (J)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixFree
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixFree
|
||||||
(JNIEnv *, jclass, jlong);
|
(JNIEnv *, jclass, jlong);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixSaveBinary
|
* Method: XGDMatrixSaveBinary
|
||||||
* Signature: (JLjava/lang/String;I)I
|
* Signature: (JLjava/lang/String;I)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixSaveBinary
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixSaveBinary
|
||||||
(JNIEnv *, jclass, jlong, jstring, jint);
|
(JNIEnv *, jclass, jlong, jstring, jint);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixSetFloatInfo
|
* Method: XGDMatrixSetFloatInfo
|
||||||
* Signature: (JLjava/lang/String;[F)I
|
* Signature: (JLjava/lang/String;[F)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixSetFloatInfo
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixSetFloatInfo
|
||||||
(JNIEnv *, jclass, jlong, jstring, jfloatArray);
|
(JNIEnv *, jclass, jlong, jstring, jfloatArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixSetUIntInfo
|
* Method: XGDMatrixSetUIntInfo
|
||||||
* Signature: (JLjava/lang/String;[I)I
|
* Signature: (JLjava/lang/String;[I)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixSetUIntInfo
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixSetUIntInfo
|
||||||
(JNIEnv *, jclass, jlong, jstring, jintArray);
|
(JNIEnv *, jclass, jlong, jstring, jintArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixSetGroup
|
* Method: XGDMatrixSetGroup
|
||||||
* Signature: (J[I)I
|
* Signature: (J[I)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixSetGroup
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixSetGroup
|
||||||
(JNIEnv *, jclass, jlong, jintArray);
|
(JNIEnv *, jclass, jlong, jintArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixGetFloatInfo
|
* Method: XGDMatrixGetFloatInfo
|
||||||
* Signature: (JLjava/lang/String;[[F)I
|
* Signature: (JLjava/lang/String;[[F)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixGetFloatInfo
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixGetFloatInfo
|
||||||
(JNIEnv *, jclass, jlong, jstring, jobjectArray);
|
(JNIEnv *, jclass, jlong, jstring, jobjectArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixGetUIntInfo
|
* Method: XGDMatrixGetUIntInfo
|
||||||
* Signature: (JLjava/lang/String;[[I)I
|
* Signature: (JLjava/lang/String;[[I)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixGetUIntInfo
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixGetUIntInfo
|
||||||
(JNIEnv *, jclass, jlong, jstring, jobjectArray);
|
(JNIEnv *, jclass, jlong, jstring, jobjectArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGDMatrixNumRow
|
* Method: XGDMatrixNumRow
|
||||||
* Signature: (J[J)I
|
* Signature: (J[J)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGDMatrixNumRow
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGDMatrixNumRow
|
||||||
(JNIEnv *, jclass, jlong, jlongArray);
|
(JNIEnv *, jclass, jlong, jlongArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterCreate
|
* Method: XGBoosterCreate
|
||||||
* Signature: ([J[J)I
|
* Signature: ([J[J)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterCreate
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterCreate
|
||||||
(JNIEnv *, jclass, jlongArray, jlongArray);
|
(JNIEnv *, jclass, jlongArray, jlongArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterFree
|
* Method: XGBoosterFree
|
||||||
* Signature: (J)I
|
* Signature: (J)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterFree
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterFree
|
||||||
(JNIEnv *, jclass, jlong);
|
(JNIEnv *, jclass, jlong);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterSetParam
|
* Method: XGBoosterSetParam
|
||||||
* Signature: (JLjava/lang/String;Ljava/lang/String;)I
|
* Signature: (JLjava/lang/String;Ljava/lang/String;)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterSetParam
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterSetParam
|
||||||
(JNIEnv *, jclass, jlong, jstring, jstring);
|
(JNIEnv *, jclass, jlong, jstring, jstring);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterUpdateOneIter
|
* Method: XGBoosterUpdateOneIter
|
||||||
* Signature: (JIJ)I
|
* Signature: (JIJ)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterUpdateOneIter
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterUpdateOneIter
|
||||||
(JNIEnv *, jclass, jlong, jint, jlong);
|
(JNIEnv *, jclass, jlong, jint, jlong);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterBoostOneIter
|
* Method: XGBoosterBoostOneIter
|
||||||
* Signature: (JJ[F[F)I
|
* Signature: (JJ[F[F)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterBoostOneIter
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterBoostOneIter
|
||||||
(JNIEnv *, jclass, jlong, jlong, jfloatArray, jfloatArray);
|
(JNIEnv *, jclass, jlong, jlong, jfloatArray, jfloatArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterEvalOneIter
|
* Method: XGBoosterEvalOneIter
|
||||||
* Signature: (JI[J[Ljava/lang/String;[Ljava/lang/String;)I
|
* Signature: (JI[J[Ljava/lang/String;[Ljava/lang/String;)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterEvalOneIter
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterEvalOneIter
|
||||||
(JNIEnv *, jclass, jlong, jint, jlongArray, jobjectArray, jobjectArray);
|
(JNIEnv *, jclass, jlong, jint, jlongArray, jobjectArray, jobjectArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterPredict
|
* Method: XGBoosterPredict
|
||||||
* Signature: (JJIJ[[F)I
|
* Signature: (JJII[[F)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterPredict
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterPredict
|
||||||
(JNIEnv *, jclass, jlong, jlong, jint, jint, jobjectArray);
|
(JNIEnv *, jclass, jlong, jlong, jint, jint, jobjectArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterLoadModel
|
* Method: XGBoosterLoadModel
|
||||||
* Signature: (JLjava/lang/String;)I
|
* Signature: (JLjava/lang/String;)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterLoadModel
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterLoadModel
|
||||||
(JNIEnv *, jclass, jlong, jstring);
|
(JNIEnv *, jclass, jlong, jstring);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterSaveModel
|
* Method: XGBoosterSaveModel
|
||||||
* Signature: (JLjava/lang/String;)I
|
* Signature: (JLjava/lang/String;)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterSaveModel
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterSaveModel
|
||||||
(JNIEnv *, jclass, jlong, jstring);
|
(JNIEnv *, jclass, jlong, jstring);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterLoadModelFromBuffer
|
* Method: XGBoosterLoadModelFromBuffer
|
||||||
* Signature: (JJJ)I
|
* Signature: (JJJ)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterLoadModelFromBuffer
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterLoadModelFromBuffer
|
||||||
(JNIEnv *, jclass, jlong, jlong, jlong);
|
(JNIEnv *, jclass, jlong, jlong, jlong);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterGetModelRaw
|
* Method: XGBoosterGetModelRaw
|
||||||
* Signature: (J[Ljava/lang/String;)I
|
* Signature: (J[Ljava/lang/String;)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterGetModelRaw
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterGetModelRaw
|
||||||
(JNIEnv *, jclass, jlong, jobjectArray);
|
(JNIEnv *, jclass, jlong, jobjectArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_dmlc_xgboost4j_XgboostJNI
|
* Class: ml_dmlc_xgboost4j_XgboostJNI
|
||||||
* Method: XGBoosterDumpModel
|
* Method: XGBoosterDumpModel
|
||||||
* Signature: (JLjava/lang/String;I[[Ljava/lang/String;)I
|
* Signature: (JLjava/lang/String;I[[Ljava/lang/String;)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_XgboostJNI_XGBoosterDumpModel
|
JNIEXPORT jint JNICALL Java_ml_dmlc_xgboost4j_XgboostJNI_XGBoosterDumpModel
|
||||||
(JNIEnv *, jclass, jlong, jstring, jint, jobjectArray);
|
(JNIEnv *, jclass, jlong, jstring, jint, jobjectArray);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j;
|
package ml.dmlc.xgboost4j;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
@ -21,7 +21,6 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test cases for Booster
|
* test cases for Booster
|
||||||
@ -43,7 +42,7 @@ public class BoosterImplTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float eval(float[][] predicts, org.dmlc.xgboost4j.DMatrix dmat) {
|
public float eval(float[][] predicts, DMatrix dmat) {
|
||||||
float error = 0f;
|
float error = 0f;
|
||||||
float[] labels;
|
float[] labels;
|
||||||
try {
|
try {
|
||||||
@ -67,8 +66,8 @@ public class BoosterImplTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBoosterBasic() throws XGBoostError {
|
public void testBoosterBasic() throws XGBoostError {
|
||||||
org.dmlc.xgboost4j.DMatrix trainMat = new org.dmlc.xgboost4j.DMatrix("../../demo/data/agaricus.txt.train");
|
DMatrix trainMat = new DMatrix("../../demo/data/agaricus.txt.train");
|
||||||
org.dmlc.xgboost4j.DMatrix testMat = new org.dmlc.xgboost4j.DMatrix("../../demo/data/agaricus.txt.test");
|
DMatrix testMat = new DMatrix("../../demo/data/agaricus.txt.test");
|
||||||
|
|
||||||
//set params
|
//set params
|
||||||
Map<String, Object> paramMap = new HashMap<String, Object>() {
|
Map<String, Object> paramMap = new HashMap<String, Object>() {
|
||||||
@ -81,7 +80,7 @@ public class BoosterImplTest {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//set watchList
|
//set watchList
|
||||||
HashMap<String, org.dmlc.xgboost4j.DMatrix> watches = new HashMap<>();
|
HashMap<String, DMatrix> watches = new HashMap<>();
|
||||||
|
|
||||||
watches.put("train", trainMat);
|
watches.put("train", trainMat);
|
||||||
watches.put("test", testMat);
|
watches.put("test", testMat);
|
||||||
@ -112,7 +111,7 @@ public class BoosterImplTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testCV() throws XGBoostError {
|
public void testCV() throws XGBoostError {
|
||||||
//load train mat
|
//load train mat
|
||||||
org.dmlc.xgboost4j.DMatrix trainMat = new org.dmlc.xgboost4j.DMatrix("../../demo/data/agaricus.txt.train");
|
DMatrix trainMat = new DMatrix("../../demo/data/agaricus.txt.train");
|
||||||
|
|
||||||
//set params
|
//set params
|
||||||
Map<String, Object> param = new HashMap<String, Object>() {
|
Map<String, Object> param = new HashMap<String, Object>() {
|
||||||
@ -13,10 +13,9 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dmlc.xgboost4j;
|
package ml.dmlc.xgboost4j;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import org.dmlc.xgboost4j.*;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -32,7 +31,7 @@ public class DMatrixTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testCreateFromFile() throws XGBoostError {
|
public void testCreateFromFile() throws XGBoostError {
|
||||||
//create DMatrix from file
|
//create DMatrix from file
|
||||||
org.dmlc.xgboost4j.DMatrix dmat = new org.dmlc.xgboost4j.DMatrix("../../demo/data/agaricus.txt.test");
|
DMatrix dmat = new DMatrix("../../demo/data/agaricus.txt.test");
|
||||||
//get label
|
//get label
|
||||||
float[] labels = dmat.getLabel();
|
float[] labels = dmat.getLabel();
|
||||||
//check length
|
//check length
|
||||||
@ -56,7 +55,7 @@ public class DMatrixTest {
|
|||||||
float[] data = new float[]{1, 2, 3, 4, 2, 3, 5, 3, 1, 2, 5};
|
float[] data = new float[]{1, 2, 3, 4, 2, 3, 5, 3, 1, 2, 5};
|
||||||
int[] colIndex = new int[]{0, 2, 3, 0, 2, 3, 4, 0, 1, 2, 3};
|
int[] colIndex = new int[]{0, 2, 3, 0, 2, 3, 4, 0, 1, 2, 3};
|
||||||
long[] rowHeaders = new long[]{0, 3, 7, 11};
|
long[] rowHeaders = new long[]{0, 3, 7, 11};
|
||||||
org.dmlc.xgboost4j.DMatrix dmat1 = new org.dmlc.xgboost4j.DMatrix(rowHeaders, colIndex, data, org.dmlc.xgboost4j.DMatrix.SparseType.CSR);
|
DMatrix dmat1 = new DMatrix(rowHeaders, colIndex, data, DMatrix.SparseType.CSR);
|
||||||
//check row num
|
//check row num
|
||||||
System.out.println(dmat1.rowNum());
|
System.out.println(dmat1.rowNum());
|
||||||
TestCase.assertTrue(dmat1.rowNum() == 3);
|
TestCase.assertTrue(dmat1.rowNum() == 3);
|
||||||
@ -85,7 +84,7 @@ public class DMatrixTest {
|
|||||||
label0[i] = random.nextFloat();
|
label0[i] = random.nextFloat();
|
||||||
}
|
}
|
||||||
|
|
||||||
org.dmlc.xgboost4j.DMatrix dmat0 = new org.dmlc.xgboost4j.DMatrix(data0, nrow, ncol);
|
DMatrix dmat0 = new DMatrix(data0, nrow, ncol);
|
||||||
dmat0.setLabel(label0);
|
dmat0.setLabel(label0);
|
||||||
|
|
||||||
//check
|
//check
|
||||||
@ -75,7 +75,7 @@ if [ ${TASK} == "java_test" ]; then
|
|||||||
set -e
|
set -e
|
||||||
make jvm-packages
|
make jvm-packages
|
||||||
cd jvm-packages
|
cd jvm-packages
|
||||||
./create_wrap.sh
|
./create_jni.sh
|
||||||
mvn clean install -DskipTests=true
|
mvn clean install -DskipTests=true
|
||||||
mvn test
|
mvn test
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user