[1/3] ignite git commit: IGNITE-8169: [ML] Adopt KMeans to the new Partitioned Dataset and cleanup old code

2018-04-16 Thread chief
Repository: ignite
Updated Branches:
  refs/heads/ignite-2.5 b3f252666 -> 7173b0c48


http://git-wip-us.apache.org/repos/asf/ignite/blob/7173b0c4/modules/ml/src/test/java/org/apache/ignite/ml/clustering/KMeansDistributedClustererTestSingleNode.java
--
diff --git 
a/modules/ml/src/test/java/org/apache/ignite/ml/clustering/KMeansDistributedClustererTestSingleNode.java
 
b/modules/ml/src/test/java/org/apache/ignite/ml/clustering/KMeansDistributedClustererTestSingleNode.java
deleted file mode 100644
index 705db7a..000
--- 
a/modules/ml/src/test/java/org/apache/ignite/ml/clustering/KMeansDistributedClustererTestSingleNode.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ml.clustering;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.internal.util.IgniteUtils;
-import org.apache.ignite.ml.math.StorageConstants;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
-import org.apache.ignite.ml.math.distances.DistanceMeasure;
-import org.apache.ignite.ml.math.distances.EuclideanDistance;
-import org.apache.ignite.ml.math.functions.Functions;
-import org.apache.ignite.ml.math.impls.matrix.SparseDistributedMatrix;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Assert;
-
-import static 
org.apache.ignite.ml.clustering.KMeansUtil.checkIsInEpsilonNeighbourhood;
-
-/**
- * This test checks logic of clustering (checks for clusters structures).
- */
-public class KMeansDistributedClustererTestSingleNode extends 
GridCommonAbstractTest {
-/**
- * Number of nodes in grid. We should use 1 in this test because otherwise 
algorithm will be unstable
- * (We cannot guarantee the order in which results are returned from each 
node).
- */
-private static final int NODE_COUNT = 1;
-
-/** Grid instance. */
-private Ignite ignite;
-
-/**
- * Default constructor.
- */
-public KMeansDistributedClustererTestSingleNode() {
-super(false);
-}
-
-/**
- * {@inheritDoc}
- */
-@Override protected void beforeTest() throws Exception {
-ignite = grid(NODE_COUNT);
-}
-
-/** {@inheritDoc} */
-@Override protected void beforeTestsStarted() throws Exception {
-for (int i = 1; i <= NODE_COUNT; i++)
-startGrid(i);
-}
-
-/** {@inheritDoc} */
-@Override protected void afterTestsStopped() throws Exception {
-stopAllGrids();
-}
-
-/** */
-public void testPerformClusterAnalysisDegenerate() {
-
IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
-
-KMeansDistributedClusterer clusterer = new 
KMeansDistributedClusterer(new EuclideanDistance(), 1, 1, 1L);
-
-double[] v1 = new double[] {1959, 325100};
-double[] v2 = new double[] {1960, 373200};
-
-SparseDistributedMatrix points = new SparseDistributedMatrix(2, 2, 
StorageConstants.ROW_STORAGE_MODE,
-StorageConstants.RANDOM_ACCESS_MODE);
-
-points.setRow(0, v1);
-points.setRow(1, v2);
-
-KMeansModel mdl = clusterer.cluster(points, 1);
-
-Assert.assertEquals(1, mdl.centers().length);
-Assert.assertEquals(2, mdl.centers()[0].size());
-}
-
-/** */
-public void testClusterizationOnDatasetWithObviousStructure() throws 
IOException {
-
IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
-
-int ptsCnt = 1;
-int squareSideLen = 1;
-
-Random rnd = new Random(123456L);
-
-// Let centers be in the vertices of square.
-Map centers = new HashMap<>();
-centers.put(100, new 

[1/3] ignite git commit: IGNITE-8169: [ML] Adopt KMeans to the new Partitioned Dataset and cleanup old code

2018-04-16 Thread chief
Repository: ignite
Updated Branches:
  refs/heads/master 228254ae3 -> 9e21cec02


http://git-wip-us.apache.org/repos/asf/ignite/blob/9e21cec0/modules/ml/src/test/java/org/apache/ignite/ml/clustering/KMeansDistributedClustererTestSingleNode.java
--
diff --git 
a/modules/ml/src/test/java/org/apache/ignite/ml/clustering/KMeansDistributedClustererTestSingleNode.java
 
b/modules/ml/src/test/java/org/apache/ignite/ml/clustering/KMeansDistributedClustererTestSingleNode.java
deleted file mode 100644
index 705db7a..000
--- 
a/modules/ml/src/test/java/org/apache/ignite/ml/clustering/KMeansDistributedClustererTestSingleNode.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ml.clustering;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.internal.util.IgniteUtils;
-import org.apache.ignite.ml.math.StorageConstants;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
-import org.apache.ignite.ml.math.distances.DistanceMeasure;
-import org.apache.ignite.ml.math.distances.EuclideanDistance;
-import org.apache.ignite.ml.math.functions.Functions;
-import org.apache.ignite.ml.math.impls.matrix.SparseDistributedMatrix;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Assert;
-
-import static 
org.apache.ignite.ml.clustering.KMeansUtil.checkIsInEpsilonNeighbourhood;
-
-/**
- * This test checks logic of clustering (checks for clusters structures).
- */
-public class KMeansDistributedClustererTestSingleNode extends 
GridCommonAbstractTest {
-/**
- * Number of nodes in grid. We should use 1 in this test because otherwise 
algorithm will be unstable
- * (We cannot guarantee the order in which results are returned from each 
node).
- */
-private static final int NODE_COUNT = 1;
-
-/** Grid instance. */
-private Ignite ignite;
-
-/**
- * Default constructor.
- */
-public KMeansDistributedClustererTestSingleNode() {
-super(false);
-}
-
-/**
- * {@inheritDoc}
- */
-@Override protected void beforeTest() throws Exception {
-ignite = grid(NODE_COUNT);
-}
-
-/** {@inheritDoc} */
-@Override protected void beforeTestsStarted() throws Exception {
-for (int i = 1; i <= NODE_COUNT; i++)
-startGrid(i);
-}
-
-/** {@inheritDoc} */
-@Override protected void afterTestsStopped() throws Exception {
-stopAllGrids();
-}
-
-/** */
-public void testPerformClusterAnalysisDegenerate() {
-
IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
-
-KMeansDistributedClusterer clusterer = new 
KMeansDistributedClusterer(new EuclideanDistance(), 1, 1, 1L);
-
-double[] v1 = new double[] {1959, 325100};
-double[] v2 = new double[] {1960, 373200};
-
-SparseDistributedMatrix points = new SparseDistributedMatrix(2, 2, 
StorageConstants.ROW_STORAGE_MODE,
-StorageConstants.RANDOM_ACCESS_MODE);
-
-points.setRow(0, v1);
-points.setRow(1, v2);
-
-KMeansModel mdl = clusterer.cluster(points, 1);
-
-Assert.assertEquals(1, mdl.centers().length);
-Assert.assertEquals(2, mdl.centers()[0].size());
-}
-
-/** */
-public void testClusterizationOnDatasetWithObviousStructure() throws 
IOException {
-
IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
-
-int ptsCnt = 1;
-int squareSideLen = 1;
-
-Random rnd = new Random(123456L);
-
-// Let centers be in the vertices of square.
-Map centers = new HashMap<>();
-centers.put(100, new