Search in sources :

Example 1 with DatasetRow

use of org.apache.ignite.ml.structures.DatasetRow in project ignite by apache.

the class CollectionsTest method test.

/**
 */
@Test
@SuppressWarnings("unchecked")
public void test() {
    test(new VectorizedViewMatrix(new DenseMatrix(2, 2), 1, 1, 1, 1), new VectorizedViewMatrix(new DenseMatrix(3, 2), 2, 1, 1, 1));
    specialTest(new ManhattanDistance(), new ManhattanDistance());
    specialTest(new HammingDistance(), new HammingDistance());
    specialTest(new EuclideanDistance(), new EuclideanDistance());
    FeatureMetadata data = new FeatureMetadata("name2");
    data.setName("name1");
    test(data, new FeatureMetadata("name2"));
    test(new DatasetRow<>(new DenseVector()), new DatasetRow<>(new DenseVector(1)));
    test(new LabeledVector<>(new DenseVector(), null), new LabeledVector<>(new DenseVector(1), null));
    test(new Dataset<DatasetRow<Vector>>(new DatasetRow[] {}, new FeatureMetadata[] {}), new Dataset<DatasetRow<Vector>>(new DatasetRow[] { new DatasetRow() }, new FeatureMetadata[] { new FeatureMetadata() }));
    test(new LogisticRegressionModel(new DenseVector(), 1.0), new LogisticRegressionModel(new DenseVector(), 0.5));
    test(new KMeansModelFormat(new Vector[] {}, new ManhattanDistance()), new KMeansModelFormat(new Vector[] {}, new HammingDistance()));
    test(new KMeansModel(new Vector[] {}, new ManhattanDistance()), new KMeansModel(new Vector[] {}, new HammingDistance()));
    test(new SVMLinearClassificationModel(null, 1.0), new SVMLinearClassificationModel(null, 0.5));
    test(new ANNClassificationModel(new LabeledVectorSet<>(), new ANNClassificationTrainer.CentroidStat()), new ANNClassificationModel(new LabeledVectorSet<>(1, 1), new ANNClassificationTrainer.CentroidStat()));
    test(new ANNModelFormat(1, new ManhattanDistance(), false, new LabeledVectorSet<>(), new ANNClassificationTrainer.CentroidStat()), new ANNModelFormat(2, new ManhattanDistance(), false, new LabeledVectorSet<>(), new ANNClassificationTrainer.CentroidStat()));
}
Also used : FeatureMetadata(org.apache.ignite.ml.structures.FeatureMetadata) HammingDistance(org.apache.ignite.ml.math.distances.HammingDistance) KMeansModel(org.apache.ignite.ml.clustering.kmeans.KMeansModel) LogisticRegressionModel(org.apache.ignite.ml.regressions.logistic.LogisticRegressionModel) ANNModelFormat(org.apache.ignite.ml.knn.ann.ANNModelFormat) LabeledVectorSet(org.apache.ignite.ml.structures.LabeledVectorSet) KMeansModelFormat(org.apache.ignite.ml.clustering.kmeans.KMeansModelFormat) DenseMatrix(org.apache.ignite.ml.math.primitives.matrix.impl.DenseMatrix) EuclideanDistance(org.apache.ignite.ml.math.distances.EuclideanDistance) DatasetRow(org.apache.ignite.ml.structures.DatasetRow) VectorizedViewMatrix(org.apache.ignite.ml.math.primitives.vector.impl.VectorizedViewMatrix) ANNClassificationModel(org.apache.ignite.ml.knn.ann.ANNClassificationModel) SVMLinearClassificationModel(org.apache.ignite.ml.svm.SVMLinearClassificationModel) Vector(org.apache.ignite.ml.math.primitives.vector.Vector) LabeledVector(org.apache.ignite.ml.structures.LabeledVector) DenseVector(org.apache.ignite.ml.math.primitives.vector.impl.DenseVector) ManhattanDistance(org.apache.ignite.ml.math.distances.ManhattanDistance) DenseVector(org.apache.ignite.ml.math.primitives.vector.impl.DenseVector) Test(org.junit.Test)

