Search in sources :

Example 1 with KMeans

use of org.opensearch.ml.engine.algorithms.clustering.KMeans in project ml-commons by opensearch-project.

the class ModelSerDeSerTest method testModelSerDeSerKMeans.

@Test
public void testModelSerDeSerKMeans() {
    KMeansParams params = KMeansParams.builder().build();
    KMeans kMeans = new KMeans(params);
    Model model = kMeans.train(constructKMeansDataFrame(100));
    KMeansModel kMeansModel = (KMeansModel) ModelSerDeSer.deserialize(model.getContent());
    byte[] serializedModel = ModelSerDeSer.serialize(kMeansModel);
    assertFalse(Arrays.equals(serializedModel, model.getContent()));
}
Also used : KMeansParams(org.opensearch.ml.common.parameter.KMeansParams) KMeansModel(org.tribuo.clustering.kmeans.KMeansModel) KMeans(org.opensearch.ml.engine.algorithms.clustering.KMeans) Model(org.opensearch.ml.common.parameter.Model) KMeansModel(org.tribuo.clustering.kmeans.KMeansModel) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 KMeansParams (org.opensearch.ml.common.parameter.KMeansParams)1 Model (org.opensearch.ml.common.parameter.Model)1 KMeans (org.opensearch.ml.engine.algorithms.clustering.KMeans)1 KMeansModel (org.tribuo.clustering.kmeans.KMeansModel)1