IGNITE-9297: Review ML examples javadocs as of release 2.7

this closes #4560


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fea694fe
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fea694fe
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fea694fe

Branch: refs/heads/master
Commit: fea694fefb96ef9bf66940b7e230d1d0abab1c08
Parents: 0a19d01
Author: Oleg Ignatenko <oignate...@gridgain.com>
Authored: Mon Aug 20 14:47:37 2018 +0300
Committer: Yury Babak <yba...@gridgain.com>
Committed: Mon Aug 20 14:47:37 2018 +0300

----------------------------------------------------------------------
 .../examples/ml/MLExamplesCommonArgs.java       |  31 ----
 .../clustering/KMeansClusterizationExample.java |  42 ++---
 .../AlgorithmSpecificDatasetExample.java        |  30 ++--
 .../ml/dataset/CacheBasedDatasetExample.java    |  29 +---
 .../ml/dataset/LocalDatasetExample.java         |  55 +++----
 .../ignite/examples/ml/genetic/change/Coin.java |  62 +++----
 .../OptimizeMakeChangeFitnessFunction.java      |  66 ++++----
 .../change/OptimizeMakeChangeGAExample.java     | 163 +++++++++----------
 .../OptimizeMakeChangeTerminateCriteria.java    |  52 +++---
 .../helloworld/HelloWorldFitnessFunction.java   |  39 ++---
 .../genetic/helloworld/HelloWorldGAExample.java | 100 ++++++------
 .../helloworld/HelloWorldTerminateCriteria.java |  61 +++----
 .../examples/ml/genetic/knapsack/Item.java      |  43 ++---
 .../knapsack/KnapsackFitnessFunction.java       |  43 ++---
 .../ml/genetic/knapsack/KnapsackGAExample.java  | 157 +++++++++---------
 .../knapsack/KnapsackTerminateCriteria.java     |  68 ++++----
 .../ignite/examples/ml/genetic/movie/Movie.java |  51 +++---
 .../ml/genetic/movie/MovieFitnessFunction.java  |  70 ++++----
 .../ml/genetic/movie/MovieGAExample.java        | 141 ++++++++--------
 .../genetic/movie/MovieTerminateCriteria.java   |  57 +++----
 .../ml/knn/ANNClassificationExample.java        |  17 +-
 .../ml/knn/KNNClassificationExample.java        |  41 ++---
 .../examples/ml/knn/KNNRegressionExample.java   |  51 +++---
 .../examples/ml/nn/MLPTrainerExample.java       |  16 +-
 .../ml/preprocessing/BinarizationExample.java   |  31 ++--
 .../ml/preprocessing/ImputingExample.java       |  34 ++--
 .../ImputingWithMostFrequentValuesExample.java  |  38 ++---
 .../ml/preprocessing/MinMaxScalerExample.java   |  35 ++--
 .../ml/preprocessing/NormalizationExample.java  |  31 ++--
 .../LinearRegressionLSQRTrainerExample.java     |  40 ++---
 ...ssionLSQRTrainerWithMinMaxScalerExample.java |  47 ++----
 .../LinearRegressionSGDTrainerExample.java      |  42 ++---
 .../LogisticRegressionSGDTrainerExample.java    |  43 ++---
 ...gressionMultiClassClassificationExample.java |  46 ++----
 .../ml/selection/cv/CrossValidationExample.java |   8 +-
 .../split/TrainTestDatasetSplitterExample.java  |  43 ++---
 .../binary/SVMBinaryClassificationExample.java  |  43 ++---
 .../SVMMultiClassClassificationExample.java     |  45 ++---
 ...ecisionTreeClassificationTrainerExample.java |  17 +-
 .../DecisionTreeRegressionTrainerExample.java   |  12 +-
 .../GDBOnTreesClassificationTrainerExample.java |  10 +-
 .../GDBOnTreesRegressionTrainerExample.java     |  14 +-
 .../RandomForestClassificationExample.java      |  25 +--
 .../RandomForestRegressionExample.java          |  25 +--
 .../ml/tutorial/Step_1_Read_and_Learn.java      |  22 ++-
 .../examples/ml/tutorial/Step_2_Imputing.java   |  21 ++-
 .../examples/ml/tutorial/Step_3_Categorial.java |  24 ++-
 .../Step_3_Categorial_with_One_Hot_Encoder.java |  26 ++-
 .../ml/tutorial/Step_4_Add_age_fare.java        |  22 ++-
 .../examples/ml/tutorial/Step_5_Scaling.java    |  40 +++--
 .../ignite/examples/ml/tutorial/Step_6_KNN.java |  40 +++--
 .../ml/tutorial/Step_7_Split_train_test.java    |  43 +++--
 .../ignite/examples/ml/tutorial/Step_8_CV.java  |  57 ++++---
 .../ml/tutorial/Step_8_CV_with_Param_Grid.java  |  53 ++++--
 .../ml/tutorial/Step_9_Go_to_LogReg.java        |  44 +++--
 .../examples/ml/tutorial/TitanicUtils.java      |   2 +-
 .../ml/tutorial/TutorialStepByStepExample.java  |   4 +-
 .../ignite/examples/ml/util/DatasetHelper.java  |  57 +++++++
 .../examples/ml/util/MLExamplesCommonArgs.java  |  31 ++++
 .../ignite/examples/ml/util/TestCache.java      |  77 +++++++++
 .../ignite/examples/ml/util/package-info.java   |  22 +++
 .../testsuites/IgniteExamplesMLTestSuite.java   |   2 +-
 .../ml/knn/regression/KNNRegressionModel.java   |   2 +-
 63 files changed, 1428 insertions(+), 1275 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/MLExamplesCommonArgs.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/MLExamplesCommonArgs.java
 
