[refactor] move java package to namespace java
This commit is contained in:
parent
81dbf564a4
commit
ae969a0e69
@ -29,5 +29,5 @@
|
||||
|
||||
<suppressions>
|
||||
<suppress checks=".*"
|
||||
files="xgboost4j/src/main/java/ml/dmlc/xgboost4j/XgboostJNI.java"/>
|
||||
files="xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/XgboostJNI.java"/>
|
||||
</suppressions>
|
||||
|
||||
@ -13,18 +13,18 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j.demo;
|
||||
package ml.dmlc.xgboost4j.java.demo;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
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;
|
||||
import ml.dmlc.xgboost4j.java.Booster;
|
||||
import ml.dmlc.xgboost4j.java.DMatrix;
|
||||
import ml.dmlc.xgboost4j.java.XGBoost;
|
||||
import ml.dmlc.xgboost4j.java.XGBoostError;
|
||||
import ml.dmlc.xgboost4j.java.demo.util.DataLoader;
|
||||
|
||||
/**
|
||||
* a simple example of java wrapper for xgboost
|
||||
@ -13,14 +13,14 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j.demo;
|
||||
package ml.dmlc.xgboost4j.java.demo;
|
||||
|
||||
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.java.Booster;
|
||||
import ml.dmlc.xgboost4j.java.DMatrix;
|
||||
import ml.dmlc.xgboost4j.java.XGBoost;
|
||||
import ml.dmlc.xgboost4j.java.XGBoostError;
|
||||
|
||||
/**
|
||||
* example for start from a initial base prediction
|
||||
@ -13,14 +13,14 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j.demo;
|
||||
package ml.dmlc.xgboost4j.java.demo;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import ml.dmlc.xgboost4j.DMatrix;
|
||||
import ml.dmlc.xgboost4j.XGBoost;
|
||||
import ml.dmlc.xgboost4j.XGBoostError;
|
||||
import ml.dmlc.xgboost4j.java.DMatrix;
|
||||
import ml.dmlc.xgboost4j.java.XGBoost;
|
||||
import ml.dmlc.xgboost4j.java.XGBoostError;
|
||||
|
||||
/**
|
||||
* an example of cross validation
|
||||
@ -13,17 +13,16 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j.demo;
|
||||
package ml.dmlc.xgboost4j.java.demo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import ml.dmlc.xgboost4j.java.*;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import ml.dmlc.xgboost4j.*;
|
||||
|
||||
/**
|
||||
* an example user define objective and eval
|
||||
* NOTE: when you do customized loss function, the default prediction value is margin
|
||||
@ -1,14 +1,13 @@
|
||||
package ml.dmlc.xgboost4j.demo;
|
||||
package ml.dmlc.xgboost4j.java.demo;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import ml.dmlc.xgboost4j.java.*;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import ml.dmlc.xgboost4j.*;
|
||||
|
||||
|
||||
/**
|
||||
* Distributed training example, used to quick test distributed training.
|
||||
@ -13,14 +13,14 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j.demo;
|
||||
package ml.dmlc.xgboost4j.java.demo;
|
||||
|
||||
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.java.Booster;
|
||||
import ml.dmlc.xgboost4j.java.DMatrix;
|
||||
import ml.dmlc.xgboost4j.java.XGBoost;
|
||||
import ml.dmlc.xgboost4j.java.XGBoostError;
|
||||
|
||||
/**
|
||||
* simple example for using external memory version
|
||||
@ -13,15 +13,15 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j.demo;
|
||||
package ml.dmlc.xgboost4j.java.demo;
|
||||
|
||||
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;
|
||||
import ml.dmlc.xgboost4j.java.Booster;
|
||||
import ml.dmlc.xgboost4j.java.DMatrix;
|
||||
import ml.dmlc.xgboost4j.java.XGBoost;
|
||||
import ml.dmlc.xgboost4j.java.XGBoostError;
|
||||
import ml.dmlc.xgboost4j.java.demo.util.CustomEval;
|
||||
|
||||
/**
|
||||
* this is an example of fit generalized linear model in xgboost
|
||||
@ -13,15 +13,15 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j.demo;
|
||||
package ml.dmlc.xgboost4j.java.demo;
|
||||
|
||||
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;
|
||||
import ml.dmlc.xgboost4j.java.Booster;
|
||||
import ml.dmlc.xgboost4j.java.DMatrix;
|
||||
import ml.dmlc.xgboost4j.java.XGBoost;
|
||||
import ml.dmlc.xgboost4j.java.XGBoostError;
|
||||
import ml.dmlc.xgboost4j.java.demo.util.CustomEval;
|
||||
|
||||
/**
|
||||
* predict first ntree
|
||||
@ -13,15 +13,15 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j.demo;
|
||||
package ml.dmlc.xgboost4j.java.demo;
|
||||
|
||||
import java.util.Arrays;
|
||||
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.java.Booster;
|
||||
import ml.dmlc.xgboost4j.java.DMatrix;
|
||||
import ml.dmlc.xgboost4j.java.XGBoost;
|
||||
import ml.dmlc.xgboost4j.java.XGBoostError;
|
||||
|
||||
/**
|
||||
* predict leaf indices
|
||||
@ -13,14 +13,14 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j.demo.util;
|
||||
package ml.dmlc.xgboost4j.java.demo.util;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import ml.dmlc.xgboost4j.DMatrix;
|
||||
import ml.dmlc.xgboost4j.IEvaluation;
|
||||
import ml.dmlc.xgboost4j.XGBoostError;
|
||||
import ml.dmlc.xgboost4j.java.DMatrix;
|
||||
import ml.dmlc.xgboost4j.java.IEvaluation;
|
||||
import ml.dmlc.xgboost4j.java.XGBoostError;
|
||||
|
||||
/**
|
||||
* a util evaluation class for examples
|
||||
@ -13,7 +13,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j.demo.util;
|
||||
package ml.dmlc.xgboost4j.java.demo.util;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
@ -16,8 +16,7 @@
|
||||
|
||||
package ml.dmlc.xgboost4j.flink
|
||||
|
||||
import ml.dmlc.xgboost4j.Rabit
|
||||
import ml.dmlc.xgboost4j.RabitTracker
|
||||
import ml.dmlc.xgboost4j.java.{RabitTracker, Rabit}
|
||||
import ml.dmlc.xgboost4j.scala.Booster
|
||||
import ml.dmlc.xgboost4j.scala.DMatrix
|
||||
import ml.dmlc.xgboost4j.scala.XGBoost
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package ml.dmlc.xgboost4j;
|
||||
package ml.dmlc.xgboost4j.java;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
@ -13,7 +13,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j;
|
||||
package ml.dmlc.xgboost4j.java;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
@ -1,4 +1,4 @@
|
||||
package ml.dmlc.xgboost4j;
|
||||
package ml.dmlc.xgboost4j.java;
|
||||
|
||||
/**
|
||||
* A mini-batch of data that can be converted to DMatrix.
|
||||
@ -13,7 +13,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j;
|
||||
package ml.dmlc.xgboost4j.java;
|
||||
|
||||
/**
|
||||
* interface for customized evaluation
|
||||
@ -13,7 +13,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j;
|
||||
package ml.dmlc.xgboost4j.java;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
@ -13,7 +13,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j;
|
||||
package ml.dmlc.xgboost4j.java;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j;
|
||||
package ml.dmlc.xgboost4j.java;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.HashMap;
|
||||
@ -13,7 +13,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j;
|
||||
package ml.dmlc.xgboost4j.java;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
@ -1,4 +1,4 @@
|
||||
package ml.dmlc.xgboost4j;
|
||||
package ml.dmlc.xgboost4j.java;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
@ -1,4 +1,4 @@
|
||||
package ml.dmlc.xgboost4j;
|
||||
package ml.dmlc.xgboost4j.java;
|
||||
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j;
|
||||
package ml.dmlc.xgboost4j.java;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j;
|
||||
package ml.dmlc.xgboost4j.java;
|
||||
|
||||
/**
|
||||
* custom error class for xgboost
|
||||
@ -13,7 +13,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j;
|
||||
package ml.dmlc.xgboost4j.java;
|
||||
|
||||
|
||||
/**
|
||||
@ -18,11 +18,9 @@ package ml.dmlc.xgboost4j.scala
|
||||
|
||||
import java.io.IOException
|
||||
|
||||
import ml.dmlc.xgboost4j.java.XGBoostError
|
||||
import scala.collection.mutable
|
||||
|
||||
import ml.dmlc.xgboost4j.XGBoostError
|
||||
|
||||
|
||||
trait Booster extends Serializable {
|
||||
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ package ml.dmlc.xgboost4j.scala
|
||||
|
||||
import _root_.scala.collection.JavaConverters._
|
||||
|
||||
import ml.dmlc.xgboost4j.{DMatrix => JDMatrix, DataBatch, XGBoostError}
|
||||
import ml.dmlc.xgboost4j.java.{DMatrix => JDMatrix, DataBatch, XGBoostError}
|
||||
|
||||
class DMatrix private[scala](private[scala] val jDMatrix: JDMatrix) {
|
||||
|
||||
@ -45,8 +45,8 @@ class DMatrix private[scala](private[scala] val jDMatrix: JDMatrix) {
|
||||
this(new JDMatrix(headers, indices, data, st))
|
||||
}
|
||||
|
||||
private[xgboost4j] def this(dataBatch: DataBatch) {
|
||||
this(new JDMatrix(List(dataBatch).asJava.iterator, null))
|
||||
private[xgboost4j] def this(dataBatches: Iterator[DataBatch]) {
|
||||
this(new JDMatrix(dataBatches.asJava, null))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -16,7 +16,8 @@
|
||||
|
||||
package ml.dmlc.xgboost4j.scala
|
||||
|
||||
import ml.dmlc.xgboost4j.{DMatrix => JDMatrix, IEvaluation}
|
||||
import ml.dmlc.xgboost4j.java
|
||||
import ml.dmlc.xgboost4j.java.IEvaluation
|
||||
|
||||
trait EvalTrait extends IEvaluation {
|
||||
|
||||
@ -36,7 +37,7 @@ trait EvalTrait extends IEvaluation {
|
||||
*/
|
||||
def eval(predicts: Array[Array[Float]], dmat: DMatrix): Float
|
||||
|
||||
private[scala] def eval(predicts: Array[Array[Float]], jdmat: JDMatrix): Float = {
|
||||
private[scala] def eval(predicts: Array[Array[Float]], jdmat: java.DMatrix): Float = {
|
||||
eval(predicts, new DMatrix(jdmat))
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,10 +16,10 @@
|
||||
|
||||
package ml.dmlc.xgboost4j.scala
|
||||
|
||||
import ml.dmlc.xgboost4j.java
|
||||
import ml.dmlc.xgboost4j.java.IObjective
|
||||
import scala.collection.JavaConverters._
|
||||
|
||||
import ml.dmlc.xgboost4j.{DMatrix => JDMatrix, IObjective}
|
||||
|
||||
trait ObjectiveTrait extends IObjective {
|
||||
/**
|
||||
* user define objective function, return gradient and second order gradient
|
||||
@ -30,7 +30,7 @@ trait ObjectiveTrait extends IObjective {
|
||||
*/
|
||||
def getGradient(predicts: Array[Array[Float]], dtrain: DMatrix): List[Array[Float]]
|
||||
|
||||
private[scala] def getGradient(predicts: Array[Array[Float]], dtrain: JDMatrix):
|
||||
private[scala] def getGradient(predicts: Array[Array[Float]], dtrain: java.DMatrix):
|
||||
java.util.List[Array[Float]] = {
|
||||
getGradient(predicts, new DMatrix(dtrain)).asJava
|
||||
}
|
||||
|
||||
@ -16,12 +16,11 @@
|
||||
|
||||
package ml.dmlc.xgboost4j.scala
|
||||
|
||||
import ml.dmlc.xgboost4j.java
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.collection.mutable
|
||||
|
||||
import ml.dmlc.xgboost4j.{Booster => JBooster}
|
||||
|
||||
private[scala] class ScalaBoosterImpl private[xgboost4j](booster: JBooster) extends Booster {
|
||||
private[scala] class ScalaBoosterImpl private[xgboost4j](booster: java.Booster) extends Booster {
|
||||
|
||||
override def setParam(key: String, value: String): Unit = {
|
||||
booster.setParam(key, value)
|
||||
|
||||
@ -18,8 +18,6 @@ package ml.dmlc.xgboost4j.scala
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
|
||||
import ml.dmlc.xgboost4j.{XGBoost => JXGBoost}
|
||||
|
||||
object XGBoost {
|
||||
|
||||
def train(
|
||||
|
||||
@ -13,12 +13,13 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j;
|
||||
package ml.dmlc.xgboost4j.java;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import ml.dmlc.xgboost4j.java.*;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.Test;
|
||||
@ -13,12 +13,15 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package ml.dmlc.xgboost4j;
|
||||
package ml.dmlc.xgboost4j.java;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import ml.dmlc.xgboost4j.java.DMatrix;
|
||||
import ml.dmlc.xgboost4j.java.DataBatch;
|
||||
import ml.dmlc.xgboost4j.java.XGBoostError;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
@ -20,7 +20,6 @@ import java.util.Arrays
|
||||
|
||||
import scala.util.Random
|
||||
|
||||
import ml.dmlc.xgboost4j.{DMatrix => JDMatrix}
|
||||
import org.scalatest.FunSuite
|
||||
|
||||
class DMatrixSuite extends FunSuite {
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
package ml.dmlc.xgboost4j.scala
|
||||
|
||||
import ml.dmlc.xgboost4j.XGBoostError
|
||||
import ml.dmlc.xgboost4j.java.XGBoostError
|
||||
import org.apache.commons.logging.LogFactory
|
||||
import org.scalatest.FunSuite
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user