Skip to content

Commit

Permalink
pass test compile
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxr committed Apr 8, 2015
1 parent abb7a3b commit 1c72579
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion mllib/src/main/scala/org/apache/spark/ml/Transformer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private[ml] abstract class UnaryTransformer[IN, OUT, T <: UnaryTransformer[IN, O
/** @group setParam */
def setInputCol(value: String): T = set(inputCol, value).asInstanceOf[T]

/** @goup setParam */
/** @group setParam */
def setOutputCol(value: String): T = set(outputCol, value).asInstanceOf[T]

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class BinaryClassificationEvaluator extends Evaluator with Params
/** @group setParam */
def setScoreCol(value: String): this.type = set(rawPredictionCol, value)

/** @goup setParam */
/** @group setParam */
def setLabelCol(value: String): this.type = set(labelCol, value)

override def evaluate(dataset: DataFrame, paramMap: ParamMap): Double = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ trait Params extends Identifiable with Serializable {
}

/** Gets a param by its name. */
protected final def getParam(paramName: String): Param[Any] = {
def getParam(paramName: String): Param[Any] = {
val m = this.getClass.getMethod(paramName)
assert(Modifier.isPublic(m.getModifiers) &&
classOf[Param[_]].isAssignableFrom(m.getReturnType) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,6 @@ class ALS extends Estimator[ALSModel] with ALSParams {
/** @group setParam */
def setRatingCol(value: String): this.type = set(ratingCol, value)

/** @group setParam */
def setNonnegative(value: Boolean): this.type = set(nonnegative, value)

/** @group setParam */
def setPredictionCol(value: String): this.type = set(predictionCol, value)

Expand All @@ -268,6 +265,9 @@ class ALS extends Estimator[ALSModel] with ALSParams {
/** @group setParam */
def setRegParam(value: Double): this.type = set(regParam, value)

/** @group setParam */
def setNonnegative(value: Boolean): this.type = set(nonnegative, value)

/** @group setParam */
def setCheckpointInterval(value: Int): this.type = set(checkpointInterval, value)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ class ParamsSuite extends FunSuite {
test("param") {
assert(maxIter.name === "maxIter")
assert(maxIter.doc === "max number of iterations")
assert(maxIter.defaultValue.get === 100)
assert(maxIter.parent.eq(solver))
assert(maxIter.toString === "maxIter: max number of iterations (default: 100)")
assert(inputCol.defaultValue === None)
assert(maxIter.toString === "maxIter: max number of iterations")
assert(solver.getMaxIter === 10)
assert(!solver.isSet(inputCol))
}

test("param pair") {
Expand All @@ -47,7 +47,6 @@ class ParamsSuite extends FunSuite {
val map0 = ParamMap.empty

assert(!map0.contains(maxIter))
assert(map0(maxIter) === maxIter.defaultValue.get)
map0.put(maxIter, 10)
assert(map0.contains(maxIter))
assert(map0(maxIter) === 10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ package org.apache.spark.ml.param
/** A subclass of Params for testing. */
class TestParams extends Params {

val maxIter = new IntParam(this, "maxIter", "max number of iterations", Some(100))
setDefault(maxIter -> 10)

val maxIter = new IntParam(this, "maxIter", "max number of iterations")
def setMaxIter(value: Int): this.type = { set(maxIter, value); this }
def getMaxIter: Int = get(maxIter)

Expand Down

0 comments on commit 1c72579

Please sign in to comment.