use of org.opensearch.ml.common.transport.prediction.MLPredictionTaskRequest in project ml-commons by opensearch-project.
the class PredictionITTests method testPredictionWithoutAlgorithm.
public void testPredictionWithoutAlgorithm() throws IOException {
MLInput mlInput = MLInput.builder().inputDataset(DATA_FRAME_INPUT_DATASET).build();
MLPredictionTaskRequest predictionRequest = new MLPredictionTaskRequest(taskId, mlInput);
ActionFuture<MLTaskResponse> predictionFuture = client().execute(MLPredictionTaskAction.INSTANCE, predictionRequest);
expectThrows(ActionRequestValidationException.class, () -> predictionFuture.actionGet());
}
use of org.opensearch.ml.common.transport.prediction.MLPredictionTaskRequest in project ml-commons by opensearch-project.
the class PredictionITTests method testPredictionWithoutModelId.
public void testPredictionWithoutModelId() throws IOException {
MLInput mlInput = MLInput.builder().algorithm(FunctionName.KMEANS).inputDataset(DATA_FRAME_INPUT_DATASET).build();
MLPredictionTaskRequest predictionRequest = new MLPredictionTaskRequest("", mlInput);
ActionFuture<MLTaskResponse> predictionFuture = client().execute(MLPredictionTaskAction.INSTANCE, predictionRequest);
expectThrows(ResourceNotFoundException.class, () -> predictionFuture.actionGet());
}
use of org.opensearch.ml.common.transport.prediction.MLPredictionTaskRequest in project ml-commons by opensearch-project.
the class PredictionITTests method testPredictionWithEmptyDataset.
public void testPredictionWithEmptyDataset() throws IOException {
MLInputDataset emptySearchInputDataset = generateEmptyDataset();
MLInput mlInput = MLInput.builder().algorithm(FunctionName.KMEANS).inputDataset(emptySearchInputDataset).build();
MLPredictionTaskRequest predictionRequest = new MLPredictionTaskRequest(taskId, mlInput);
ActionFuture<MLTaskResponse> predictionFuture = client().execute(MLPredictionTaskAction.INSTANCE, predictionRequest);
expectThrows(IllegalArgumentException.class, () -> predictionFuture.actionGet());
}
use of org.opensearch.ml.common.transport.prediction.MLPredictionTaskRequest in project ml-commons by opensearch-project.
the class PredictionITTests method testPredictionWithoutDataset.
public void testPredictionWithoutDataset() throws IOException {
MLInput mlInput = MLInput.builder().algorithm(FunctionName.KMEANS).build();
MLPredictionTaskRequest predictionRequest = new MLPredictionTaskRequest(taskId, mlInput);
ActionFuture<MLTaskResponse> predictionFuture = client().execute(MLPredictionTaskAction.INSTANCE, predictionRequest);
expectThrows(ActionRequestValidationException.class, () -> predictionFuture.actionGet());
}
use of org.opensearch.ml.common.transport.prediction.MLPredictionTaskRequest in project ml-commons by opensearch-project.
the class MachineLearningNodeClient method predict.
@Override
public void predict(String modelId, MLInput mlInput, ActionListener<MLOutput> listener) {
validateMLInput(mlInput, true);
MLPredictionTaskRequest predictionRequest = MLPredictionTaskRequest.builder().mlInput(mlInput).modelId(modelId).build();
client.execute(MLPredictionTaskAction.INSTANCE, predictionRequest, getMlPredictionTaskResponseActionListener(listener));
}
Aggregations