[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

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