Search in sources :

Example 6 with LinearRegressionModel

use of org.apache.ignite.ml.regressions.linear.LinearRegressionModel in project ignite by apache.

the class LocalModelsTest method importExportLinearRegressionModelTest.

/**
 */
@Test
public void importExportLinearRegressionModelTest() throws IOException {
    executeModelTest(mdlFilePath -> {
        LinearRegressionModel model = new LinearRegressionModel(new DenseLocalOnHeapVector(new double[] { 1, 2 }), 3);
        Exporter<LinearRegressionModel, String> exporter = new FileExporter<>();
        model.saveModel(exporter, mdlFilePath);
        LinearRegressionModel load = exporter.load(mdlFilePath);
        Assert.assertNotNull(load);
        Assert.assertEquals("", model, load);
        return null;
    });
}
Also used : LinearRegressionModel(org.apache.ignite.ml.regressions.linear.LinearRegressionModel) DenseLocalOnHeapVector(org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector) Test(org.junit.Test)

Aggregations

LinearRegressionModel (org.apache.ignite.ml.regressions.linear.LinearRegressionModel)6 Ignite (org.apache.ignite.Ignite)4 SparseDistributedMatrixExample (org.apache.ignite.examples.ml.math.matrix.SparseDistributedMatrixExample)4 IgniteThread (org.apache.ignite.thread.IgniteThread)4 DenseLocalOnHeapVector (org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector)3 Cache (javax.cache.Cache)2 IgniteCache (org.apache.ignite.IgniteCache)2 Matrix (org.apache.ignite.ml.math.Matrix)2 Vector (org.apache.ignite.ml.math.Vector)2 SparseDistributedMatrix (org.apache.ignite.ml.math.impls.matrix.SparseDistributedMatrix)2 SparseDistributedVector (org.apache.ignite.ml.math.impls.vector.SparseDistributedVector)2 LinearRegressionLSQRTrainer (org.apache.ignite.ml.regressions.linear.LinearRegressionLSQRTrainer)2 LinearRegressionQRTrainer (org.apache.ignite.ml.regressions.linear.LinearRegressionQRTrainer)2 DenseLocalOnHeapMatrix (org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix)1 NormalizationTrainer (org.apache.ignite.ml.preprocessing.normalization.NormalizationTrainer)1 LinearRegressionSGDTrainer (org.apache.ignite.ml.regressions.linear.LinearRegressionSGDTrainer)1 Test (org.junit.Test)1