Package com.spotify.zoltar
Interface PredictFns.AsyncPredictFn<ModelT extends Model<?>,InputT,VectorT,ValueT>
-
- Type Parameters:
InputT
- type of the feature extraction input.VectorT
- type of the feature extraction output.ValueT
- type of the prediction output.
- Enclosing interface:
- PredictFns
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public static interface PredictFns.AsyncPredictFn<ModelT extends Model<?>,InputT,VectorT,ValueT>
Asynchronous prediction functional interface. Allows to define prediction function via lambda, prediction is happens asynchronously.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description CompletionStage<List<Prediction<InputT,ValueT>>>
apply(ModelT model, List<Vector<InputT,VectorT>> vectors)
The functional interface.static <ModelT extends Model<?>,InputT,VectorT,ValueT>
PredictFns.AsyncPredictFn<ModelT,InputT,VectorT,ValueT>lift(PredictFns.PredictFn<ModelT,InputT,VectorT,ValueT> fn)
Lifts prediction function to asynchronous prediction function.default <C extends PredictFns.AsyncPredictFn<ModelT,InputT,VectorT,ValueT>>
Cwith(Function<PredictFns.AsyncPredictFn<ModelT,InputT,VectorT,ValueT>,C> fn)
-
-
-
Method Detail
-
lift
static <ModelT extends Model<?>,InputT,VectorT,ValueT> PredictFns.AsyncPredictFn<ModelT,InputT,VectorT,ValueT> lift(PredictFns.PredictFn<ModelT,InputT,VectorT,ValueT> fn)
Lifts prediction function to asynchronous prediction function.- Type Parameters:
ModelT
- type of theModel
InputT
- type of the feature extraction input.VectorT
- type of the feature extraction output.ValueT
- type of the prediction output.
-
apply
CompletionStage<List<Prediction<InputT,ValueT>>> apply(ModelT model, List<Vector<InputT,VectorT>> vectors)
The functional interface. Your function/lambda takes model and features after extractions as input, should perform a asynchronous prediction and return the "future" of predictions.Note: if you have a synchronous implementation of prediction function you can use
lift(com.spotify.zoltar.PredictFns.PredictFn<ModelT, InputT, VectorT, ValueT>)
to make it asynchronous.- Parameters:
model
- model to perform prediction on.vectors
- extracted features.- Returns:
CompletionStage
of predictions (Prediction
).
-
-