Packages

class StreamingKMeans extends Logging with Serializable

StreamingKMeans provides methods for configuring a streaming k-means analysis, training the model on streaming, and using the model to make predictions on streaming data. See KMeansModel for details on algorithm and update rules.

Use a builder pattern to construct a streaming k-means analysis in an application, like:

val model = new StreamingKMeans()
  .setDecayFactor(0.5)
  .setK(3)
  .setRandomCenters(5, 100.0)
  .trainOn(DStream)
Annotations
@Since("1.2.0")
Source
StreamingKMeans.scala
Linear Supertypes
Serializable, Logging, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. StreamingKMeans
  2. Serializable
  3. Logging
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new StreamingKMeans()
    Annotations
    @Since("1.2.0")
  2. new StreamingKMeans(k: Int, decayFactor: Double, timeUnit: String)
    Annotations
    @Since("1.2.0")

Type Members

  1. implicit class LogStringContext extends AnyRef
    Definition Classes
    Logging

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  6. var decayFactor: Double
    Annotations
    @Since("1.2.0")
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  11. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  12. def initializeLogIfNecessary(isInterpreter: Boolean): Unit
    Attributes
    protected
    Definition Classes
    Logging
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  15. var k: Int
    Annotations
    @Since("1.2.0")
  16. def latestModel(): StreamingKMeansModel

    Return the latest model.

    Return the latest model.

    Annotations
    @Since("1.2.0")
  17. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  18. def logDebug(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  19. def logDebug(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  20. def logDebug(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  21. def logDebug(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  22. def logError(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  23. def logError(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  24. def logError(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  25. def logError(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  26. def logInfo(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  27. def logInfo(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  28. def logInfo(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  29. def logInfo(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  30. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  31. def logTrace(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  32. def logTrace(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  33. def logTrace(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  34. def logTrace(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  35. def logWarning(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  36. def logWarning(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  37. def logWarning(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  38. def logWarning(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  39. var model: StreamingKMeansModel
    Attributes
    protected
  40. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  41. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  42. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  43. def predictOn(data: JavaDStream[Vector]): JavaDStream[Integer]

    Java-friendly version of predictOn.

    Java-friendly version of predictOn.

    Annotations
    @Since("1.4.0")
  44. def predictOn(data: DStream[Vector]): DStream[Int]

    Use the clustering model to make predictions on batches of data from a DStream.

    Use the clustering model to make predictions on batches of data from a DStream.

    data

    DStream containing vector data

    returns

    DStream containing predictions

    Annotations
    @Since("1.2.0")
  45. def predictOnValues[K](data: JavaPairDStream[K, Vector]): JavaPairDStream[K, Integer]

    Java-friendly version of predictOnValues.

    Java-friendly version of predictOnValues.

    Annotations
    @Since("1.4.0")
  46. def predictOnValues[K](data: DStream[(K, Vector)])(implicit arg0: ClassTag[K]): DStream[(K, Int)]

    Use the model to make predictions on the values of a DStream and carry over its keys.

    Use the model to make predictions on the values of a DStream and carry over its keys.

    K

    key type

    data

    DStream containing (key, feature vector) pairs

    returns

    DStream containing the input keys and the predictions as values

    Annotations
    @Since("1.2.0")
  47. def setDecayFactor(a: Double): StreamingKMeans.this.type

    Set the forgetfulness of the previous centroids.

    Set the forgetfulness of the previous centroids.

    Annotations
    @Since("1.2.0")
  48. def setHalfLife(halfLife: Double, timeUnit: String): StreamingKMeans.this.type

    Set the half life and time unit ("batches" or "points").

    Set the half life and time unit ("batches" or "points"). If points, then the decay factor is raised to the power of number of new points and if batches, then decay factor will be used as is.

    Annotations
    @Since("1.2.0")
  49. def setInitialCenters(centers: Array[Vector], weights: Array[Double]): StreamingKMeans.this.type

    Specify initial centers directly.

    Specify initial centers directly.

    Annotations
    @Since("1.2.0")
  50. def setK(k: Int): StreamingKMeans.this.type

    Set the number of clusters.

    Set the number of clusters.

    Annotations
    @Since("1.2.0")
  51. def setRandomCenters(dim: Int, weight: Double, seed: Long = Utils.random.nextLong): StreamingKMeans.this.type

    Initialize random centers, requiring only the number of dimensions.

    Initialize random centers, requiring only the number of dimensions.

    dim

    Number of dimensions

    weight

    Weight for each center

    seed

    Random seed

    Annotations
    @Since("1.2.0")
  52. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  53. var timeUnit: String
    Annotations
    @Since("1.2.0")
  54. def toString(): String
    Definition Classes
    AnyRef → Any
  55. def trainOn(data: JavaDStream[Vector]): Unit

    Java-friendly version of trainOn.

    Java-friendly version of trainOn.

    Annotations
    @Since("1.4.0")
  56. def trainOn(data: DStream[Vector]): Unit

    Update the clustering model by training on batches of data from a DStream.

    Update the clustering model by training on batches of data from a DStream. This operation registers a DStream for training the model, checks whether the cluster centers have been initialized, and updates the model using each batch of data from the stream.

    data

    DStream containing vector data

    Annotations
    @Since("1.2.0")
  57. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  58. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  59. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  60. def withLogContext(context: HashMap[String, String])(body: => Unit): Unit
    Attributes
    protected
    Definition Classes
    Logging

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from Serializable

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped