rename files/packages

This commit is contained in:
CodingCat
2016-03-01 23:35:59 -05:00
parent 55e36893cd
commit f8fff6c6fc
36 changed files with 211 additions and 199 deletions

View File

@@ -14,13 +14,14 @@
limitations under the License.
*/
package org.dmlc.xgboost4j.scala
package ml.dmlc.xgboost4j.scala
import java.io.IOException
import scala.collection.mutable
import org.dmlc.xgboost4j.{IEvaluation, IObjective, XGBoostError}
import ml.dmlc.xgboost4j.XGBoostError
trait Booster {
@@ -58,7 +59,7 @@ trait Booster {
* @param obj customized objective class
*/
@throws(classOf[XGBoostError])
def update(dtrain: DMatrix, obj: IObjective)
def update(dtrain: DMatrix, obj: ObjectiveTrait)
/**
* update with give grad and hess
@@ -90,7 +91,7 @@ trait Booster {
* @return eval information
*/
@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

View File

@@ -14,9 +14,9 @@
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) {

View File

@@ -14,9 +14,9 @@
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 {

View File

@@ -14,9 +14,9 @@
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 {
/**

View File

@@ -14,12 +14,12 @@
limitations under the License.
*/
package org.dmlc.xgboost4j.scala
package ml.dmlc.xgboost4j.scala
import scala.collection.JavaConverters._
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 {
@@ -31,7 +31,7 @@ private[scala] class ScalaBoosterImpl private[xgboost4j](booster: JBooster) exte
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)
}
@@ -51,7 +51,7 @@ private[scala] class ScalaBoosterImpl private[xgboost4j](booster: JBooster) exte
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 = {
booster.evalSet(evalMatrixs.map(_.jDMatrix), evalNames, eval)
}

View File

@@ -14,15 +14,15 @@
limitations under the License.
*/
package org.dmlc.xgboost4j.scala
package ml.dmlc.xgboost4j.scala
import _root_.scala.collection.JavaConverters._
import org.dmlc.xgboost4j.{IEvaluation, IObjective, XGBoost => JXGBoost}
import ml.dmlc.xgboost4j.{XGBoost => JXGBoost}
object XGBoost {
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 xgboostInJava = JXGBoost.train(params.asJava, dtrain.jDMatrix, round, jWatches.asJava,
obj, eval)
@@ -35,10 +35,9 @@ object XGBoost {
round: Int,
nfold: Int,
metrics: Array[String],
obj: EvalTrait,
eval: ObjectiveTrait): Array[String] = {
JXGBoost.crossValiation(params.asJava, data.jDMatrix, round, nfold, metrics,
obj.asInstanceOf[IObjective], eval.asInstanceOf[IEvaluation])
obj: ObjectiveTrait,
eval: EvalTrait): Array[String] = {
JXGBoost.crossValiation(params.asJava, data.jDMatrix, round, nfold, metrics, obj, eval)
}
def initBoostModel(params: Map[String, AnyRef], dMatrixs: Array[DMatrix]): Booster = {