Skip to content

Commit

Permalink
Last edits based on code review. Small cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
jkbradley committed Feb 6, 2015
1 parent fec348a commit 405bfb8
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ private trait MyLogisticRegressionParams extends ClassifierParams {
* - val myParamName: ParamType
* - def getMyParamName
* - def setMyParamName
* Here, we have a trait to be mixed in with the Estimator and Model (MyLogisticRegression
* and MyLogisticRegressionModel). We place the setter (setMaxIter) method in the Estimator
* class since the maxIter parameter is only used during training (not in the Model).
*/
val maxIter: IntParam = new IntParam(this, "maxIter", "max number of iterations")
def getMaxIter: Int = get(maxIter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@ private[spark] trait ClassifierParams extends PredictorParams
* Classes are indexed {0, 1, ..., numClasses - 1}.
*
* @tparam FeaturesType Type of input features. E.g., [[Vector]]
* @tparam Learner Concrete Estimator type
* @tparam E Concrete Estimator type
* @tparam M Concrete Model type
*
* NOTE: This is currently private[spark] but will be made public later once it is stabilized.
*/
@AlphaComponent
private[spark] abstract class Classifier[
FeaturesType,
Learner <: Classifier[FeaturesType, Learner, M],
E <: Classifier[FeaturesType, E, M],
M <: ClassificationModel[FeaturesType, M]]
extends Predictor[FeaturesType, Learner, M]
extends Predictor[FeaturesType, E, M]
with ClassifierParams {

def setRawPredictionCol(value: String): Learner =
set(rawPredictionCol, value).asInstanceOf[Learner]
def setRawPredictionCol(value: String): E =
set(rawPredictionCol, value).asInstanceOf[E]

// TODO: defaultEvaluator (follow-up PR)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ private[classification] trait ProbabilisticClassifierParams
* Single-label binary or multiclass classifier which can output class conditional probabilities.
*
* @tparam FeaturesType Type of input features. E.g., [[Vector]]
* @tparam Learner Concrete Estimator type
* @tparam E Concrete Estimator type
* @tparam M Concrete Model type
*
* NOTE: This is currently private[spark] but will be made public later once it is stabilized.
*/
@AlphaComponent
private[spark] abstract class ProbabilisticClassifier[
FeaturesType,
Learner <: ProbabilisticClassifier[FeaturesType, Learner, M],
E <: ProbabilisticClassifier[FeaturesType, E, M],
M <: ProbabilisticClassificationModel[FeaturesType, M]]
extends Classifier[FeaturesType, Learner, M] with ProbabilisticClassifierParams {
extends Classifier[FeaturesType, E, M] with ProbabilisticClassifierParams {

def setProbabilityCol(value: String): Learner = set(probabilityCol, value).asInstanceOf[Learner]
def setProbabilityCol(value: String): E = set(probabilityCol, value).asInstanceOf[E]
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private[spark] trait PredictorParams extends Params
* NOTE: This is currently private[spark] but will be made public later once it is stabilized.
*/
@AlphaComponent
abstract class Predictor[
private[spark] abstract class Predictor[
FeaturesType,
Learner <: Predictor[FeaturesType, Learner, M],
M <: PredictionModel[FeaturesType, M]]
Expand Down
4 changes: 3 additions & 1 deletion mllib/src/main/scala/org/apache/spark/ml/param/params.scala
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,11 @@ trait Params extends Identifiable with Serializable {
* :: DeveloperApi ::
*
* Helper functionality for developers.
*
* NOTE: This is currently private[spark] but will be made public later once it is stabilized.
*/
@DeveloperApi
object Params {
private[spark] object Params {

/**
* Copies parameter values from the parent estimator to the child model it produced.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ sealed trait Vector extends Serializable {
*
* User-defined type for [[Vector]] which allows easy interaction with SQL
* via [[org.apache.spark.sql.DataFrame]].
*
* NOTE: This is currently private[spark] but will be made public later once it is stabilized.
*/
@DeveloperApi
class VectorUDT extends UserDefinedType[Vector] {
private[spark] class VectorUDT extends UserDefinedType[Vector] {

override def sqlType: StructType = {
// type: 0 = sparse, 1 = dense
Expand Down

0 comments on commit 405bfb8

Please sign in to comment.