[refactor] move java package to namespace java

This commit is contained in:
tqchen 2016-03-05 09:53:46 -08:00 committed by CodingCat
parent 81dbf564a4
commit ae969a0e69
36 changed files with 80 additions and 84 deletions

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -1,4 +1,4 @@
package ml.dmlc.xgboost4j;
package ml.dmlc.xgboost4j.java;
import java.io.IOException;
import java.io.Serializable;

View File

@ -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;

View File

@ -1,4 +1,4 @@
package ml.dmlc.xgboost4j;
package ml.dmlc.xgboost4j.java;
/**
* A mini-batch of data that can be converted to DMatrix.

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -1,4 +1,4 @@
package ml.dmlc.xgboost4j;
package ml.dmlc.xgboost4j.java;
import java.io.IOException;
import java.util.Map;

View File

@ -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.*;

View File

@ -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

View File

@ -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;
/**

View File

@ -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 {

View File

@ -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))
}
/**

View File

@ -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))
}
}

View File

@ -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
}

View File

@ -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)

View File

@ -18,8 +18,6 @@ package ml.dmlc.xgboost4j.scala
import scala.collection.JavaConverters._
import ml.dmlc.xgboost4j.{XGBoost => JXGBoost}
object XGBoost {
def train(

View File

@ -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;

View File

@ -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;
/**

View File

@ -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 {

View File

@ -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