Package org.gridgain.internal.ml.compute
Class PredictionUtils
java.lang.Object
org.gridgain.internal.ml.compute.PredictionUtils
Base Compute job for ML predictions.
This job does the job of actually running the predictions using DJL
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <I,O> CompletableFuture<List<O>> batchPredictAsyncInternal(org.gridgain.ml.model.MlBatchJobParameters<I> jobParams, Executor executor) Executes batch prediction using the provided model and input data asynchronously.static CompletableFuture<ModelHandler>getOrCreateHandler(org.gridgain.ml.model.MlJobParameters jobParams, Executor executor) Gets or creates an async model handler for the specified job parameters.static <I,O> CompletableFuture<O> predictAsyncInternal(org.gridgain.ml.model.MlSimpleJobParameters<I> jobParams, Executor executor) Executes prediction using the provided model and input data asynchronously.static <O> CompletableFuture<List<O>>predictFromSqlAsyncInternal(org.apache.ignite.sql.IgniteSql igniteSql, org.gridgain.ml.model.MlSqlJobParameters jobParams, Executor executor) Executes SQL-based prediction by running the query and performing inference on results asynchronously.
-
Constructor Details
-
PredictionUtils
public PredictionUtils()
-
-
Method Details
-
predictAsyncInternal
public static <I,O> CompletableFuture<O> predictAsyncInternal(org.gridgain.ml.model.MlSimpleJobParameters<I> jobParams, Executor executor) Executes prediction using the provided model and input data asynchronously.- Type Parameters:
I- The input typeO- The output type- Parameters:
jobParams- The job parameters containing model info and input data- Returns:
- A CompletableFuture containing the prediction result
-
batchPredictAsyncInternal
public static <I,O> CompletableFuture<List<O>> batchPredictAsyncInternal(org.gridgain.ml.model.MlBatchJobParameters<I> jobParams, Executor executor) Executes batch prediction using the provided model and input data asynchronously.- Type Parameters:
I- The input typeO- The output type- Parameters:
jobParams- The job parameters containing model info and batch input data- Returns:
- A CompletableFuture containing a list of prediction results
-
predictFromSqlAsyncInternal
public static <O> CompletableFuture<List<O>> predictFromSqlAsyncInternal(org.apache.ignite.sql.IgniteSql igniteSql, org.gridgain.ml.model.MlSqlJobParameters jobParams, Executor executor) Executes SQL-based prediction by running the query and performing inference on results asynchronously. The SQL query returns the data to be used for prediction.- Type Parameters:
O- The output type- Parameters:
jobParams- The job parameters containing model info, SQL query, and parameters- Returns:
- A CompletableFuture containing a list of prediction results from SQL query data
-
getOrCreateHandler
public static CompletableFuture<ModelHandler> getOrCreateHandler(org.gridgain.ml.model.MlJobParameters jobParams, Executor executor) Gets or creates an async model handler for the specified job parameters. Uses async composition to avoid blocking threads.- Parameters:
jobParams- the jobParams- Returns:
- CompletableFuture ModelHandler
-