org.apache.predictionio.controller

LAlgorithm

abstract class LAlgorithm[PD, M, Q, P] extends BaseAlgorithm[RDD[PD], RDD[M], Q, P]

Base class of a local algorithm.

A local algorithm runs locally within a single machine and produces a model that can fit within a single machine.

If your input query class requires custom JSON4S serialization, the most idiomatic way is to implement a trait that extends CustomQuerySerializer, and mix that into your algorithm class, instead of overriding querySerializer directly.

PD

Prepared data class.

M

Trained model class.

Q

Input query class.

P

Output prediction class.

Linear Supertypes
BaseAlgorithm[RDD[PD], RDD[M], Q, P], BaseQuerySerializer, AbstractDoer, Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. LAlgorithm
  2. BaseAlgorithm
  3. BaseQuerySerializer
  4. AbstractDoer
  5. Serializable
  6. Serializable
  7. AnyRef
  8. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new LAlgorithm()(implicit arg0: ClassTag[M])

Abstract Value Members

  1. abstract def predict(m: M, q: Q): P

    Implement this method to produce a prediction from a query and trained model.

    Implement this method to produce a prediction from a query and trained model.

    m

    Trained model produced by train.

    q

    An input query.

    returns

    A prediction.

  2. abstract def train(pd: PD): M

    Implement this method to produce a model from prepared data.

    Implement this method to produce a model from prepared data.

    pd

    Prepared data for model training.

    returns

    Trained model.

Concrete 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 batchPredict(mRDD: RDD[M], qs: RDD[(Long, Q)]): RDD[(Long, P)]

    This is a default implementation to perform batch prediction.

    This is a default implementation to perform batch prediction. Override this method for a custom implementation.

    mRDD

    A single model wrapped inside an RDD

    qs

    An RDD of index-query tuples. The index is used to keep track of predicted results with corresponding queries.

    returns

    Batch of predicted results

  8. def batchPredictBase(sc: SparkContext, bm: Any, qs: RDD[(Long, Q)]): RDD[(Long, P)]

    :: DeveloperApi :: Engine developers should not use this directly.

    :: DeveloperApi :: Engine developers should not use this directly. This is called by evaluation workflow to perform batch prediction.

    sc

    Spark context

    bm

    Model

    qs

    Batch of queries

    returns

    Batch of predicted results

    Definition Classes
    LAlgorithmBaseAlgorithm
  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. final def eq(arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

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

    Definition Classes
    AnyRef → Any
  14. lazy val gsonTypeAdapterFactories: Seq[TypeAdapterFactory]

    :: DeveloperApi :: Serializer for Java query classes using Gson

    :: DeveloperApi :: Serializer for Java query classes using Gson

    Definition Classes
    BaseQuerySerializer
  15. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  17. def makePersistentModel(sc: SparkContext, modelId: String, algoParams: Params, bm: Any): Any

    :: DeveloperApi :: Engine developers should not use this directly (read on to see how local algorithm models are persisted).

    :: DeveloperApi :: Engine developers should not use this directly (read on to see how local algorithm models are persisted).

    Local algorithms produce local models. By default, models will be serialized and stored automatically. Engine developers can override this behavior by mixing the PersistentModel trait into the model class, and PredictionIO will call PersistentModel.save instead. If it returns true, a org.apache.predictionio.workflow.PersistentModelManifest will be returned so that during deployment, PredictionIO will use PersistentModelLoader to retrieve the model. Otherwise, Unit will be returned and the model will be re-trained on-the-fly.

    sc

    Spark context

    modelId

    Model ID

    algoParams

    Algorithm parameters that trained this model

    bm

    Model

    returns

    The model itself for automatic persistence, an instance of org.apache.predictionio.workflow.PersistentModelManifest for manual persistence, or Unit for re-training on deployment

    Definition Classes
    LAlgorithmBaseAlgorithm
    Annotations
    @DeveloperApi()
  18. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  19. final def notify(): Unit

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

    Definition Classes
    AnyRef
  21. def predictBase(localBaseModel: Any, q: Q): P

    :: DeveloperApi :: Engine developers should not use this directly.

    :: DeveloperApi :: Engine developers should not use this directly. Called by serving to perform a single prediction.

    q

    Query

    returns

    Predicted result

    Definition Classes
    LAlgorithmBaseAlgorithm
  22. def queryClass: Class[Q]

    :: DeveloperApi :: Obtains the type signature of query for this algorithm

    :: DeveloperApi :: Obtains the type signature of query for this algorithm

    returns

    Type signature of query

    Definition Classes
    BaseAlgorithm
  23. lazy val querySerializer: Formats

    :: DeveloperApi :: Serializer for Scala query classes using org.apache.predictionio.controller.Utils.json4sDefaultFormats

    :: DeveloperApi :: Serializer for Scala query classes using org.apache.predictionio.controller.Utils.json4sDefaultFormats

    Definition Classes
    BaseQuerySerializer
  24. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  25. def toString(): String

    Definition Classes
    AnyRef → Any
  26. def trainBase(sc: SparkContext, pd: RDD[PD]): RDD[M]

    :: DeveloperApi :: Engine developers should not use this directly.

    :: DeveloperApi :: Engine developers should not use this directly. This is called by workflow to train a model.

    sc

    Spark context

    pd

    Prepared data

    returns

    Trained model

    Definition Classes
    LAlgorithmBaseAlgorithm
  27. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from BaseAlgorithm[RDD[PD], RDD[M], Q, P]

Inherited from BaseQuerySerializer

Inherited from AbstractDoer

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped