Skip to content

Commit

Permalink
[SPARK-9704] [ML] Made ProbabilisticClassifier, Identifiable, VectorU…
Browse files Browse the repository at this point in the history
…DT public APIs

Made ProbabilisticClassifier, Identifiable, VectorUDT public.  All are annotated as DeveloperApi.

CC: mengxr EronWright

Author: Joseph K. Bradley <[email protected]>

Closes #8004 from jkbradley/ml-api-public-items and squashes the following commits:

7ebefda [Joseph K. Bradley] update per code review
7ff0768 [Joseph K. Bradley] attepting to add mima fix
756d84c [Joseph K. Bradley] VectorUDT annotated as AlphaComponent
ae7767d [Joseph K. Bradley] added another warning
94fd553 [Joseph K. Bradley] Made ProbabilisticClassifier, Identifiable, VectorUDT public APIs
  • Loading branch information
jkbradley authored and mengxr committed Aug 13, 2015
1 parent 4413d08 commit d2d5e7f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private[classification] trait ProbabilisticClassifierParams
* @tparam M Concrete Model type
*/
@DeveloperApi
private[spark] abstract class ProbabilisticClassifier[
abstract class ProbabilisticClassifier[
FeaturesType,
E <: ProbabilisticClassifier[FeaturesType, E, M],
M <: ProbabilisticClassificationModel[FeaturesType, M]]
Expand All @@ -74,7 +74,7 @@ private[spark] abstract class ProbabilisticClassifier[
* @tparam M Concrete Model type
*/
@DeveloperApi
private[spark] abstract class ProbabilisticClassificationModel[
abstract class ProbabilisticClassificationModel[
FeaturesType,
M <: ProbabilisticClassificationModel[FeaturesType, M]]
extends ClassificationModel[FeaturesType, M] with ProbabilisticClassifierParams {
Expand Down
16 changes: 14 additions & 2 deletions mllib/src/main/scala/org/apache/spark/ml/util/Identifiable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@ package org.apache.spark.ml.util

import java.util.UUID

import org.apache.spark.annotation.DeveloperApi


/**
* :: DeveloperApi ::
*
* Trait for an object with an immutable unique ID that identifies itself and its derivatives.
*
* WARNING: There have not yet been final discussions on this API, so it may be broken in future
* releases.
*/
private[spark] trait Identifiable {
@DeveloperApi
trait Identifiable {

/**
* An immutable unique ID for the object and its derivatives.
Expand All @@ -33,7 +41,11 @@ private[spark] trait Identifiable {
override def toString: String = uid
}

private[spark] object Identifiable {
/**
* :: DeveloperApi ::
*/
@DeveloperApi
object Identifiable {

/**
* Returns a random UID that concatenates the given prefix, "_", and 12 random hex chars.
Expand Down
10 changes: 4 additions & 6 deletions mllib/src/main/scala/org/apache/spark/mllib/linalg/Vectors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import scala.collection.JavaConverters._
import breeze.linalg.{DenseVector => BDV, SparseVector => BSV, Vector => BV}

import org.apache.spark.SparkException
import org.apache.spark.annotation.DeveloperApi
import org.apache.spark.annotation.AlphaComponent
import org.apache.spark.mllib.util.NumericParser
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.expressions.GenericMutableRow
Expand Down Expand Up @@ -159,15 +159,13 @@ sealed trait Vector extends Serializable {
}

/**
* :: DeveloperApi ::
* :: AlphaComponent ::
*
* 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
private[spark] class VectorUDT extends UserDefinedType[Vector] {
@AlphaComponent
class VectorUDT extends UserDefinedType[Vector] {

override def sqlType: StructType = {
// type: 0 = sparse, 1 = dense
Expand Down
4 changes: 4 additions & 0 deletions project/MimaExcludes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ object MimaExcludes {
// SPARK-4751 Dynamic allocation for standalone mode
ProblemFilters.exclude[MissingMethodProblem](
"org.apache.spark.SparkContext.supportDynamicAllocation")
) ++ Seq(
// SPARK-9704 Made ProbabilisticClassifier, Identifiable, VectorUDT public APIs
ProblemFilters.exclude[IncompatibleResultTypeProblem](
"org.apache.spark.mllib.linalg.VectorUDT.serialize")
)

case v if v.startsWith("1.4") =>
Expand Down

0 comments on commit d2d5e7f

Please sign in to comment.