use of org.opensearch.ml.common.dataframe.DataFrame in project ml-commons by opensearch-project.
the class MLPredictionTaskRequestTest method setUp.
@Before
public void setUp() {
DataFrame dataFrame = DataFrameBuilder.load(Collections.singletonList(new HashMap<String, Object>() {
{
put("key1", 2.0D);
}
}));
mlInput = MLInput.builder().algorithm(FunctionName.KMEANS).parameters(KMeansParams.builder().centroids(1).build()).inputDataset(DataFrameInputDataset.builder().dataFrame(dataFrame).build()).build();
}
use of org.opensearch.ml.common.dataframe.DataFrame in project ml-commons by opensearch-project.
the class MLTrainingTaskRequestTest method setUp.
@Before
public void setUp() {
DataFrame dataFrame = DataFrameBuilder.load(Collections.singletonList(new HashMap<String, Object>() {
{
put("key1", 2.0D);
}
}));
mlInput = MLInput.builder().algorithm(FunctionName.KMEANS).parameters(KMeansParams.builder().centroids(1).build()).inputDataset(DataFrameInputDataset.builder().dataFrame(dataFrame).build()).build();
}
use of org.opensearch.ml.common.dataframe.DataFrame in project ml-commons by opensearch-project.
the class MLPredictionOutputTest method setUp.
@Before
public void setUp() {
ColumnMeta[] columnMetas = new ColumnMeta[] { new ColumnMeta("test", ColumnType.INTEGER) };
List<Row> rows = new ArrayList<>();
rows.add(new Row(new ColumnValue[] { new IntValue(1) }));
rows.add(new Row(new ColumnValue[] { new IntValue(2) }));
DataFrame dataFrame = new DefaultDataFrame(columnMetas, rows);
output = MLPredictionOutput.builder().taskId("test_task_id").status("test_status").predictionResult(dataFrame).build();
}
use of org.opensearch.ml.common.dataframe.DataFrame in project ml-commons by opensearch-project.
the class MLInputDatasetHandlerTests method testSearchQueryInputDatasetWrongType.
public void testSearchQueryInputDatasetWrongType() {
expectedEx.expect(IllegalArgumentException.class);
expectedEx.expectMessage("Input dataset is not SEARCH_QUERY type.");
DataFrame testDataFrame = DataFrameBuilder.load(Collections.singletonList(new HashMap<String, Object>() {
{
put("key1", 2.0D);
}
}));
DataFrameInputDataset dataFrameInputDataset = DataFrameInputDataset.builder().dataFrame(testDataFrame).build();
mlInputDatasetHandler.parseSearchQueryInput(dataFrameInputDataset, listener);
}
use of org.opensearch.ml.common.dataframe.DataFrame in project ml-commons by opensearch-project.
the class MLInputDatasetHandlerTests method testDataFrameInputDataset.
public void testDataFrameInputDataset() {
DataFrame testDataFrame = DataFrameBuilder.load(Collections.singletonList(new HashMap<String, Object>() {
{
put("key1", 2.0D);
}
}));
DataFrameInputDataset dataFrameInputDataset = DataFrameInputDataset.builder().dataFrame(testDataFrame).build();
DataFrame result = mlInputDatasetHandler.parseDataFrameInput(dataFrameInputDataset);
Assert.assertEquals(testDataFrame, result);
}
Aggregations