Search in sources :

Example 6 with DataFrameInputDataset

use of org.opensearch.ml.common.dataset.DataFrameInputDataset in project ml-commons by opensearch-project.

the class MachineLearningClientTest method predict_WithAlgoAndInputData.

@Test
public void predict_WithAlgoAndInputData() {
    MLInput mlInput = MLInput.builder().algorithm(FunctionName.KMEANS).inputDataset(new DataFrameInputDataset(input)).build();
    assertEquals(output, machineLearningClient.predict(null, mlInput).actionGet());
}
Also used : MLInput(org.opensearch.ml.common.parameter.MLInput) DataFrameInputDataset(org.opensearch.ml.common.dataset.DataFrameInputDataset) Test(org.junit.Test)

Example 7 with DataFrameInputDataset

use of org.opensearch.ml.common.dataset.DataFrameInputDataset in project ml-commons by opensearch-project.

the class MachineLearningClientTest method predict_WithAlgoAndInputDataAndParametersAndListener.

@Test
public void predict_WithAlgoAndInputDataAndParametersAndListener() {
    MLInput mlInput = MLInput.builder().algorithm(FunctionName.KMEANS).parameters(mlParameters).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)

Example 8 with DataFrameInputDataset

use of org.opensearch.ml.common.dataset.DataFrameInputDataset in project ml-commons by opensearch-project.

the class MachineLearningClientTest method predict_WithAlgoAndParametersAndInputData.

@Test
public void predict_WithAlgoAndParametersAndInputData() {
    MLInput mlInput = MLInput.builder().algorithm(FunctionName.KMEANS).parameters(mlParameters).inputDataset(new DataFrameInputDataset(input)).build();
    assertEquals(output, machineLearningClient.predict(null, mlInput).actionGet());
}
Also used : MLInput(org.opensearch.ml.common.parameter.MLInput) DataFrameInputDataset(org.opensearch.ml.common.dataset.DataFrameInputDataset) Test(org.junit.Test)

Example 9 with DataFrameInputDataset

use of org.opensearch.ml.common.dataset.DataFrameInputDataset 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)

Example 10 with DataFrameInputDataset

use of org.opensearch.ml.common.dataset.DataFrameInputDataset in project ml-commons by opensearch-project.

the class MachineLearningClientTest method predict_WithAlgoAndParametersAndInputDataAndModelId.

@Test
public void predict_WithAlgoAndParametersAndInputDataAndModelId() {
    MLInput mlInput = MLInput.builder().algorithm(FunctionName.KMEANS).parameters(mlParameters).inputDataset(new DataFrameInputDataset(input)).build();
    assertEquals(output, machineLearningClient.predict("modelId", mlInput).actionGet());
}
Also used : MLInput(org.opensearch.ml.common.parameter.MLInput) DataFrameInputDataset(org.opensearch.ml.common.dataset.DataFrameInputDataset) Test(org.junit.Test)

Aggregations

DataFrameInputDataset (org.opensearch.ml.common.dataset.DataFrameInputDataset)14 MLInput (org.opensearch.ml.common.parameter.MLInput)10 Test (org.junit.Test)8 DataFrame (org.opensearch.ml.common.dataframe.DataFrame)6 MLOutput (org.opensearch.ml.common.parameter.MLOutput)4 MLPredictionOutput (org.opensearch.ml.common.parameter.MLPredictionOutput)3 MLTaskResponse (org.opensearch.ml.common.transport.MLTaskResponse)3 HashMap (java.util.HashMap)2 MLInputDataset (org.opensearch.ml.common.dataset.MLInputDataset)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 BytesStreamOutput (org.opensearch.common.io.stream.BytesStreamOutput)1 ThreadContext (org.opensearch.common.util.concurrent.ThreadContext)1 XContentParser (org.opensearch.common.xcontent.XContentParser)1 User (org.opensearch.commons.authuser.User)1 Input (org.opensearch.ml.common.parameter.Input)1 KMeansParams (org.opensearch.ml.common.parameter.KMeansParams)1 LocalSampleCalculatorInput (org.opensearch.ml.common.parameter.LocalSampleCalculatorInput)1