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.
Trained model produced by train.
An input query.
A prediction.
Implement this method to produce a model from prepared data.
Implement this method to produce a model from prepared data.
Prepared data for model training.
Trained model.
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.
A single model wrapped inside an RDD
An RDD of index-query tuples. The index is used to keep track of predicted results with corresponding queries.
Batch of predicted results
:: 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.
Spark context
Model
Batch of queries
Batch of predicted results
:: DeveloperApi :: Serializer for Java query classes using Gson
:: DeveloperApi :: Serializer for Java query classes using Gson
:: 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.
Spark context
Model ID
Algorithm parameters that trained this model
Model
The model itself for automatic persistence, an instance of org.apache.predictionio.workflow.PersistentModelManifest for manual persistence, or Unit for re-training on deployment
:: DeveloperApi :: Engine developers should not use this directly.
:: DeveloperApi :: Engine developers should not use this directly. Called by serving to perform a single prediction.
Query
Predicted result
:: DeveloperApi :: Obtains the type signature of query for this algorithm
:: DeveloperApi :: Obtains the type signature of query for this algorithm
Type signature of query
:: 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
:: 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.
Spark context
Prepared data
Trained model
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.
Prepared data class.
Trained model class.
Input query class.
Output prediction class.