b/examples/src/main/java/org/apache/ignite/examples/ml/MLExamplesCommonArgs.java
deleted file mode 100644
index 701894b..0000000
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/MLExamplesCommonArgs.java
+++ /dev/null
@@ -1,31 +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.examples.ml;
-
-/**
- * Some common arguments for examples in ML module.
- */
-public class MLExamplesCommonArgs {
-    /**
-     * Unattended argument.
-     */
-    public static String UNATTENDED = "unattended";
-
-    /** Empty args for ML examples. */
-    public static final String[] EMPTY_ARGS_ML = new String[] {"--" + 
UNATTENDED};
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/clustering/KMeansClusterizationExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/clustering/KMeansClusterizationExample.java
 
b/examples/src/main/java/org/apache/ignite/examples/ml/clustering/KMeansClusterizationExample.java
index e1b9844..5304a70 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/clustering/KMeansClusterizationExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/ml/clustering/KMeansClusterizationExample.java
@@ -18,27 +18,32 @@
 package org.apache.ignite.examples.ml.clustering;
 
 import java.util.Arrays;
-import java.util.UUID;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.examples.ml.util.TestCache;
 import org.apache.ignite.ml.clustering.kmeans.KMeansModel;
 import org.apache.ignite.ml.clustering.kmeans.KMeansTrainer;
-import org.apache.ignite.ml.knn.classification.KNNClassificationTrainer;
 import org.apache.ignite.ml.math.Tracer;
 import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
 import org.apache.ignite.thread.IgniteThread;
 
 /**
- * Run kNN multi-class classification trainer over distributed dataset.
- *
- * @see KNNClassificationTrainer
+ * Run KMeans clustering algorithm ({@link KMeansTrainer}) over distributed 
dataset.
+ * <p>
+ * Code in this example launches Ignite grid and fills the cache with test 
data points (based on the
+ * <a href="https://en.wikipedia.org/wiki/Iris_flower_data_set";></a>Iris 
dataset</a>).</p>
+ * <p>
+ * After that it trains the model based on the specified data using KMeans 
algorithm.</p>
+ * <p>
+ * Finally, this example loops over the test set of data points, applies the 
trained model to predict what cluster
+ * does this point belong to, and compares prediction to expected outcome 
(ground truth).</p>
+ * <p>
+ * You can change the test data used in this example and re-run it to explore 
this algorithm further.</p>
  */
 public class KMeansClusterizationExample {
     /** Run example. */
@@ -51,7 +56,7 @@ public class KMeansClusterizationExample {
 
             IgniteThread igniteThread = new 
IgniteThread(ignite.configuration().getIgniteInstanceName(),
                 KMeansClusterizationExample.class.getSimpleName(), () -> {
-                IgniteCache<Integer, double[]> dataCache = 
getTestCache(ignite);
+                IgniteCache<Integer, double[]> dataCache = new 
TestCache(ignite).get(data);
 
                 KMeansTrainer trainer = new KMeansTrainer()
                     .withSeed(7867L);
@@ -94,6 +99,8 @@ public class KMeansClusterizationExample {
 
                     System.out.println("\n>>> Absolute amount of errors " + 
amountOfErrors);
                     System.out.println("\n>>> Accuracy " + (1 - amountOfErrors 
/ (double)totalAmount));
+
+                    System.out.println(">>> KMeans clustering algorithm over 
cached dataset usage example completed.");
                 }
             });
 
@@ -102,25 +109,6 @@ public class KMeansClusterizationExample {
         }
     }
 
-    /**
-     * Fills cache with data and returns it.
-     *
-     * @param ignite Ignite instance.
-     * @return Filled Ignite Cache.
-     */
-    private static IgniteCache<Integer, double[]> getTestCache(Ignite ignite) {
-        CacheConfiguration<Integer, double[]> cacheConfiguration = new 
CacheConfiguration<>();
-        cacheConfiguration.setName("TEST_" + UUID.randomUUID());
-        cacheConfiguration.setAffinity(new RendezvousAffinityFunction(false, 
10));
-
-        IgniteCache<Integer, double[]> cache = 
ignite.createCache(cacheConfiguration);
-
-        for (int i = 0; i < data.length; i++)
-            cache.put(i, data[i]);
-
-        return cache;
-    }
-
     /** The Iris dataset. */
     private static final double[][] data = {
         {0, 5.1, 3.5, 1.4, 0.2},

http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/dataset/AlgorithmSpecificDatasetExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/dataset/AlgorithmSpecificDatasetExample.java
 
b/examples/src/main/java/org/apache/ignite/examples/ml/dataset/AlgorithmSpecificDatasetExample.java
index 1229fb1..de7f0e9 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/dataset/AlgorithmSpecificDatasetExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/ml/dataset/AlgorithmSpecificDatasetExample.java
@@ -36,20 +36,28 @@ import 
org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 /**
  * Example that shows how to implement your own algorithm (gradient descent 
trainer for linear regression) which uses
  * dataset as an underlying infrastructure.
- *
+ * <p>
+ * Code in this example launches Ignite grid and fills the cache with simple 
test data.</p>
+ * <p>
+ * After that it creates an algorithm specific dataset to perform linear 
regression as described in more detail below.</p>
+ * <p>
+ * Finally, this example trains linear regression model using gradient descent 
and outputs the result.</p>
+ * <p>
+ * You can change the test data used in this example and re-run it to explore 
this functionality further.</p>
+ * <p>
  * The common idea behind using algorithm specific datasets is to write a 
simple local version algorithm at first, then
- * find operations which involves data manipulations, and finally define 
algorithm specific version of the dataset
- * extended by introducing these new operations. As result your algorithm will 
work with extended dataset (based on
- * {@link DatasetWrapper}) in a sequential manner.
- *
+ * find operations which involve data manipulations, and finally define 
algorithm specific version of the dataset
+ * extended by introducing these new operations. As a result your algorithm 
will work with extended dataset (based on
+ * {@link DatasetWrapper}) in a sequential manner.</p>
+ * <p>
  * In this example we need to implement gradient descent. This is iterative 
method that involves calculation of gradient
- * on every step. In according with the common idea we defines
+ * on every step. In according with the common idea we define
  * {@link AlgorithmSpecificDatasetExample.AlgorithmSpecificDataset} - extended 
version of {@code Dataset} with
- * {@code gradient} method. As result our gradient descent method looks like a 
simple loop where every iteration
+ * {@code gradient} method. As a result our gradient descent method looks like 
a simple loop where every iteration
  * includes call of the {@code gradient} method. In the example we want to 
keep iteration number as well for logging.
  * Iteration number cannot be recovered from the {@code upstream} data and we 
need to keep it in the custom
  * partition {@code context} which is represented by
- * {@link AlgorithmSpecificDatasetExample.AlgorithmSpecificPartitionContext} 
class.
+ * {@link AlgorithmSpecificDatasetExample.AlgorithmSpecificPartitionContext} 
class.</p>
  */
 public class AlgorithmSpecificDatasetExample {
     /** Run example. */
@@ -59,7 +67,7 @@ public class AlgorithmSpecificDatasetExample {
 
             IgniteCache<Integer, Person> persons = createCache(ignite);
 
-            // Creates a algorithm specific dataset to perform linear 
regression. Here we defines the way features and
+            // Creates a algorithm specific dataset to perform linear 
regression. Here we define the way features and
             // labels are extracted, and partition data and context are 
created.
             try (AlgorithmSpecificDataset dataset = DatasetFactory.create(
                 ignite,
@@ -169,12 +177,12 @@ public class AlgorithmSpecificDatasetExample {
         private int iteration;
 
         /** */
-        public int getIteration() {
+        int getIteration() {
             return iteration;
         }
 
         /** */
-        public void setIteration(int iteration) {
+        void setIteration(int iteration) {
             this.iteration = iteration;
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/dataset/CacheBasedDatasetExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/dataset/CacheBasedDatasetExample.java
 
b/examples/src/main/java/org/apache/ignite/examples/ml/dataset/CacheBasedDatasetExample.java
index b5a7059..3f75540 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/dataset/CacheBasedDatasetExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/ml/dataset/CacheBasedDatasetExample.java
@@ -17,13 +17,13 @@
 
 package org.apache.ignite.examples.ml.dataset;
 
-import java.util.Arrays;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ml.dataset.model.Person;
+import org.apache.ignite.examples.ml.util.DatasetHelper;
 import org.apache.ignite.ml.dataset.DatasetFactory;
 import org.apache.ignite.ml.dataset.primitive.SimpleDataset;
 import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
@@ -31,6 +31,13 @@ import 
org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 /**
  * Example that shows how to create dataset based on an existing Ignite Cache 
and then use it to calculate {@code mean}
  * and {@code std} values as well as {@code covariance} and {@code 
correlation} matrices.
+ * <p>
+ * Code in this example launches Ignite grid and fills the cache with simple 
test data.</p>
+ * <p>
+ * After that it creates the dataset based on the data in the cache and uses 
Dataset API to find and output
+ * various statistical metrics of the data.</p>
+ * <p>
+ * You can change the test data used in this example and re-run it to explore 
this functionality further.</p>
  */
 public class CacheBasedDatasetExample {
     /** Run example. */
@@ -46,25 +53,7 @@ public class CacheBasedDatasetExample {
                 persons,
                 (k, v) -> VectorUtils.of(v.getAge(), v.getSalary())
             )) {
-                // Calculation of the mean value. This calculation will be 
performed in map-reduce manner.
-                double[] mean = dataset.mean();
-                System.out.println("Mean \n\t" + Arrays.toString(mean));
-
-                // Calculation of the standard deviation. This calculation 
will be performed in map-reduce manner.
-                double[] std = dataset.std();
-                System.out.println("Standard deviation \n\t" + 
Arrays.toString(std));
-
-                // Calculation of the covariance matrix.  This calculation 
will be performed in map-reduce manner.
-                double[][] cov = dataset.cov();
-                System.out.println("Covariance matrix ");
-                for (double[] row : cov)
-                    System.out.println("\t" + Arrays.toString(row));
-
-                // Calculation of the correlation matrix.  This calculation 
will be performed in map-reduce manner.
-                double[][] corr = dataset.corr();
-                System.out.println("Correlation matrix ");
-                for (double[] row : corr)
-                    System.out.println("\t" + Arrays.toString(row));
+                new DatasetHelper(dataset).describe();
             }
 
             System.out.println(">>> Cache Based Dataset example completed.");

http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/dataset/LocalDatasetExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/dataset/LocalDatasetExample.java
 
b/examples/src/main/java/org/apache/ignite/examples/ml/dataset/LocalDatasetExample.java
index e3af738..282e76b 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/dataset/LocalDatasetExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/ml/dataset/LocalDatasetExample.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.examples.ml.dataset;
 
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.Ignition;
 import org.apache.ignite.examples.ml.dataset.model.Person;
+import org.apache.ignite.examples.ml.util.DatasetHelper;
 import org.apache.ignite.ml.dataset.DatasetFactory;
 import org.apache.ignite.ml.dataset.primitive.SimpleDataset;
 import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
@@ -30,48 +28,35 @@ import 
org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 /**
  * Example that shows how to create dataset based on an existing local storage 
and then use it to calculate {@code mean}
  * and {@code std} values as well as {@code covariance} and {@code 
correlation} matrices.
+ * <p>
+ * Code in this example the storage with simple test data.</p>
+ * <p>
+ * After that it creates the dataset based on the data in the storage and uses 
Dataset API to find and output
+ * various statistical metrics of the data.</p>
+ * <p>
+ * You can change the test data used in this example and re-run it to explore 
this functionality further.</p>
  */
 public class LocalDatasetExample {
     /** Run example. */
     public static void main(String[] args) throws Exception {
-        try (Ignite ignite = 
Ignition.start("examples/config/example-ignite.xml")) {
-            System.out.println(">>> Local Dataset example started.");
+        System.out.println(">>> Local Dataset example started.");
 
-            Map<Integer, Person> persons = createCache(ignite);
+        Map<Integer, Person> persons = createCache();
 
-            // Creates a local simple dataset containing features and 
providing standard dataset API.
-            try (SimpleDataset<?> dataset = DatasetFactory.createSimpleDataset(
-                persons,
-                2,
-                (k, v) -> VectorUtils.of(v.getAge(), v.getSalary())
-            )) {
-                // Calculation of the mean value. This calculation will be 
performed in map-reduce manner.
-                double[] mean = dataset.mean();
-                System.out.println("Mean \n\t" + Arrays.toString(mean));
-
-                // Calculation of the standard deviation. This calculation 
will be performed in map-reduce manner.
-                double[] std = dataset.std();
-                System.out.println("Standard deviation \n\t" + 
Arrays.toString(std));
-
-                // Calculation of the covariance matrix.  This calculation 
will be performed in map-reduce manner.
-                double[][] cov = dataset.cov();
-                System.out.println("Covariance matrix ");
-                for (double[] row : cov)
-                    System.out.println("\t" + Arrays.toString(row));
-
-                // Calculation of the correlation matrix.  This calculation 
will be performed in map-reduce manner.
-                double[][] corr = dataset.corr();
-                System.out.println("Correlation matrix ");
-                for (double[] row : corr)
-                    System.out.println("\t" + Arrays.toString(row));
-            }
-
-            System.out.println(">>> Local Dataset example completed.");
+        // Creates a local simple dataset containing features and providing 
standard dataset API.
+        try (SimpleDataset<?> dataset = DatasetFactory.createSimpleDataset(
+            persons,
+            2,
+            (k, v) -> VectorUtils.of(v.getAge(), v.getSalary())
+        )) {
+            new DatasetHelper(dataset).describe();
         }
+
+        System.out.println(">>> Local Dataset example completed.");
     }
 
     /** */
-    private static Map<Integer, Person> createCache(Ignite ignite) {
+    private static Map<Integer, Person> createCache() {
         Map<Integer, Person> persons = new HashMap<>();
 
         persons.put(1, new Person("Mike", 42, 10000));

http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/Coin.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/Coin.java 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/Coin.java
index 4944a6b..14b7553 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/Coin.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/Coin.java
@@ -20,62 +20,69 @@ package org.apache.ignite.examples.ml.genetic.change;
 import java.io.Serializable;
 
 /**
- * POJO to model a coin
+ * POJO to model a coin.
  */
 public class Coin implements Serializable {
-    /** Define Coin Type */
-    public static enum CoinType {
-        PENNY, QUARTER, NICKEL, DIME
+    /** Define Coin Type. */
+    public enum CoinType {
+        /** */
+        PENNY,
+        /** */
+        QUARTER,
+        /** */
+        NICKEL,
+        /** */
+        DIME
     }
 
-    ;
+    /** Number of coins. */
+    private int numOfCoins;
 
-    /** number of coins */
-    private int numberOfCoins = 0;
-
-    /** CoinType */
-    private CoinType coinType = null;
+    /** Coin type. */
+    private CoinType coinType;
 
     /**
-     * @param coinType Type of coin
-     * @param numberOfCoins Number of coins
+     * Create instance.
+     *
+     * @param coinType Type of coin.
+     * @param numOfCoins Number of coins.
      */
-    public Coin(CoinType coinType, int numberOfCoins) {
+    Coin(CoinType coinType, int numOfCoins) {
         this.coinType = coinType;
-        this.numberOfCoins = numberOfCoins;
+        this.numOfCoins = numOfCoins;
     }
 
     /**
-     * Retrieve the number of coins
+     * Retrieve the number of coins.
      *
-     * @return Number of coins
+     * @return Number of coins.
      */
-    public int getNumberOfCoins() {
-        return numberOfCoins;
+    public int getNumOfCoins() {
+        return numOfCoins;
     }
 
     /**
-     * Set the number of coins
+     * Set the number of coins.
      *
-     * @param numberOfCoins Number of coins
+     * @param numOfCoins Number of coins.
      */
-    public void setNumberOfCoins(int numberOfCoins) {
-        this.numberOfCoins = numberOfCoins;
+    public void setNumOfCoins(int numOfCoins) {
+        this.numOfCoins = numOfCoins;
     }
 
     /**
-     * Retrieve Coin type
+     * Retrieve Coin type.
      *
-     * @return Coin type
+     * @return Coin type.
      */
     public CoinType getCoinType() {
         return coinType;
     }
 
     /**
-     * Set Coin type
+     * Set Coin type.
      *
-     * @param coinType Coin Type
+     * @param coinType Coin type.
      */
     public void setCoinType(CoinType coinType) {
         this.coinType = coinType;
@@ -83,7 +90,6 @@ public class Coin implements Serializable {
 
     /** {@inheritDoc} */
     @Override public String toString() {
-        return "Coin [numberOfCoins=" + numberOfCoins + ", coinType=" + 
coinType + "]";
+        return "Coin [numOfCoins=" + numOfCoins + ", coinType=" + coinType + 
"]";
     }
-
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeFitnessFunction.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeFitnessFunction.java
 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeFitnessFunction.java
index 34626be..36b5777 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeFitnessFunction.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeFitnessFunction.java
@@ -22,83 +22,75 @@ import org.apache.ignite.ml.genetic.Gene;
 import org.apache.ignite.ml.genetic.IFitnessFunction;
 
 /**
- * This example demonstrates how to create a IFitnessFunction <br/>
- *
- * Your IFitness function will vary depending on your particular use case. 
<br/>
- *
- * For this fitness function, we simply want to calculate the value of  <br/>
- *
- * an individual solution relative to other solutions. <br/>
+ * This example demonstrates how to create a {@link IFitnessFunction}.
+ * <p>
+ * Your fitness function will vary depending on your particular use case. For 
this fitness function, we simply want
+ * to calculate the value of an individual solution relative to other 
solutions.</p>
  */
 public class OptimizeMakeChangeFitnessFunction implements IFitnessFunction {
-    /** target amount */
-    int targetAmount = 0;
+    /** Target amount. */
+    private int targetAmount;
 
     /**
-     * @param targetAmount Amount of change
+     * @param targetAmount Amount of change.
      */
     public OptimizeMakeChangeFitnessFunction(int targetAmount) {
         this.targetAmount = targetAmount;
     }
 
     /**
-     * Calculate fitness
+     * Calculate fitness.
      *
-     * @param genes Genes
-     * @return Fitness value
+     * @param genes List of genes.
+     * @return Fitness value.
      */
     public double evaluate(List<Gene> genes) {
-
         int changeAmount = getAmountOfChange(genes);
         int totalCoins = getTotalNumberOfCoins(genes);
         int changeDifference = Math.abs(targetAmount - changeAmount);
 
         double fitness = (99 - changeDifference);
 
-        if (changeAmount == targetAmount) {
+        if (changeAmount == targetAmount)
             fitness += 100 - (10 * totalCoins);
-        }
 
         return fitness;
-
     }
 
     /**
-     * Calculate amount of change
+     * Calculate amount of change.
      *
-     * @param genes Genes
-     * @return Amount of change
+     * @param genes List of genes.
+     * @return Amount of change.
      */
     private int getAmountOfChange(List<Gene> genes) {
-        Gene quarterGene = (Gene)genes.get(0);
-        Gene dimeGene = (Gene)genes.get(1);
-        Gene nickelGene = (Gene)genes.get(2);
-        Gene pennyGene = (Gene)genes.get(3);
+        Gene quarterGene = genes.get(0);
+        Gene dimeGene = genes.get(1);
+        Gene nickelGene = genes.get(2);
+        Gene pennyGene = genes.get(3);
 
-        int numQuarters = ((Coin)quarterGene.getVal()).getNumberOfCoins();
-        int numDimes = ((Coin)dimeGene.getVal()).getNumberOfCoins();
-        int numNickels = ((Coin)nickelGene.getVal()).getNumberOfCoins();
-        int numPennies = ((Coin)pennyGene.getVal()).getNumberOfCoins();
+        int numQuarters = ((Coin)quarterGene.getVal()).getNumOfCoins();
+        int numDimes = ((Coin)dimeGene.getVal()).getNumOfCoins();
+        int numNickels = ((Coin)nickelGene.getVal()).getNumOfCoins();
+        int numPennies = ((Coin)pennyGene.getVal()).getNumOfCoins();
 
         return (numQuarters * 25) + (numDimes * 10) + (numNickels * 5) + 
numPennies;
     }
 
     /**
-     * Return the total number of coins
+     * Return the total number of coins.
      *
-     * @param genes Genes
-     * @return Number of coins
+     * @param genes List of genes.
+     * @return Number of coins.
      */
     private int getTotalNumberOfCoins(List<Gene> genes) {
-
-        int totalNumberOfCoins = 0;
+        int totalNumOfCoins = 0;
 
         for (Gene gene : genes) {
-            int numberOfCoins = ((Coin)gene.getVal()).getNumberOfCoins();
-            totalNumberOfCoins = totalNumberOfCoins + numberOfCoins;
-
+            int numOfCoins = ((Coin)gene.getVal()).getNumOfCoins();
+            totalNumOfCoins = totalNumOfCoins + numOfCoins;
         }
-        return totalNumberOfCoins;
 
+        return totalNumOfCoins;
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeGAExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeGAExample.java
 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeGAExample.java
index 1e80d6d..ed392c29 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeGAExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeGAExample.java
@@ -30,110 +30,101 @@ import 
org.apache.ignite.ml.genetic.parameter.GAConfiguration;
 import org.apache.ignite.ml.genetic.parameter.GAGridConstants;
 
 /**
- * This example demonstrates how to use the GAGrid framework. <br/>
- *
- * This example is inspired by JGAP's "Minimize Make Change" example. <br/>
- *
+ * This example demonstrates how to use the {@link GAGrid} framework. It is 
inspired by
+ * <a 
href="https://github.com/martin-steghoefer/jgap/blob/master/examples/src/examples/MinimizingMakeChange.java";>
+ * JGAP's "Minimize Make Change"</a> example.
+ * <p>
  * In this example, the objective is to calculate the minimum number of coins 
that equal user specified amount of
- * change
- *
- * ie: -DAMOUNTCHANGE
- *
- * mvn exec:java 
-Dexec.mainClass="org.apache.ignite.examples.ml.genetic.change.OptimizeMakeChangeGAExample"
- * -DAMOUNTCHANGE=75
- *
- * <p> Remote nodes should always be started with special configuration file 
which enables P2P class loading: {@code
- * 'ignite.{sh|bat} examples/config/example-ignite.xml'}.</p> <p> 
Alternatively you can run ExampleNodeStartup in
- * another JVM which will start node with {@code 
examples/config/example-ignite.xml} configuration.</p>
+ * change ie: {@code -DAMOUNTCHANGE}.</p>
+ * <p>
+ * {@code mvn exec:java 
-Dexec.mainClass="org.apache.ignite.examples.ml.genetic.change.OptimizeMakeChangeGAExample"
+ * -DAMOUNTCHANGE=75}</p>
+ * <p>
+ * Code in this example launches Ignite grid, prepares simple test data (gene 
pool) and configures GA grid.</p>
+ * <p>
+ * After that it launches the process of evolution on GA grid and outputs the 
progress and results.</p>
+ * <p>
+ * You can change the test data and parameters of GA grid used in this example 
and re-run it to explore
+ * this functionality further.</p>
+ * <p>
+ * Remote nodes should always be started with special configuration file which 
enables P2P class loading: {@code
+ * 'ignite.{sh|bat} examples/config/example-ignite.xml'}.</p>
+ * <p>
+ *  Alternatively you can run ExampleNodeStartup in another JVM which will 
start node with
+ *  {@code examples/config/example-ignite.xml} configuration.</p>
  */
 public class OptimizeMakeChangeGAExample {
-    /** Ignite instance */
-    private static Ignite ignite = null;
-
-    /** GAGrid */
-    private static GAGrid gaGrid = null;
-
-    /** GAConfiguration */
-    private static GAConfiguration gaConfig = null;
-
-    /** amount of change */
-    private static String sAmountChange = null;
-
-    /** Ignite logger */
-    private static IgniteLogger logger = null;
-
     /**
      * Executes example.
      *
-     * Specify value for -DAMOUNTCHANGE JVM system variable
+     * Specify value for {@code -DAMOUNTCHANGE} JVM system variable.
      *
      * @param args Command line arguments, none required.
      */
     public static void main(String args[]) {
+        System.out.println(">>> OptimizeMakeChange GA grid example started.");
+
         System.setProperty("IGNITE_QUIET", "false");
 
-        sAmountChange = "75";
+        String sAmountChange = "75";
 
-        StringBuffer sbErrorMessage = new StringBuffer();
-        sbErrorMessage.append("AMOUNTCHANGE System property not set. Please 
provide a valid value between 1 and 99. ");
-        sbErrorMessage.append(" ");
-        sbErrorMessage.append("IE: -DAMOUNTCHANGE=75");
-        sbErrorMessage.append("\n");
-        sbErrorMessage.append("Using default value: 75");
+        StringBuilder sbErrorMsg = new StringBuilder();
+        sbErrorMsg.append("AMOUNTCHANGE System property not set. Please 
provide a valid value between 1 and 99. ");
+        sbErrorMsg.append(" ");
+        sbErrorMsg.append("IE: -DAMOUNTCHANGE=75");
+        sbErrorMsg.append("\n");
+        sbErrorMsg.append("Using default value: 75");
 
-        //Check if -DAMOUNTCHANGE JVM system variable is provided
-        if (System.getProperty("AMOUNTCHANGE") == null) {
-            System.out.println(sbErrorMessage);
-        }
-        else {
+        //Check if -DAMOUNTCHANGE JVM system variable is provided.
+        if (System.getProperty("AMOUNTCHANGE") == null)
+            System.out.println(sbErrorMsg);
+        else
             sAmountChange = System.getProperty("AMOUNTCHANGE");
-        }
 
         try {
+            // Create an Ignite instance as you would in any other use case.
+            Ignite ignite = 
Ignition.start("examples/config/example-ignite.xml");
 
-            //Create an Ignite instance as you would in any other use case.
-            ignite = Ignition.start("examples/config/example-ignite.xml");
-
-            logger = ignite.log();
+            IgniteLogger log = ignite.log();
 
-            // Create GAConfiguration
-            gaConfig = new GAConfiguration();
+            // Create GAConfiguration.
+            GAConfiguration gaCfg = new GAConfiguration();
 
-            // set Gene Pool
+            // Set Gene Pool.
             List<Gene> genes = getGenePool();
 
-            // set selection method
-            
gaConfig.setSelectionMtd(GAGridConstants.SELECTION_METHOD.SELECTON_METHOD_ELETISM);
-            gaConfig.setElitismCnt(10);
+            // Set selection method.
+            
gaCfg.setSelectionMtd(GAGridConstants.SELECTION_METHOD.SELECTON_METHOD_ELETISM);
+            gaCfg.setElitismCnt(10);
 
-            // set the Chromosome Length to '4' since we have 4 coins.
-            gaConfig.setChromosomeLen(4);
+            // Set the Chromosome Length to '4' since we have 4 coins.
+            gaCfg.setChromosomeLen(4);
 
-            // set population size
-            gaConfig.setPopulationSize(500);
+            // Set population size.
+            gaCfg.setPopulationSize(500);
 
-            // initialize gene pool
-            gaConfig.setGenePool(genes);
+            // Initialize gene pool.
+            gaCfg.setGenePool(genes);
 
-            // set Truncate Rate
-            gaConfig.setTruncateRate(.10);
+            // Set Truncate Rate.
+            gaCfg.setTruncateRate(.10);
 
-            // set Cross Over Rate
-            gaConfig.setCrossOverRate(.50);
+            // Set Cross Over Rate.
+            gaCfg.setCrossOverRate(.50);
 
-            // set Mutation Rate
-            gaConfig.setMutationRate(.50);
+            // Set Mutation Rate.
+            gaCfg.setMutationRate(.50);
 
-            // create and set Fitness function
+            // Create and set Fitness function.
             OptimizeMakeChangeFitnessFunction function = new 
OptimizeMakeChangeFitnessFunction(new Integer(sAmountChange));
-            gaConfig.setFitnessFunction(function);
+            gaCfg.setFitnessFunction(function);
 
-            // create and set TerminateCriteria
+            // Create and set TerminateCriteria.
             OptimizeMakeChangeTerminateCriteria termCriteria = new 
OptimizeMakeChangeTerminateCriteria(ignite);
 
             ChromosomeCriteria chromosomeCriteria = new ChromosomeCriteria();
 
-            List values = new ArrayList();
+            List<String> values = new ArrayList<>();
 
             values.add("coinType=QUARTER");
             values.add("coinType=DIME");
@@ -142,40 +133,41 @@ public class OptimizeMakeChangeGAExample {
 
             chromosomeCriteria.setCriteria(values);
 
-            gaConfig.setChromosomeCriteria(chromosomeCriteria);
-            gaConfig.setTerminateCriteria(termCriteria);
+            gaCfg.setChromosomeCriteria(chromosomeCriteria);
+            gaCfg.setTerminateCriteria(termCriteria);
 
-            // initialize GAGrid
-            gaGrid = new GAGrid(gaConfig, ignite);
+            // Initialize GAGrid.
+            GAGrid gaGrid = new GAGrid(gaCfg, ignite);
 
-            
logger.info("##########################################################################################");
+            
log.info("##########################################################################################");
 
-            logger.info("Calculating optimal set of coins where amount of 
change is " + sAmountChange);
+            log.info("Calculating optimal set of coins where amount of change 
is " + sAmountChange);
 
-            
logger.info("##########################################################################################");
+            
log.info("##########################################################################################");
 
-            Chromosome fittestChromosome = gaGrid.evolve();
+            Chromosome chromosome = gaGrid.evolve();
 
-            Ignition.stop(true);
+            System.out.println(">>> Evolution result: " + chromosome);
 
-            ignite = null;
+            Ignition.stop(true);
 
+            System.out.println(">>> OptimizeMakeChange GA grid example 
completed.");
         }
         catch (Exception e) {
-            System.out.println(e);
+            System.out.println(e.getMessage());
+            e.printStackTrace();
         }
-
     }
 
     /**
-     * Helper routine to initialize Gene pool
+     * Helper routine to initialize Gene pool.
      *
-     * In typical usecase genes may be stored in database.
+     * In typical use case genes may be stored in database.
      *
-     * @return List of Genes
+     * @return List of Genes.
      */
     private static List<Gene> getGenePool() {
-        List<Gene> list = new ArrayList();
+        List<Gene> list = new ArrayList<>();
 
         Gene quarterGene1 = new Gene(new Coin(Coin.CoinType.QUARTER, 3));
         Gene quarterGene2 = new Gene(new Coin(Coin.CoinType.QUARTER, 2));
@@ -212,5 +204,4 @@ public class OptimizeMakeChangeGAExample {
 
         return list;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeTerminateCriteria.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeTerminateCriteria.java
 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeTerminateCriteria.java
index 2080ac3..1d6612c 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeTerminateCriteria.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeTerminateCriteria.java
@@ -26,57 +26,59 @@ import 
org.apache.ignite.ml.genetic.parameter.ITerminateCriteria;
 import org.apache.ignite.ml.genetic.utils.GAGridUtils;
 
 /**
- * Terminate Condition implementation for OptimizeMakeChangeGATest <br/>
+ * Terminate Condition implementation for {@link OptimizeMakeChangeGAExample}.
  */
 public class OptimizeMakeChangeTerminateCriteria implements ITerminateCriteria 
{
-    /** Ignite logger */
-    private IgniteLogger igniteLogger = null;
-    /** Ignite instance */
-    private Ignite ignite = null;
+    /** Ignite logger. */
+    private IgniteLogger igniteLog;
+    /** Ignite instance. */
+    private Ignite ignite;
 
     /**
-     * @param ignite Ignite
+     * Create class instance.
+     *
+     * @param ignite Ignite instance.
      */
     public OptimizeMakeChangeTerminateCriteria(Ignite ignite) {
         this.ignite = ignite;
-        this.igniteLogger = ignite.log();
+        this.igniteLog = ignite.log();
     }
 
     /**
-     * @param fittestChromosome Most fit chromosome at for the nth generation
-     * @param averageFitnessScore Average fitness score as of the nth 
generation
-     * @param currentGeneration Current generation
-     * @return Boolean value
+     * Check whether termination condition is met.
+     *
+     * @param fittestChromosome Most fit chromosome at for the nth generation.
+     * @param averageFitnessScore Average fitness score as of the nth 
generation.
+     * @param currGeneration Current generation.
+     * @return Status whether condition is met or not.
      */
     public boolean isTerminationConditionMet(Chromosome fittestChromosome, 
double averageFitnessScore,
-        int currentGeneration) {
+        int currGeneration) {
         boolean isTerminate = true;
 
-        
igniteLogger.info("##########################################################################################");
-        igniteLogger.info("Generation: " + currentGeneration);
-        igniteLogger.info("Fittest is Chromosome Key: " + fittestChromosome);
-        igniteLogger.info("Chromsome: " + fittestChromosome);
+        
igniteLog.info("##########################################################################################");
+        igniteLog.info("Generation: " + currGeneration);
+        igniteLog.info("Fittest is Chromosome Key: " + fittestChromosome);
+        igniteLog.info("Chromosome: " + fittestChromosome);
         printCoins(GAGridUtils.getGenesInOrderForChromosome(ignite, 
fittestChromosome));
-        igniteLogger.info("Avg Chromsome Fitness: " + averageFitnessScore);
-        
igniteLogger.info("##########################################################################################");
+        igniteLog.info("Avg Chromosome Fitness: " + averageFitnessScore);
+        
igniteLog.info("##########################################################################################");
 
-        if (!(currentGeneration > 5)) {
+        if (!(currGeneration > 5))
             isTerminate = false;
-        }
 
         return isTerminate;
     }
 
     /**
-     * Helper to print change detail
+     * Helper to print change details.
      *
-     * @param genes List if Genes
+     * @param genes List if Genes.
      */
     private void printCoins(List<Gene> genes) {
         for (Gene gene : genes) {
-            igniteLogger.info("Coin Type: " + 
((Coin)gene.getVal()).getCoinType().toString());
-            igniteLogger.info("Number of Coins: " + 
((Coin)gene.getVal()).getNumberOfCoins());
+            igniteLog.info("Coin Type: " + 
((Coin)gene.getVal()).getCoinType().toString());
+            igniteLog.info("Number of Coins: " + 
((Coin)gene.getVal()).getNumOfCoins());
         }
-
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldFitnessFunction.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldFitnessFunction.java
 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldFitnessFunction.java
index 190bd2b..a339ff5 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldFitnessFunction.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldFitnessFunction.java
@@ -22,41 +22,30 @@ import org.apache.ignite.ml.genetic.Gene;
 import org.apache.ignite.ml.genetic.IFitnessFunction;
 
 /**
- * This example demonstrates how to create a IFitnessFunction
- *
- * Your IFitness function will vary depending on your particular use case.
- *
- * For this fitness function, we simply want to calculate the value of
- *
- * an individual solution relative to other solutions.
- *
- *
- * To do this, we simply increase fitness score by '1' for each character
- *
- * that is correct position.
- *
- * For our solution, our genetic algorithm will continue until
- *
- * we achieve a fitness score of '11', as 'HELLO WORLD' contains '11' 
characters.
+ * This example demonstrates how to create a {@link IFitnessFunction}.
+ * <p>
+ * Your fitness function will vary depending on your particular use case. For 
this fitness function, we simply want
+ * to calculate the value of an individual solution relative to other 
solutions.
+ * <p>
+ * To do this, we increase fitness score by '1' for each character that is in 
correct position.</p>
+ * <p>
+ * For our solution, genetic algorithm will continue until we achieve a 
fitness score of '11', as 'HELLO WORLD'
+ * contains 11 characters.</p>
  */
 public class HelloWorldFitnessFunction implements IFitnessFunction {
-    /** Optimal target solution */
-    private String targetString = "HELLO WORLD";
-
     /**
-     * Calculate fitness
+     * Calculate fitness.
      *
-     * @param genes List of Genes
-     * @return Fitness value
+     * @param genes List of Genes.
+     * @return Fitness value.
      */
     public double evaluate(List<Gene> genes) {
-
         double matches = 0;
 
         for (int i = 0; i < genes.size(); i++) {
-            if 
(((Character)(genes.get(i).getVal())).equals(targetString.charAt(i))) {
+            String targetStr = "HELLO WORLD";
+            if (genes.get(i).getVal().equals(targetStr.charAt(i)))
                 matches = matches + 1;
-            }
         }
         return matches;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldGAExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldGAExample.java
 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldGAExample.java
index 839471a..3182d2f 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldGAExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldGAExample.java
@@ -27,99 +27,99 @@ import org.apache.ignite.ml.genetic.Gene;
 import org.apache.ignite.ml.genetic.parameter.GAConfiguration;
 
 /**
- * This example demonstrates how to use the GAGrid framework.
- *
- * In this example, we want to evolve a string of 11 characters such that the 
word 'HELLO WORLD'.
- *
- * is found.
- *
- *
- * How To Run:
- *
- * mvn exec:java 
-Dexec.mainClass="org.apache.ignite.examples.ml.genetic.helloworld.HelloWorldGAExample"
- *
- * <p> Remote nodes should always be started with special configuration file 
which enables P2P class loading: {@code
- * 'ignite.{sh|bat} examples/config/example-ignite.xml'}.</p> <p> 
Alternatively you can run ExampleNodeStartup in
- * another JVM which will start node with {@code 
examples/config/example-ignite.xml} configuration.</p>
+ * This example demonstrates how to use the {@link GAGrid} framework. In this 
example, we want to evolve a string
+ * of 11 characters such that the word 'HELLO WORLD' is found.
+ * <p>
+ * Code in this example launches Ignite grid, prepares simple test data (gene 
pool) and configures GA grid.</p>
+ * <p>
+ * After that it launches the process of evolution on GA grid and outputs the 
progress and results.</p>
+ * <p>
+ * You can change the test data and parameters of GA grid used in this example 
and re-run it to explore
+ * this functionality further.</p>
+ * <p>
+ * How to run from command line:</p>
+ * <p>
+ * {@code mvn exec:java 
-Dexec.mainClass="org.apache.ignite.examples.ml.genetic.helloworld.HelloWorldGAExample"}</p>
+ * <p>
+ *  Remote nodes should always be started with special configuration file 
which enables P2P class loading: {@code
+ * 'ignite.{sh|bat} examples/config/example-ignite.xml'}.</p>
+ * <p>
+ * Alternatively you can run ExampleNodeStartup in another JVM which will 
start node with
+ * {@code examples/config/example-ignite.xml} configuration.</p>
  */
 public class HelloWorldGAExample {
-    /** Ignite instance */
-    private static Ignite ignite = null;
-    /** GAGrid */
-    private static GAGrid gaGrid = null;
-    /** GAConfiguration */
-    private static GAConfiguration gaConfig = null;
-
     /**
      * Executes example.
      *
      * @param args Command line arguments, none required.
      */
     public static void main(String args[]) {
+        System.out.println(">>> HelloWorld GA grid example started.");
+
         System.setProperty("IGNITE_QUIET", "false");
 
         try {
+            // Create an Ignite instance as you would in any other use case.
+            Ignite ignite = 
Ignition.start("examples/config/example-ignite.xml");
 
-            //Create an Ignite instance as you would in any other use case.
+            // Create GAConfiguration.
+            GAConfiguration gaCfg = new GAConfiguration();
 
-            ignite = Ignition.start("examples/config/example-ignite.xml");
-
-            // Create GAConfiguration
-            gaConfig = new GAConfiguration();
-
-            // set Gene Pool
+            // Set Gene Pool.
             List<Gene> genes = getGenePool();
 
-            // set the Chromosome Length to '11' since 'HELLO WORLD' contains 
11 characters.
-            gaConfig.setChromosomeLen(11);
+            // Set the Chromosome Length to '11' since 'HELLO WORLD' contains 
11 characters.
+            gaCfg.setChromosomeLen(11);
 
-            // initialize gene pool
-            gaConfig.setGenePool(genes);
+            // Initialize gene pool.
+            gaCfg.setGenePool(genes);
 
-            // create and set Fitness function
+            // Create and set Fitness function.
             HelloWorldFitnessFunction function = new 
HelloWorldFitnessFunction();
-            gaConfig.setFitnessFunction(function);
+            gaCfg.setFitnessFunction(function);
 
-            // create and set TerminateCriteria
+            // Create and set TerminateCriteria.
             HelloWorldTerminateCriteria termCriteria = new 
HelloWorldTerminateCriteria(ignite);
-            gaConfig.setTerminateCriteria(termCriteria);
+            gaCfg.setTerminateCriteria(termCriteria);
 
             ignite.log();
 
-            gaGrid = new GAGrid(gaConfig, ignite);
-            // evolve the population
-            Chromosome fittestChromosome = gaGrid.evolve();
+            GAGrid gaGrid = new GAGrid(gaCfg, ignite);
 
-            Ignition.stop(true);
+            // Evolve the population.
+            Chromosome chromosome = gaGrid.evolve();
+
+            System.out.println(">>> Evolution result: " + chromosome);
 
-            ignite = null;
+            Ignition.stop(true);
 
+            System.out.println(">>> HelloWorld GA grid example completed.");
         }
         catch (Exception e) {
-            System.out.println(e);
+            System.out.println(e.getMessage());
+            e.printStackTrace();
         }
-
     }
 
     /**
-     * Helper routine to initialize Gene pool
+     * Helper routine to initialize Gene pool.
      *
-     * In typical usecase genes may be stored in database.
+     * In typical use case genes may be stored in database.
      *
-     * @return List<Gene>
+     * @return List of Gene objects.
      */
     private static List<Gene> getGenePool() {
-        List<Gene> list = new ArrayList();
+        List<Gene> list = new ArrayList<>();
 
         char[] chars = {
             'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 
'N', 'O', 'P', 'Q', 'R', 'S',
             'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' '};
 
-        for (int i = 0; i < chars.length; i++) {
-            Gene gene = new Gene(new Character(chars[i]));
+        for (char aChar : chars) {
+            Gene gene = new Gene(aChar);
             list.add(gene);
         }
+
         return list;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldTerminateCriteria.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldTerminateCriteria.java
 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldTerminateCriteria.java
index 41809d4..f149da1 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldTerminateCriteria.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldTerminateCriteria.java
@@ -26,62 +26,63 @@ import 
org.apache.ignite.ml.genetic.parameter.ITerminateCriteria;
 import org.apache.ignite.ml.genetic.utils.GAGridUtils;
 
 /**
- * Represents the terminate condition for HelloWorld Genetic algorithm
- *
- * Class terminates Genetic algorithm when fitnessScore > 10
+ * Represents the terminate condition for {@link HelloWorldGAExample}.
+ * <p>
+ * Class terminates Genetic algorithm when fitness score is more than 10.</p>
  */
 public class HelloWorldTerminateCriteria implements ITerminateCriteria {
-    /** Ignite logger */
-    private IgniteLogger igniteLogger = null;
-    /** Ignite instance */
-    private Ignite ignite = null;
+    /** Ignite logger. */
+    private IgniteLogger igniteLog;
+    /** Ignite instance. */
+    private Ignite ignite;
 
     /**
-     * @param ignite Ignite
+     * Create class instance.
+     *
+     * @param ignite Ignite instance.
      */
     public HelloWorldTerminateCriteria(Ignite ignite) {
         this.ignite = ignite;
-        this.igniteLogger = ignite.log();
+        this.igniteLog = ignite.log();
     }
 
     /**
-     * @param fittestChromosome Most fit chromosome at for the nth generation
-     * @param averageFitnessScore Average fitness score as of the nth 
generation
-     * @param currentGeneration Current generation
-     * @return Boolean value
+     * Check whether termination condition is met.
+     *
+     * @param fittestChromosome Most fit chromosome at for the nth generation.
+     * @param averageFitnessScore Average fitness score as of the nth 
generation.
+     * @param currGeneration Current generation.
+     * @return Status whether condition is met or not.
      */
     public boolean isTerminationConditionMet(Chromosome fittestChromosome, 
double averageFitnessScore,
-        int currentGeneration) {
+        int currGeneration) {
         boolean isTerminate = true;
 
-        
igniteLogger.info("##########################################################################################");
-        igniteLogger.info("Generation: " + currentGeneration);
-        igniteLogger.info("Fittest is Chromosome Key: " + fittestChromosome);
-        igniteLogger.info("Chromosome: " + fittestChromosome);
+        
igniteLog.info("##########################################################################################");
+        igniteLog.info("Generation: " + currGeneration);
+        igniteLog.info("Fittest is Chromosome Key: " + fittestChromosome);
+        igniteLog.info("Chromosome: " + fittestChromosome);
         printPhrase(GAGridUtils.getGenesInOrderForChromosome(ignite, 
fittestChromosome));
-        igniteLogger.info("Avg Chromosome Fitness: " + averageFitnessScore);
-        
igniteLogger.info("##########################################################################################");
+        igniteLog.info("Avg Chromosome Fitness: " + averageFitnessScore);
+        
igniteLog.info("##########################################################################################");
 
-        if (!(fittestChromosome.getFitnessScore() > 10)) {
+        if (!(fittestChromosome.getFitnessScore() > 10))
             isTerminate = false;
-        }
 
         return isTerminate;
     }
 
     /**
-     * Helper to print Phrase
+     * Helper to print phrase.
      *
-     * @param List of Genes
+     * @param genes List of Genes.
      */
     private void printPhrase(List<Gene> genes) {
+        StringBuilder sbPhrase = new StringBuilder();
 
-        StringBuffer sbPhrase = new StringBuffer();
-
-        for (Gene gene : genes) {
+        for (Gene gene : genes)
             sbPhrase.append(((Character)gene.getVal()).toString());
-        }
-        igniteLogger.info(sbPhrase.toString());
-    }
 
+        igniteLog.info(sbPhrase.toString());
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/Item.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/Item.java
 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/Item.java
index f64cb17..43a387c 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/Item.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/Item.java
@@ -20,52 +20,54 @@ package org.apache.ignite.examples.ml.genetic.knapsack;
 import java.io.Serializable;
 
 /**
- * POJO to model an Item
+ * POJO to model an Item.
  */
 public class Item implements Serializable {
-    /** weight of item in lbs. */
+    /** Weight of item in lbs. */
     private double weight;
-    /** value of item */
-    private double value;
-    /** name of item */
+    /** Value of item. */
+    private double val;
+    /** Name of item. */
     private String name;
 
     /**
-     * Get the weight
+     * Get the weight.
      *
-     * @return Weight
+     * @return Weight.
      */
     public double getWeight() {
         return weight;
     }
 
     /**
-     * Set the weight
+     * Set the weight.
      *
-     * @param weight Weight
+     * @param weight Weight.
      */
     public void setWeight(double weight) {
         this.weight = weight;
     }
 
     /**
-     * Get the value
+     * Get the value.
      *
-     * @return Value
+     * @return Value.
      */
-    public double getValue() {
-        return value;
+    public double getVal() {
+        return val;
     }
 
     /**
-     * @param value Value
+     * Set the value.
+     *
+     * @param val Value.
      */
-    public void setValue(double value) {
-        this.value = value;
+    public void setVal(double val) {
+        this.val = val;
     }
 
     /**
-     * Get the name
+     * Get the name.
      *
      * @return Name
      */
@@ -74,9 +76,9 @@ public class Item implements Serializable {
     }
 
     /**
-     * Set the name
+     * Set the name.
      *
-     * @param name Name
+     * @param name Name.
      */
     public void setName(String name) {
         this.name = name;
@@ -84,7 +86,6 @@ public class Item implements Serializable {
 
     /** {@inheritDoc} */
     @Override public String toString() {
-        return "Item [weight=" + weight + ", value=" + value + ", name=" + 
name + "]";
+        return "Item [weight=" + weight + ", value=" + val + ", name=" + name 
+ "]";
     }
-
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackFitnessFunction.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackFitnessFunction.java
 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackFitnessFunction.java
index bf24edf..e7c72b0 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackFitnessFunction.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackFitnessFunction.java
@@ -23,47 +23,40 @@ import org.apache.ignite.ml.genetic.Gene;
 import org.apache.ignite.ml.genetic.IFitnessFunction;
 
 /**
- * This example demonstrates how to create a IFitnessFunction
- *
- * Your IFitnessFunction will vary depending on your particular use case.
- *
- * For this fitness function, we simply want to calculate the weight and value 
of
- *
- * an individual solution relative to other solutions.
- *
- *
- * To do this, we total the weights and values of all the genes within a 
chromosome.
+ * This example demonstrates how to create a {@link IFitnessFunction}.
+ * <p>
+ * Your fitness function will vary depending on your particular use case. For 
this fitness function, we simply want
+ * to calculate the weight and value of an individual solution relative to 
other solutions.</p>
+ * <p>
+ * To do this, we total the weights and values of all the genes within a 
chromosome.</p>
  */
 public class KnapsackFitnessFunction implements IFitnessFunction {
-    /** weight capacity of knapsack */
-    private double maximumWeight = 20;
-
     /**
-     * Calculate fitness
+     * Calculate fitness.
      *
-     * @param genes List of Genes
-     * @return Fitness value
+     * @param genes List of Genes.
+     * @return Fitness value.
      */
     public double evaluate(List<Gene> genes) {
-
-        double value = 0;
+        double val = 0;
         double weight = 0;
 
-        List<Long> dups = new ArrayList<Long>();
+        List<Long> duplicates = new ArrayList<>();
         int badSolution = 1;
 
-        for (Gene agene : genes) {
-            weight = weight + ((Item)(agene.getVal())).getWeight();
-            value = value + ((Item)(agene.getVal())).getValue();
+        for (Gene gene : genes) {
+            weight = weight + ((Item)(gene.getVal())).getWeight();
+            val = val + ((Item)(gene.getVal())).getVal();
 
-            if (dups.contains(agene.id()) || (weight > maximumWeight)) {
+            double maximumWeight = 20;
+            if (duplicates.contains(gene.id()) || (weight > maximumWeight)) {
                 badSolution = 0;
                 break;
             }
             else
-                dups.add(agene.id());
+                duplicates.add(gene.id());
         }
 
-        return (value * badSolution);
+        return (val * badSolution);
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackGAExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackGAExample.java
 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackGAExample.java
index 7578226..873c1c6 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackGAExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackGAExample.java
@@ -21,269 +21,273 @@ import java.util.ArrayList;
 import java.util.List;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.Ignition;
+import org.apache.ignite.ml.genetic.Chromosome;
 import org.apache.ignite.ml.genetic.GAGrid;
 import org.apache.ignite.ml.genetic.Gene;
 import org.apache.ignite.ml.genetic.parameter.GAConfiguration;
 
 /**
- * This example demonstrates how to use the GAGrid framework.
- *
- * Example demonstrates Knapsack Problem:  Given a set of 30 items, each with 
a weight and a value, pack 10 items in
- * knapsack so that the total weight is less <= 20 lbs. and the total value is 
maximized.
- *
- *
- * How To Run:
- *
- * mvn exec:java 
-Dexec.mainClass="org.apache.ignite.examples.ml.genetic.knapsack.KnapsackGAExample"
- *
- * <p> Remote nodes should always be started with special configuration file 
which enables P2P class loading: {@code
- * 'ignite.{sh|bat} examples/config/example-ignite.xml'}.</p> <p> 
Alternatively you can run ExampleNodeStartup in
- * another JVM which will start node with {@code 
examples/config/example-ignite.xml} configuration.</p>
+ * This example demonstrates how to use the {@link GAGrid} framework. It shows 
working with Knapsack Problem:
+ * Given a set of 30 items, each with a weight and a value, pack 10 items in 
knapsack so that the total weight
+ * is less or equal 20 lbs, and the total value is maximized.
+ * <p>
+ * Code in this example launches Ignite grid, prepares simple test data (gene 
pool) and configures GA grid.</p>
+ * <p>
+ * After that it launches the process of evolution on GA grid and outputs the 
progress and results.</p>
+ * <p>
+ * You can change the test data and parameters of GA grid used in this example 
and re-run it to explore
+ * this functionality further.</p>
+ * <p>
+ * How to run from command line:</p>
+ * <p>
+ * {@code mvn exec:java 
-Dexec.mainClass="org.apache.ignite.examples.ml.genetic.knapsack.KnapsackGAExample"}</p>
+ * <p>
+ * Remote nodes should always be started with special configuration file which 
enables P2P class loading: {@code
+ * 'ignite.{sh|bat} examples/config/example-ignite.xml'}.</p>
+ * <p>
+ * Alternatively you can run ExampleNodeStartup in another JVM which will 
start node with
+ * {@code examples/config/example-ignite.xml} configuration.</p>
  */
 public class KnapsackGAExample {
-    /** Ignite instance */
-    private static Ignite ignite = null;
-    /** GAGrid */
-    private static GAGrid gaGrid = null;
-    /** GAConfiguration */
-    private static GAConfiguration gaConfig = null;
-
     /**
      * @param args Command line arguments, none required.
      */
     public static void main(String args[]) {
+        System.out.println(">>> Knapsack GA grid example started.");
+
         System.setProperty("IGNITE_QUIET", "false");
 
         try {
+            // Create an Ignite instance as you would in any other use case.
+            Ignite ignite = 
Ignition.start("examples/config/example-ignite.xml");
 
-            //Create an Ignite instance as you would in any other use case.
-            ignite = Ignition.start("examples/config/example-ignite.xml");
+            // Create GAConfiguration.
+            GAConfiguration gaCfg = new GAConfiguration();
 
-            // Create GAConfiguration
-            gaConfig = new GAConfiguration();
-
-            // set Gene Pool
+            // Set Gene Pool.
             List<Gene> genes = getGenePool();
 
-            // set the Chromosome Length to '10' since our knapsack may 
contain a total of 10 items.
-            gaConfig.setChromosomeLen(10);
+            // Set the Chromosome Length to '10' since our knapsack may 
contain a total of 10 items.
+            gaCfg.setChromosomeLen(10);
 
-            // initialize gene pool
-            gaConfig.setGenePool(genes);
+            // Initialize gene pool.
+            gaCfg.setGenePool(genes);
 
-            // create and set Fitness function
+            // Create and set Fitness function.
             KnapsackFitnessFunction function = new KnapsackFitnessFunction();
-            gaConfig.setFitnessFunction(function);
+            gaCfg.setFitnessFunction(function);
 
-            // create and set TerminateCriteria
+            // Create and set TerminateCriteria.
             KnapsackTerminateCriteria termCriteria = new 
KnapsackTerminateCriteria(ignite);
-            gaConfig.setTerminateCriteria(termCriteria);
+            gaCfg.setTerminateCriteria(termCriteria);
 
             ignite.log();
 
-            gaGrid = new GAGrid(gaConfig, ignite);
-            // evolve the population
-            gaGrid.evolve();
+            GAGrid gaGrid = new GAGrid(gaCfg, ignite);
 
-            Ignition.stop(true);
+            // Evolve the population.
+            Chromosome chromosome = gaGrid.evolve();
+
+            System.out.println(">>> Evolution result: " + chromosome);
 
-            ignite = null;
+            Ignition.stop(true);
 
+            System.out.println(">>> Knapsack GA grid example completed.");
         }
         catch (Exception e) {
-            System.out.println(e);
+            System.out.println(e.getMessage());
+            e.printStackTrace();
         }
-
     }
 
     /**
-     * Helper routine to initialize Gene pool
+     * Helper routine to initialize Gene pool.
      *
-     * In typical usecase genes may be stored in database.
+     * In typical use case genes may be stored in database.
      *
-     * @return List<Gene>
+     * @return List of Gene objects.
      */
     private static List<Gene> getGenePool() {
-        List<Gene> list = new ArrayList<Gene>();
+        List<Gene> list = new ArrayList<>();
 
         Item item1 = new Item();
         item1.setName("Swiss Army Knife");
         item1.setWeight(0.08125);
-        item1.setValue(15);
+        item1.setVal(15);
         Gene gene1 = new Gene(item1);
 
         Item item2 = new Item();
         item2.setName("Duct Tape");
         item2.setWeight(1.3);
-        item2.setValue(3);
+        item2.setVal(3);
         Gene gene2 = new Gene(item2);
 
         Item item3 = new Item();
         item3.setName("Rope (50 feet)");
         item3.setWeight(7);
-        item3.setValue(10);
+        item3.setVal(10);
         Gene gene3 = new Gene(item3);
 
         Item item4 = new Item();
         item4.setName("Satellite phone");
         item4.setWeight(2);
-        item4.setValue(8);
+        item4.setVal(8);
         Gene gene4 = new Gene(item4);
 
         Item item5 = new Item();
         item5.setName("Elmer's Glue");
         item5.setWeight(0.25);
-        item5.setValue(2);
+        item5.setVal(2);
         Gene gene5 = new Gene(item5);
 
         Item item6 = new Item();
         item6.setName("Toilet Paper Roll");
         item6.setWeight(.5);
-        item6.setValue(4);
+        item6.setVal(4);
         Gene gene6 = new Gene(item6);
 
         Item item7 = new Item();
         item7.setName("Binoculars");
         item7.setWeight(3);
-        item7.setValue(5);
+        item7.setVal(5);
         Gene gene7 = new Gene(item7);
 
         Item item8 = new Item();
         item8.setName("Compass");
         item8.setWeight(0.0573202);
-        item8.setValue(15);
+        item8.setVal(15);
         Gene gene8 = new Gene(item8);
 
         Item item9 = new Item();
-        item9.setName("Jug (prefilled with water)");
+        item9.setName("Jug (pre-filled with water)");
         item9.setWeight(4);
-        item9.setValue(6);
+        item9.setVal(6);
         Gene gene9 = new Gene(item9);
 
         Item item10 = new Item();
         item10.setName("Flashlight");
         item10.setWeight(2);
-        item10.setValue(4);
+        item10.setVal(4);
         Gene gene10 = new Gene(item10);
 
         Item item11 = new Item();
         item11.setName("Box of paper clips");
         item11.setWeight(.9);
-        item11.setValue(2);
+        item11.setVal(2);
         Gene gene11 = new Gene(item11);
 
         Item item12 = new Item();
         item12.setName("Gloves (1 pair)");
         item12.setWeight(.8125);
-        item12.setValue(3);
+        item12.setVal(3);
         Gene gene12 = new Gene(item12);
 
         Item item13 = new Item();
         item13.setName("Scissors");
         item13.setWeight(0.2);
-        item13.setValue(2);
+        item13.setVal(2);
         Gene gene13 = new Gene(item13);
 
         Item item14 = new Item();
         item14.setName("Signal Flair (4pk)");
         item14.setWeight(4);
-        item14.setValue(5);
+        item14.setVal(5);
         Gene gene14 = new Gene(item14);
 
         Item item15 = new Item();
         item15.setName("Water Purifying System");
         item15.setWeight(0.5125);
-        item15.setValue(4);
+        item15.setVal(4);
         Gene gene15 = new Gene(item15);
 
         Item item16 = new Item();
         item16.setName("Whistle");
         item16.setWeight(0.075);
-        item16.setValue(2);
+        item16.setVal(2);
         Gene gene16 = new Gene(item16);
 
         Item item17 = new Item();
         item17.setName("Sleeping Bag");
         item17.setWeight(0.38125);
-        item17.setValue(4);
+        item17.setVal(4);
         Gene gene17 = new Gene(item17);
 
         Item item18 = new Item();
         item18.setName("Insect Repellent");
         item18.setWeight(1.15);
-        item18.setValue(3);
+        item18.setVal(3);
         Gene gene18 = new Gene(item18);
 
         Item item19 = new Item();
         item19.setName("Trowel");
         item19.setWeight(0.31875);
-        item19.setValue(3);
+        item19.setVal(3);
         Gene gene19 = new Gene(item19);
 
         Item item20 = new Item();
         item20.setName("Lighter");
         item20.setWeight(.2);
-        item20.setValue(4);
+        item20.setVal(4);
         Gene gene20 = new Gene(item20);
 
         Item item21 = new Item();
         item21.setName("Safety Horn");
         item21.setWeight(.21);
-        item21.setValue(3);
+        item21.setVal(3);
         Gene gene21 = new Gene(item21);
 
         Item item22 = new Item();
         item22.setName("Headlamp");
         item22.setWeight(.8);
-        item22.setValue(4);
+        item22.setVal(4);
         Gene gene22 = new Gene(item22);
 
         Item item23 = new Item();
         item23.setName("Freeze Dried Food Kit");
         item23.setWeight(2);
-        item23.setValue(6);
+        item23.setVal(6);
         Gene gene23 = new Gene(item23);
 
         Item item24 = new Item();
         item24.setName("Sunscreen");
         item24.setWeight(.5);
-        item24.setValue(4);
+        item24.setVal(4);
         Gene gene24 = new Gene(item24);
 
         Item item25 = new Item();
         item25.setName("Trekking Pole (Adjustable)");
         item25.setWeight(1.3);
-        item25.setValue(4);
+        item25.setVal(4);
         Gene gene25 = new Gene(item25);
 
         Item item26 = new Item();
         item26.setName("Counter Assault Bear Spray");
         item26.setWeight(.5);
-        item26.setValue(4);
+        item26.setVal(4);
         Gene gene26 = new Gene(item26);
 
         Item item27 = new Item();
         item27.setName("Insect Spray");
         item27.setWeight(.5);
-        item27.setValue(3);
+        item27.setVal(3);
         Gene gene27 = new Gene(item27);
 
         Item item28 = new Item();
         item28.setName("Hand sanitizer");
         item28.setWeight(.625);
-        item28.setValue(3);
+        item28.setVal(3);
         Gene gene28 = new Gene(item28);
 
         Item item29 = new Item();
         item29.setName("Mirror");
         item29.setWeight(.5);
-        item29.setValue(3);
+        item29.setVal(3);
         Gene gene29 = new Gene(item29);
 
         Item item30 = new Item();
         item30.setName("First Aid Kit");
         item30.setWeight(3);
-        item30.setValue(6);
+        item30.setVal(6);
         Gene gene30 = new Gene(item30);
 
         list.add(gene1);
@@ -319,5 +323,4 @@ public class KnapsackGAExample {
 
         return list;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackTerminateCriteria.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackTerminateCriteria.java
 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackTerminateCriteria.java
index 487f8a7..1bba159 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackTerminateCriteria.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackTerminateCriteria.java
@@ -26,54 +26,60 @@ import 
org.apache.ignite.ml.genetic.parameter.ITerminateCriteria;
 import org.apache.ignite.ml.genetic.utils.GAGridUtils;
 
 /**
- * Represents the terminate condition for Knapsack Genetic algorithm
- *
- * Class terminates Genetic algorithm when once GA Grid has performed 30 
generations.
+ * Represents the terminate condition for {@link KnapsackGAExample}.
+ * <p>
+ * Class terminates Genetic algorithm when once GA Grid has performed 30 
generations.</p>
  */
 public class KnapsackTerminateCriteria implements ITerminateCriteria {
-    /** Ignite instance */
-    private static Ignite ignite = null;
+    /** Ignite instance. */
+    private Ignite ignite;
 
-    /** Ignite logger */
-    private IgniteLogger igniteLogger = null;
+    /** Ignite logger. */
+    private IgniteLogger igniteLog;
 
     /**
-     * @param ignite Ignite
+     * Create class instance.
+     *
+     * @param ignite Ignite instance.
      */
     public KnapsackTerminateCriteria(Ignite ignite) {
         this.ignite = ignite;
-        this.igniteLogger = this.ignite.log();
+        this.igniteLog = this.ignite.log();
     }
 
     /**
-     * @param fittestChromosome Most fit chromosome at for the nth generation
-     * @param averageFitnessScore Average fitness score as of the nth 
generation
-     * @param currentGeneration Current generation
-     * @return Boolean value
+     * Check whether termination condition is met.
+     *
+     * @param fittestChromosome Most fit chromosome at for the nth generation.
+     * @param averageFitnessScore Average fitness score as of the nth 
generation.
+     * @param currGeneration Current generation.
+     * @return Status whether condition is met or not.
      */
     public boolean isTerminationConditionMet(Chromosome fittestChromosome, 
double averageFitnessScore,
-        int currentGeneration) {
+        int currGeneration) {
         boolean isTerminate = true;
 
-        
igniteLogger.info("##########################################################################################");
-        igniteLogger.info("Generation: " + currentGeneration);
-        igniteLogger.info("Fittest is Chromosome Key: " + fittestChromosome);
-        igniteLogger.info("Total value is: " + 
fittestChromosome.getFitnessScore());
-        igniteLogger.info("Total weight is: " + 
calculateTotalWeight(GAGridUtils.getGenesInOrderForChromosome(ignite, 
fittestChromosome)));
-        igniteLogger.info("Avg Chromosome Fitness: " + averageFitnessScore);
-        igniteLogger.info("Chromosome: " + fittestChromosome);
+        
igniteLog.info("##########################################################################################");
+        igniteLog.info("Generation: " + currGeneration);
+        igniteLog.info("Fittest is Chromosome Key: " + fittestChromosome);
+        igniteLog.info("Total value is: " + 
fittestChromosome.getFitnessScore());
+        igniteLog.info("Total weight is: " + 
calculateTotalWeight(GAGridUtils.getGenesInOrderForChromosome(ignite, 
fittestChromosome)));
+        igniteLog.info("Avg Chromosome Fitness: " + averageFitnessScore);
+        igniteLog.info("Chromosome: " + fittestChromosome);
         printItems(GAGridUtils.getGenesInOrderForChromosome(ignite, 
fittestChromosome));
-        
igniteLogger.info("##########################################################################################");
+        
igniteLog.info("##########################################################################################");
 
-        if (!(currentGeneration > 29))
+        if (!(currGeneration > 29))
             isTerminate = false;
 
         return isTerminate;
     }
 
     /**
-     * @param genes List of Genes
-     * @return double value
+     * Calculate total weight.
+     *
+     * @param genes List of Genes.
+     * @return Calculated value.
      */
     private double calculateTotalWeight(List<Gene> genes) {
         double totalWeight = 0;
@@ -84,16 +90,16 @@ public class KnapsackTerminateCriteria implements 
ITerminateCriteria {
     }
 
     /**
-     * Helper to print items in knapsack
+     * Helper to print items in knapsack.
      *
-     * @param genes List of Genes
+     * @param genes List of Genes.
      */
     private void printItems(List<Gene> genes) {
         for (Gene gene : genes) {
-            
igniteLogger.info("------------------------------------------------------------------------------------------");
-            igniteLogger.info("Name: " + 
((Item)gene.getVal()).getName().toString());
-            igniteLogger.info("Weight: " + ((Item)gene.getVal()).getWeight());
-            igniteLogger.info("Value: " + ((Item)gene.getVal()).getValue());
+            
igniteLog.info("------------------------------------------------------------------------------------------");
+            igniteLog.info("Name: " + ((Item)gene.getVal()).getName());
+            igniteLog.info("Weight: " + ((Item)gene.getVal()).getWeight());
+            igniteLog.info("Value: " + ((Item)gene.getVal()).getVal());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/fea694fe/examples/src/main/java/org/apache/ignite/examples/ml/genetic/movie/Movie.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/movie/Movie.java 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/movie/Movie.java
index 38d27ff2..2eebe5e 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/ml/genetic/movie/Movie.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/ml/genetic/movie/Movie.java
@@ -23,102 +23,104 @@ import java.util.List;
  * POJO to model a movie.
  */
 public class Movie {
-    /** name of movie */
+    /** Name of movie. */
     private String name;
-    /** genre of movie */
+    /** Genre of movie. */
     private List genre;
-    /** rating of movie */
+    /** Rating of movie. */
     private String rating;
 
-    /** IMDB rating */
+    /** IMDB rating. */
     private double imdbRating;
 
-    /** year of movie */
+    /** Year of movie. */
     private String year;
 
     /**
-     * Get the year
+     * Get the year.
      *
-     * @return Year
+     * @return Year.
      */
     public String getYear() {
         return year;
     }
 
     /**
-     * Set the year
+     * Set the year.
      *
-     * @param year Year
+     * @param year Year.
      */
     public void setYear(String year) {
         this.year = year;
     }
 
     /**
-     * Get the IMDB rating
+     * Get the <a href="https://en.wikipedia.org/wiki/IMDb";>IMDB rating</a>.
      *
-     * @return IMDB rating
+     * @return IMDB rating.
      */
     public double getImdbRating() {
         return imdbRating;
     }
 
     /**
-     * Set the IMDB rating
+     * Set the IMDB rating.
      *
-     * @param imdbRating IMDB rating
+     * @param imdbRating IMDB rating.
      */
     public void setImdbRating(double imdbRating) {
         this.imdbRating = imdbRating;
     }
 
     /**
-     * Get the name of movie
+     * Get the name of movie.
      *
-     * @return Name of movie
+     * @return Name of movie.
      */
     public String getName() {
         return name;
     }
 
     /**
-     * Set the name of movie
+     * Set the name of movie.
      *
-     * @param name Movie name
+     * @param name Movie name.
      */
     public void setName(String name) {
         this.name = name;
     }
 
     /**
-     * @return List of genres
+     * Get movie genres.
+     *
+     * @return List of genres.
      */
     public List getGenre() {
         return genre;
     }
 
     /**
-     * Set the genre
+     * Set the genre.
      *
-     * @param genre Genre of movie
+     * @param genre List of genres of movie.
      */
     public void setGenre(List genre) {
         this.genre = genre;
     }
 
     /**
-     * Get the rating of the movie
+     * Get the rating of the movie.
      *
-     * @return Movie rating
+     * @return Movie rating.
      */
     public String getRating() {
         return rating;
     }
 
     /**
-     * Set the rating of the movie
+     * Set the rating of the movie.
      *
-     * @param rating Movie rating
+     * @param rating Movie rating.
      */
     public void setRating(String rating) {
         this.rating = rating;
@@ -129,5 +131,4 @@ public class Movie {
         return "Movie [name=" + name + ", genre=" + genre + ", rating=" + 
rating + ", imdbRating=" + imdbRating
             + ", year=" + year + "]";
     }
-
 }

Reply via email to