sampleclean.activeml

ActiveLearningTrainingFuture

class ActiveLearningTrainingFuture[M] extends Awaitable[Unit]

Future-like class for asynchronously passing back models and labeled data output by the active learning framework.

The training code should be passed in as trainFunc, which should be a function that takes an ActiveLearningTrainingState object and calls addModel() and addLabeledData on it whenever new models and data are available. Example:

def train(trainingState: ActiveLearningTrainingState[M]) = {
// get new labels
newLabeledData = labelSomeData()

// register them with the training state.
trainingState.addLabeledData(newLabeledData)

// train a model and register it
model = mllib.classification.SVMWithSGD.train(...)
trainingState.addModel(model)

// ... iterate on data and models ...
}

This object will be returned to users training models. Users should use the onNewModel, onNewLabeledData, isCompleted, and onComplete callbacks to process state as the training progresses. The full history of trained models and labeled data can be fetched with getModels and getLabeledData, respectively. This class has the Awaitable trait, so users can block until training is complete with Await.ready or Await.result. Example:

val trainingFuture = ActiveLearningFramework.train(...)

// add callbacks for new models and new data.
trainingFuture.onNewModel(evaluateNewModel)
trainingFuture.onNewLabeledData(processNewLabeledData)
trainingFuture.onComplete(() => println("All done! " + trainingFuture.getModels.size + " models trained."))

// wait for training to complete
Await.ready(trainingFuture, Duration.Inf)
M

the type of the Model being trained.

Linear Supertypes
Awaitable[Unit], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. ActiveLearningTrainingFuture
  2. Awaitable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ActiveLearningTrainingFuture(trainFunc: (ActiveLearningTrainingState[M]) ⇒ Unit)

    create a new future that runs an active learning training function.

    create a new future that runs an active learning training function.

    trainFunc

    the function that actually runs the training loop.

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def complete(): Unit

    Fires the completed event.

    Fires the completed event. This will cause the onComplete callback to execute.

  9. var completed: Boolean

  10. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  12. val executionFuture: Future[Unit]

  13. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  15. def getLabeledData: Option[RDD[(String, Double)]]

    Returns all data points labeled so far.

    Returns all data points labeled so far. Can be called by users at any time during training.

  16. def getModels: Seq[(M, Long)]

    Returns all models trained so far.

    Returns all models trained so far. Can be called by users at any time during training.

  17. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  18. def isCompleted: Boolean

    Returns true if the training process is complete.

    Returns true if the training process is complete. Can be called by users at any time during training.

  19. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  20. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  21. def newLabeledData(data: RDD[(String, Double)]): Unit

    Fires the new labeled data event.

    Fires the new labeled data event. This will cause the onNewLabeledData callback to execute.

    data

    an RDD of newly labeled data of the form (id, label).

  22. def newModel(model: M, trainN: Long): Unit

    Fires the new model event.

    Fires the new model event. This will cause the onNewModel callback to execute.

    model

    the newly trained model.

    trainN

    the size of the model's training set.

  23. final def notify(): Unit

    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  25. def onComplete(f: () ⇒ Unit): Unit

    Registers a callback to be called when the training process is complete.

    Registers a callback to be called when the training process is complete. Should be called by users.

    f

    callback that takes no arguments and returns nothing.

  26. var onCompleteFunc: () ⇒ Unit

  27. def onNewLabeledData(f: (RDD[(String, Double)]) ⇒ Unit): Unit

    Registers a callback to be called when new data has been labeled.

    Registers a callback to be called when new data has been labeled. Should be called by users.

    f

    callback that takes an RDD of newly labeled points of the form (id, label) and returns nothing.

  28. var onNewLabeledDataFunc: (RDD[(String, Double)]) ⇒ Unit

  29. def onNewModel(f: (M, Long) ⇒ Unit): Unit

    Registers a callback to be called when new models are trained.

    Registers a callback to be called when new models are trained. Should be called by users.

    f

    callback that takes a trained model and the size of that model's training set and returns nothing.

  30. var onNewModelFunc: (M, Long) ⇒ Unit

  31. def ready(atMost: Duration)(implicit permit: CanAwait): ActiveLearningTrainingFuture.this.type

    Blocks until active learning is complete.

    Blocks until active learning is complete.

    Definition Classes
    ActiveLearningTrainingFuture → Awaitable
    See also

    scala.concurrent.Awaitable

  32. def result(atMost: Duration)(implicit permit: CanAwait): Unit

    Blocks until active learning is complete.

    Blocks until active learning is complete. Returns nothing since there is no result.

    Definition Classes
    ActiveLearningTrainingFuture → Awaitable
    See also

    scala.concurrent.Awaitable

  33. val state: ActiveLearningTrainingState[M]

  34. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  35. def toString(): String

    Definition Classes
    AnyRef → Any
  36. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Awaitable[Unit]

Inherited from AnyRef

Inherited from Any

Ungrouped