Example 2 with DatasetRow

use of org.apache.ignite.ml.structures.DatasetRow in project ignite by apache.

the class ExternalizeTest method test.

/**
 */
@Test
@SuppressWarnings("unchecked")
public void test() {
    externalizeTest(new DelegatingVector(new DenseVector(1)));
    externalizeTest(new VectorizedViewMatrix(new DenseMatrix(2, 2), 1, 1, 1, 1));
    externalizeTest(new ManhattanDistance());
    externalizeTest(new HammingDistance());
    externalizeTest(new EuclideanDistance());
    externalizeTest(new FeatureMetadata());
    externalizeTest(new VectorizedViewMatrix(new DenseMatrix(2, 2), 1, 1, 1, 1));
    externalizeTest(new DatasetRow<>(new DenseVector()));
    externalizeTest(new LabeledVector<>(new DenseVector(), null));
    externalizeTest(new Dataset<DatasetRow<Vector>>(new DatasetRow[] {}, new FeatureMetadata[] {}));
}
Also used : FeatureMetadata(org.apache.ignite.ml.structures.FeatureMetadata) EuclideanDistance(org.apache.ignite.ml.math.distances.EuclideanDistance) HammingDistance(org.apache.ignite.ml.math.distances.HammingDistance) DatasetRow(org.apache.ignite.ml.structures.DatasetRow) VectorizedViewMatrix(org.apache.ignite.ml.math.primitives.vector.impl.VectorizedViewMatrix) DelegatingVector(org.apache.ignite.ml.math.primitives.vector.impl.DelegatingVector) DenseVector(org.apache.ignite.ml.math.primitives.vector.impl.DenseVector) ManhattanDistance(org.apache.ignite.ml.math.distances.ManhattanDistance) DenseMatrix(org.apache.ignite.ml.math.primitives.matrix.impl.DenseMatrix) Test(org.junit.Test)

Aggregations

EuclideanDistance (org.apache.ignite.ml.math.distances.EuclideanDistance)2 HammingDistance (org.apache.ignite.ml.math.distances.HammingDistance)2 ManhattanDistance (org.apache.ignite.ml.math.distances.ManhattanDistance)2 DenseMatrix (org.apache.ignite.ml.math.primitives.matrix.impl.DenseMatrix)2 DenseVector (org.apache.ignite.ml.math.primitives.vector.impl.DenseVector)2 VectorizedViewMatrix (org.apache.ignite.ml.math.primitives.vector.impl.VectorizedViewMatrix)2 DatasetRow (org.apache.ignite.ml.structures.DatasetRow)2 FeatureMetadata (org.apache.ignite.ml.structures.FeatureMetadata)2 Test (org.junit.Test)2 KMeansModel (org.apache.ignite.ml.clustering.kmeans.KMeansModel)1 KMeansModelFormat (org.apache.ignite.ml.clustering.kmeans.KMeansModelFormat)1 ANNClassificationModel (org.apache.ignite.ml.knn.ann.ANNClassificationModel)1 ANNModelFormat (org.apache.ignite.ml.knn.ann.ANNModelFormat)1 Vector (org.apache.ignite.ml.math.primitives.vector.Vector)1 DelegatingVector (org.apache.ignite.ml.math.primitives.vector.impl.DelegatingVector)1 LogisticRegressionModel (org.apache.ignite.ml.regressions.logistic.LogisticRegressionModel)1 LabeledVector (org.apache.ignite.ml.structures.LabeledVector)1 LabeledVectorSet (org.apache.ignite.ml.structures.LabeledVectorSet)1 SVMLinearClassificationModel (org.apache.ignite.ml.svm.SVMLinearClassificationModel)1