[refactor] move java package to namespace java
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user