Search in sources :

Example 6 with MLOutput

use of org.opensearch.ml.common.parameter.MLOutput in project ml-commons by opensearch-project.

the class MachineLearningClientTest method predict_WithAlgoAndInputDataAndListener.

@Test
public void predict_WithAlgoAndInputDataAndListener() {
    MLInput mlInput = MLInput.builder().algorithm(FunctionName.KMEANS).inputDataset(new DataFrameInputDataset(input)).build();
    ArgumentCaptor<MLOutput> dataFrameArgumentCaptor = ArgumentCaptor.forClass(MLOutput.class);
    machineLearningClient.predict(null, mlInput, dataFrameActionListener);
    verify(dataFrameActionListener).onResponse(dataFrameArgumentCaptor.capture());
    assertEquals(output, dataFrameArgumentCaptor.getValue());
}
Also used : MLInput(org.opensearch.ml.common.parameter.MLInput) DataFrameInputDataset(org.opensearch.ml.common.dataset.DataFrameInputDataset) MLOutput(org.opensearch.ml.common.parameter.MLOutput) Test(org.junit.Test)

Aggregations

MLInput (org.opensearch.ml.common.parameter.MLInput)6 MLOutput (org.opensearch.ml.common.parameter.MLOutput)6 Test (org.junit.Test)4 DataFrameInputDataset (org.opensearch.ml.common.dataset.DataFrameInputDataset)4 MLTaskResponse (org.opensearch.ml.common.transport.MLTaskResponse)4 MLPredictionOutput (org.opensearch.ml.common.parameter.MLPredictionOutput)3 ActionListener (org.opensearch.action.ActionListener)2 OpenSearchException (org.opensearch.OpenSearchException)1 ResourceNotFoundException (org.opensearch.ResourceNotFoundException)1 GetRequest (org.opensearch.action.get.GetRequest)1 GetResponse (org.opensearch.action.get.GetResponse)1 ThreadContext (org.opensearch.common.util.concurrent.ThreadContext)1 User (org.opensearch.commons.authuser.User)1 MLModel (org.opensearch.ml.common.parameter.MLModel)1 MLTrainingOutput (org.opensearch.ml.common.parameter.MLTrainingOutput)1 Model (org.opensearch.ml.common.parameter.Model)1 MLPredictionTaskRequest (org.opensearch.ml.common.transport.prediction.MLPredictionTaskRequest)1 MLTrainingTaskRequest (org.opensearch.ml.common.transport.training.MLTrainingTaskRequest)1