Skip to content

Commit

Permalink
doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxr committed Nov 11, 2014
1 parent 977fd9d commit a59d8b7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
14 changes: 5 additions & 9 deletions mllib/src/main/scala/org/apache/spark/ml/param/params.scala
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,13 @@ trait Params extends Identifiable with Serializable {
private[ml] def getParam(paramName: String): Param[Any] = {
val m = this.getClass.getMethod(paramName)
assert(Modifier.isPublic(m.getModifiers) &&
classOf[Param[_]].isAssignableFrom(m.getReturnType))
classOf[Param[_]].isAssignableFrom(m.getReturnType) &&
m.getParameterTypes.isEmpty)
m.invoke(this).asInstanceOf[Param[Any]]
}

/**
* Sets a parameter in the own parameter map.
* Sets a parameter in the embedded param map.
*/
private[ml] def set[T](param: Param[T], value: T): this.type = {
require(param.parent.eq(this))
Expand All @@ -165,7 +166,7 @@ trait Params extends Identifiable with Serializable {
}

/**
* Gets the value of a parameter.
* Gets the value of a parameter in the embedded param map.
*/
private[ml] def get[T](param: Param[T]): T = {
require(param.parent.eq(this))
Expand All @@ -180,11 +181,6 @@ trait Params extends Identifiable with Serializable {

private[ml] object Params {

/**
* Returns an empty Params implementation without any params.
*/
val empty: Params = new Params {}

/**
* Copies parameter values from the parent estimator to the child model it produced.
* @param paramMap the param map that holds parameters of the parent
Expand Down Expand Up @@ -224,7 +220,7 @@ class ParamMap private[ml] (private val map: mutable.Map[Param[Any], Any]) exten
}

/**
* Puts a param pair (overwrites if the input param exists).
* Puts a list of param pairs (overwrites if the input params exists).
*/
def put(paramPairs: ParamPair[_]*): this.type = {
paramPairs.foreach { p =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ class ParamGridBuilder {
private val paramGrid = mutable.Map.empty[Param[_], Iterable[_]]

/**
* Builds base on parameters with fixed values.
* Sets the given parameters in this grid to fixed values.
*/
def baseOn(paramMap: ParamMap): this.type = {
baseOn(paramMap.toSeq: _*)
this
}

/**
* Builds base on parameters with fixed values.
* Sets the given parameters in this grid to fixed values.
*/
@varargs
def baseOn(paramPairs: ParamPair[_]*): this.type = {
Expand All @@ -59,7 +59,7 @@ class ParamGridBuilder {
this
}

// specialized versions of addMulti for Java.
// specialized versions of addGrid for Java.

/**
* Adds a double param with multiple values.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.apache.spark.ml.feature.StandardScaler;
import org.apache.spark.sql.api.java.JavaSQLContext;
import org.apache.spark.sql.api.java.JavaSchemaRDD;
import org.apache.spark.sql.api.java.Row;
import static org.apache.spark.mllib.classification.LogisticRegressionSuite
.generateLogisticInputAsList;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.junit.Before;
import org.junit.Test;

import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.mllib.regression.LabeledPoint;
import org.apache.spark.sql.api.java.JavaSQLContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class JavaCrossValidatorSuite implements Serializable {

@Before
public void setUp() {
jsc = new JavaSparkContext("local", "JavaLogisticRegressionSuite");
jsc = new JavaSparkContext("local", "JavaCrossValidatorSuite");
jsql = new JavaSQLContext(jsc);
List<LabeledPoint> points = generateLogisticInputAsList(1.0, 1.0, 100, 42);
dataset = jsql.applySchema(jsc.parallelize(points, 2), LabeledPoint.class);
Expand Down

0 comments on commit a59d8b7

Please sign in to comment.