IGNITE-9021: [ML] Refactor vectors to dence/sparse
authorzaleslaw <zaleslaw.sin@gmail.com>
Thu, 19 Jul 2018 22:47:12 +0000 (01:47 +0300)
committerYury Babak <ybabak@gridgain.com>
Thu, 19 Jul 2018 22:47:17 +0000 (01:47 +0300)
this closes #4385

308 files changed:
examples/src/main/java/org/apache/ignite/examples/ml/clustering/KMeansClusterizationExample.java
examples/src/main/java/org/apache/ignite/examples/ml/dataset/AlgorithmSpecificDatasetExample.java
examples/src/main/java/org/apache/ignite/examples/ml/dataset/CacheBasedDatasetExample.java
examples/src/main/java/org/apache/ignite/examples/ml/dataset/LocalDatasetExample.java
examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeFitnessFunction.java
examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeGAExample.java
examples/src/main/java/org/apache/ignite/examples/ml/genetic/change/OptimizeMakeChangeTerminateCriteria.java
examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldFitnessFunction.java
examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldGAExample.java
examples/src/main/java/org/apache/ignite/examples/ml/genetic/helloworld/HelloWorldTerminateCriteria.java
examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackFitnessFunction.java
examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackGAExample.java
examples/src/main/java/org/apache/ignite/examples/ml/genetic/knapsack/KnapsackTerminateCriteria.java
examples/src/main/java/org/apache/ignite/examples/ml/genetic/movie/MovieFitnessFunction.java
examples/src/main/java/org/apache/ignite/examples/ml/genetic/movie/MovieGAExample.java
examples/src/main/java/org/apache/ignite/examples/ml/genetic/movie/MovieTerminateCriteria.java
examples/src/main/java/org/apache/ignite/examples/ml/knn/KNNClassificationExample.java
examples/src/main/java/org/apache/ignite/examples/ml/knn/KNNRegressionExample.java
examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/ExampleMatrixStorage.java [deleted file]
examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/MatrixCustomStorageExample.java [deleted file]
examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/MatrixExample.java [deleted file]
examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/MatrixExampleUtil.java [deleted file]
examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/OffHeapMatrixExample.java [deleted file]
examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/SparseMatrixExample.java [deleted file]
examples/src/main/java/org/apache/ignite/examples/ml/math/tracer/TracerExample.java [deleted file]
examples/src/main/java/org/apache/ignite/examples/ml/math/vector/ExampleVectorStorage.java [deleted file]
examples/src/main/java/org/apache/ignite/examples/ml/math/vector/OffHeapVectorExample.java [deleted file]
examples/src/main/java/org/apache/ignite/examples/ml/math/vector/SparseVectorExample.java [deleted file]
examples/src/main/java/org/apache/ignite/examples/ml/math/vector/VectorCustomStorageExample.java [deleted file]
examples/src/main/java/org/apache/ignite/examples/ml/math/vector/VectorExample.java [deleted file]
examples/src/main/java/org/apache/ignite/examples/ml/nn/MLPTrainerExample.java
examples/src/main/java/org/apache/ignite/examples/ml/preprocessing/BinarizationExample.java
examples/src/main/java/org/apache/ignite/examples/ml/preprocessing/ImputingExample.java
examples/src/main/java/org/apache/ignite/examples/ml/preprocessing/ImputingExampleWithMostFrequentValues.java
examples/src/main/java/org/apache/ignite/examples/ml/preprocessing/MinMaxScalerExample.java
examples/src/main/java/org/apache/ignite/examples/ml/preprocessing/NormalizationExample.java
examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionLSQRTrainerExample.java
examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionLSQRTrainerWithMinMaxScalerExample.java
examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionSGDTrainerExample.java
examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/binary/LogisticRegressionSGDTrainerSample.java
examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/multiclass/LogRegressionMultiClassClassificationExample.java
examples/src/main/java/org/apache/ignite/examples/ml/selection/cv/CrossValidationExample.java
examples/src/main/java/org/apache/ignite/examples/ml/selection/split/TrainTestDatasetSplitterExample.java
examples/src/main/java/org/apache/ignite/examples/ml/svm/binary/SVMBinaryClassificationExample.java
examples/src/main/java/org/apache/ignite/examples/ml/svm/multiclass/SVMMultiClassClassificationExample.java
examples/src/main/java/org/apache/ignite/examples/ml/tree/DecisionTreeClassificationTrainerExample.java
examples/src/main/java/org/apache/ignite/examples/ml/tree/DecisionTreeRegressionTrainerExample.java
examples/src/main/java/org/apache/ignite/examples/ml/tree/boosting/GDBOnTreesClassificationTrainerExample.java
examples/src/main/java/org/apache/ignite/examples/ml/tree/boosting/GRBOnTreesRegressionTrainerExample.java
examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestClassificationExample.java
examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestRegressionExample.java
examples/src/main/java/org/apache/ignite/examples/ml/tutorial/Step_1_Read_and_Learn.java
examples/src/main/java/org/apache/ignite/examples/ml/tutorial/Step_2_Imputing.java
examples/src/main/java/org/apache/ignite/examples/ml/tutorial/Step_3_Categorial.java
examples/src/main/java/org/apache/ignite/examples/ml/tutorial/Step_4_Add_age_fare.java
examples/src/main/java/org/apache/ignite/examples/ml/tutorial/Step_5_Scaling.java
examples/src/main/java/org/apache/ignite/examples/ml/tutorial/Step_6_KNN.java
examples/src/main/java/org/apache/ignite/examples/ml/tutorial/Step_7_Split_train_test.java
examples/src/main/java/org/apache/ignite/examples/ml/tutorial/Step_8_CV.java
examples/src/main/java/org/apache/ignite/examples/ml/tutorial/Step_9_Go_to_LogReg.java
modules/ml/src/main/java/org/apache/ignite/ml/Model.java
modules/ml/src/main/java/org/apache/ignite/ml/clustering/kmeans/KMeansModel.java
modules/ml/src/main/java/org/apache/ignite/ml/clustering/kmeans/KMeansModelFormat.java
modules/ml/src/main/java/org/apache/ignite/ml/clustering/kmeans/KMeansTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/composition/BaggingModelTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/composition/ModelOnFeaturesSubspace.java
modules/ml/src/main/java/org/apache/ignite/ml/composition/ModelsComposition.java
modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBBinaryClassifierTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBRegressionTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/LossGradientPerPredictionFunctions.java
modules/ml/src/main/java/org/apache/ignite/ml/composition/predictionsaggregator/WeightedPredictionsAggregator.java
modules/ml/src/main/java/org/apache/ignite/ml/dataset/DatasetFactory.java
modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/data/SimpleDatasetDataBuilder.java
modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/data/SimpleLabeledDatasetDataBuilder.java
modules/ml/src/main/java/org/apache/ignite/ml/genetic/CrossOverJob.java
modules/ml/src/main/java/org/apache/ignite/ml/genetic/CrossOverTask.java
modules/ml/src/main/java/org/apache/ignite/ml/genetic/FitnessJob.java
modules/ml/src/main/java/org/apache/ignite/ml/genetic/FitnessTask.java
modules/ml/src/main/java/org/apache/ignite/ml/genetic/GAGrid.java
modules/ml/src/main/java/org/apache/ignite/ml/genetic/Gene.java
modules/ml/src/main/java/org/apache/ignite/ml/genetic/MutateTask.java
modules/ml/src/main/java/org/apache/ignite/ml/genetic/TruncateSelectionJob.java
modules/ml/src/main/java/org/apache/ignite/ml/genetic/TruncateSelectionTask.java
modules/ml/src/main/java/org/apache/ignite/ml/genetic/functions/GAGridFunction.java
modules/ml/src/main/java/org/apache/ignite/ml/genetic/parameter/GAConfiguration.java
modules/ml/src/main/java/org/apache/ignite/ml/genetic/parameter/GAGridConstants.java
modules/ml/src/main/java/org/apache/ignite/ml/genetic/utils/GAGridUtils.java
modules/ml/src/main/java/org/apache/ignite/ml/knn/KNNUtils.java
modules/ml/src/main/java/org/apache/ignite/ml/knn/classification/KNNClassificationModel.java
modules/ml/src/main/java/org/apache/ignite/ml/knn/classification/KNNClassificationTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/knn/regression/KNNRegressionModel.java
modules/ml/src/main/java/org/apache/ignite/ml/knn/regression/KNNRegressionTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/math/Blas.java
modules/ml/src/main/java/org/apache/ignite/ml/math/KeyMapper.java [deleted file]
modules/ml/src/main/java/org/apache/ignite/ml/math/Tracer.java
modules/ml/src/main/java/org/apache/ignite/ml/math/distances/DistanceMeasure.java
modules/ml/src/main/java/org/apache/ignite/ml/math/distances/EuclideanDistance.java
modules/ml/src/main/java/org/apache/ignite/ml/math/distances/HammingDistance.java
modules/ml/src/main/java/org/apache/ignite/ml/math/distances/ManhattanDistance.java
modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/preprocessing/UnknownStringValue.java
modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteBiFunction.java
modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteDifferentiableDoubleToDoubleFunction.java
modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteDifferentiableVectorToDoubleFunction.java
modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteTriConsumer.java
modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteTriFunction.java
modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/DenseLocalOffHeapMatrix.java [deleted file]
modules/ml/src/main/java/org/apache/ignite/ml/math/impls/package-info.java [deleted file]
modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java [deleted file]
modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/MapWrapperStorage.java [deleted file]
modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/package-info.java [deleted file]
modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/DenseLocalOffHeapVectorStorage.java [deleted file]
modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOffHeapVectorStorage.java [deleted file]
modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/package-info.java [deleted file]
modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/DenseLocalOffHeapVector.java [deleted file]
modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/MapWrapperVector.java [deleted file]
modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/SparseLocalOffHeapVector.java [deleted file]
modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/package-info.java [deleted file]
modules/ml/src/main/java/org/apache/ignite/ml/math/package-info.java
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/matrix/AbstractMatrix.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java with 91% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/matrix/Matrix.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/Matrix.java with 92% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/matrix/MatrixStorage.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/MatrixStorage.java with 89% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/matrix/OrderedMatrix.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/OrderedMatrix.java with 94% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/matrix/impl/DenseMatrix.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/DenseLocalOnHeapMatrix.java with 65% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/matrix/impl/SparseMatrix.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseLocalOnHeapMatrix.java with 66% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/matrix/impl/ViewMatrix.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/MatrixView.java with 71% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/matrix/impl/package-info.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/package-info.java with 93% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/matrix/package-info.java [moved from examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/package-info.java with 90% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/matrix/storage/DenseMatrixStorage.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/ArrayMatrixStorage.java with 89% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/matrix/storage/SparseMatrixStorage.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/SparseLocalOnHeapMatrixStorage.java with 94% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/matrix/storage/ViewMatrixStorage.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixDelegateStorage.java with 93% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/matrix/storage/package-info.java [moved from examples/src/main/java/org/apache/ignite/examples/ml/math/vector/package-info.java with 89% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/package-info.java [moved from examples/src/main/java/org/apache/ignite/examples/ml/math/tracer/package-info.java with 90% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/AbstractVector.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/AbstractVector.java with 98% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/Vector.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/Vector.java with 98% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/VectorStorage.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/VectorStorage.java with 91% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/VectorUtils.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/VectorUtils.java with 86% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/impl/DelegatingVector.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/DelegatingVector.java with 97% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/impl/DenseVector.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/DenseLocalOnHeapVector.java with 73% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/impl/SparseVector.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/SparseLocalVector.java with 74% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/impl/VectorView.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/VectorView.java with 78% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/impl/VectorizedViewMatrix.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/MatrixVectorView.java with 82% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/impl/package-info.java [new file with mode: 0644]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/package-info.java [moved from examples/src/main/java/org/apache/ignite/examples/ml/math/package-info.java with 90% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/storage/DenseVectorStorage.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/ArrayVectorStorage.java with 89% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/storage/SparseVectorStorage.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOnHeapVectorStorage.java with 91% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/storage/VectorViewStorage.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/DelegateVectorStorage.java with 91% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/storage/VectorizedViewMatrixStorage.java [moved from modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/MatrixVectorStorage.java with 92% similarity]
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/storage/package-info.java [new file with mode: 0644]
modules/ml/src/main/java/org/apache/ignite/ml/math/statistics/Variance.java [deleted file]
modules/ml/src/main/java/org/apache/ignite/ml/math/statistics/package-info.java [deleted file]
modules/ml/src/main/java/org/apache/ignite/ml/math/util/MatrixUtil.java
modules/ml/src/main/java/org/apache/ignite/ml/nn/MLPLayer.java
modules/ml/src/main/java/org/apache/ignite/ml/nn/MLPState.java
modules/ml/src/main/java/org/apache/ignite/ml/nn/MLPTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/nn/MultilayerPerceptron.java
modules/ml/src/main/java/org/apache/ignite/ml/nn/ReplicatedVectorMatrix.java
modules/ml/src/main/java/org/apache/ignite/ml/nn/initializers/MLPInitializer.java
modules/ml/src/main/java/org/apache/ignite/ml/nn/initializers/RandomInitializer.java
modules/ml/src/main/java/org/apache/ignite/ml/optimization/BarzilaiBorweinUpdater.java
modules/ml/src/main/java/org/apache/ignite/ml/optimization/BaseParametrized.java
modules/ml/src/main/java/org/apache/ignite/ml/optimization/LossFunctions.java
modules/ml/src/main/java/org/apache/ignite/ml/optimization/SimpleUpdater.java
modules/ml/src/main/java/org/apache/ignite/ml/optimization/SmoothParametrized.java
modules/ml/src/main/java/org/apache/ignite/ml/optimization/Updater.java
modules/ml/src/main/java/org/apache/ignite/ml/optimization/updatecalculators/NesterovParameterUpdate.java
modules/ml/src/main/java/org/apache/ignite/ml/optimization/updatecalculators/NesterovUpdateCalculator.java
modules/ml/src/main/java/org/apache/ignite/ml/optimization/updatecalculators/ParameterUpdateCalculator.java
modules/ml/src/main/java/org/apache/ignite/ml/optimization/updatecalculators/RPropParameterUpdate.java
modules/ml/src/main/java/org/apache/ignite/ml/optimization/updatecalculators/RPropUpdateCalculator.java
modules/ml/src/main/java/org/apache/ignite/ml/optimization/updatecalculators/SimpleGDParameterUpdate.java
modules/ml/src/main/java/org/apache/ignite/ml/optimization/updatecalculators/SimpleGDUpdateCalculator.java
modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/binarization/BinarizationPreprocessor.java
modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/binarization/BinarizationTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/encoding/stringencoder/StringEncoderPreprocessor.java
modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/encoding/stringencoder/StringEncoderTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/imputing/ImputerPreprocessor.java
modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/imputing/ImputerTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/minmaxscaling/MinMaxScalerPreprocessor.java
modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/minmaxscaling/MinMaxScalerTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/normalization/NormalizationPreprocessor.java
modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/normalization/NormalizationTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/regressions/linear/FeatureExtractorWrapper.java
modules/ml/src/main/java/org/apache/ignite/ml/regressions/linear/LinearRegressionLSQRTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/regressions/linear/LinearRegressionModel.java
modules/ml/src/main/java/org/apache/ignite/ml/regressions/linear/LinearRegressionSGDTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/binomial/LogisticRegressionModel.java
modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/binomial/LogisticRegressionSGDTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/LogRegressionMultiClassModel.java
modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/LogRegressionMultiClassTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/selection/cv/CrossValidation.java
modules/ml/src/main/java/org/apache/ignite/ml/selection/scoring/cursor/CacheBasedLabelPairCursor.java
modules/ml/src/main/java/org/apache/ignite/ml/selection/scoring/cursor/LocalLabelPairCursor.java
modules/ml/src/main/java/org/apache/ignite/ml/selection/scoring/evaluator/Evaluator.java
modules/ml/src/main/java/org/apache/ignite/ml/structures/Dataset.java
modules/ml/src/main/java/org/apache/ignite/ml/structures/DatasetRow.java
modules/ml/src/main/java/org/apache/ignite/ml/structures/LabeledDataset.java
modules/ml/src/main/java/org/apache/ignite/ml/structures/LabeledVector.java
modules/ml/src/main/java/org/apache/ignite/ml/structures/LabeledVectorDouble.java
modules/ml/src/main/java/org/apache/ignite/ml/structures/partition/LabeledDatasetPartitionDataBuilderOnHeap.java
modules/ml/src/main/java/org/apache/ignite/ml/structures/preprocessing/LabeledDatasetLoader.java
modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearBinaryClassificationModel.java
modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearBinaryClassificationTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearMultiClassClassificationModel.java
modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearMultiClassClassificationTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/trainers/DatasetTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTree.java
modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTreeConditionalNode.java
modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTreeLeafNode.java
modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTreeNode.java
modules/ml/src/main/java/org/apache/ignite/ml/tree/TreeFilter.java
modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBBinaryClassifierOnTreesTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBRegressionOnTreesTrainer.java
modules/ml/src/main/java/org/apache/ignite/ml/tree/data/DecisionTreeDataBuilder.java
modules/ml/src/main/java/org/apache/ignite/ml/util/MnistUtils.java
modules/ml/src/test/java/org/apache/ignite/ml/LocalModelsTest.java
modules/ml/src/test/java/org/apache/ignite/ml/TestUtils.java
modules/ml/src/test/java/org/apache/ignite/ml/clustering/KMeansModelTest.java
modules/ml/src/test/java/org/apache/ignite/ml/clustering/KMeansTrainerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/composition/boosting/GDBTrainerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/composition/predictionsaggregator/MeanValuePredictionsAggregatorTest.java
modules/ml/src/test/java/org/apache/ignite/ml/composition/predictionsaggregator/OnMajorityPredictionsAggregatorTest.java
modules/ml/src/test/java/org/apache/ignite/ml/composition/predictionsaggregator/WeightedPredictionsAggregatorTest.java
modules/ml/src/test/java/org/apache/ignite/ml/genetic/GAGridCalculateFitnessTest.java
modules/ml/src/test/java/org/apache/ignite/ml/genetic/GAGridInitializePopulationTest.java
modules/ml/src/test/java/org/apache/ignite/ml/genetic/PasswordFitnessFunction.java
modules/ml/src/test/java/org/apache/ignite/ml/knn/KNNClassificationTest.java
modules/ml/src/test/java/org/apache/ignite/ml/knn/KNNRegressionTest.java
modules/ml/src/test/java/org/apache/ignite/ml/knn/LabeledDatasetTest.java
modules/ml/src/test/java/org/apache/ignite/ml/math/BlasTest.java
modules/ml/src/test/java/org/apache/ignite/ml/math/ExternalizableTest.java
modules/ml/src/test/java/org/apache/ignite/ml/math/ExternalizeTest.java
modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplLocalTestSuite.java
modules/ml/src/test/java/org/apache/ignite/ml/math/TracerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/math/VectorUtilsTest.java
modules/ml/src/test/java/org/apache/ignite/ml/math/benchmark/MathBenchmark.java [deleted file]
modules/ml/src/test/java/org/apache/ignite/ml/math/benchmark/MathBenchmarkSelfTest.java [deleted file]
modules/ml/src/test/java/org/apache/ignite/ml/math/benchmark/ResultsWriter.java [deleted file]
modules/ml/src/test/java/org/apache/ignite/ml/math/benchmark/VectorBenchmarkTest.java [deleted file]
modules/ml/src/test/java/org/apache/ignite/ml/math/benchmark/package-info.java [deleted file]
modules/ml/src/test/java/org/apache/ignite/ml/math/distances/DistanceTest.java
modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/DenseLocalOffHeapMatrixConstructorTest.java [deleted file]
modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/MatrixImplementationFixtures.java [deleted file]
modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/MatrixImplementationsTest.java [deleted file]
modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixOffHeapStorageTest.java [deleted file]
modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/vector/RandomAccessSparseVectorStorageTest.java [deleted file]
modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOffHeapVectorStorageTest.java [deleted file]
modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/vector/VectorOffheapStorageTest.java [deleted file]
modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/DenseLocalOffHeapVectorConstructorTest.java [deleted file]
modules/ml/src/test/java/org/apache/ignite/ml/math/isolve/lsqr/LSQROnHeapTest.java
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/MathTestConstants.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/MathTestConstants.java with 98% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/matrix/DenseMatrixConstructorTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/DenseLocalOnHeapMatrixConstructorTest.java with 68% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/matrix/MatrixArrayStorageTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixArrayStorageTest.java with 85% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/matrix/MatrixAttributeTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/MatrixAttributeTest.java with 88% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/matrix/MatrixBaseStorageTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixBaseStorageTest.java with 93% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/matrix/MatrixStorageFixtures.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixStorageFixtures.java with 94% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/matrix/MatrixStorageImplementationTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixStorageImplementationTest.java with 96% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/matrix/MatrixViewConstructorTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/MatrixViewConstructorTest.java with 74% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/matrix/SparseMatrixConstructorTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/SparseLocalOnHeapMatrixConstructorTest.java with 75% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/vector/AbstractVectorTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/AbstractVectorTest.java with 96% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/vector/DelegatingVectorConstructorTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/DelegatingVectorConstructorTest.java with 87% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/vector/DenseVectorConstructorTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/DenseLocalOnHeapVectorConstructorTest.java with 76% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/vector/MatrixVectorViewTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/MatrixVectorViewTest.java with 84% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/vector/SparseVectorConstructorTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/SparseLocalVectorConstructorTest.java with 77% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/vector/VectorArrayStorageTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/vector/VectorArrayStorageTest.java with 76% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/vector/VectorAttributesTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorAttributesTest.java with 76% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/vector/VectorBaseStorageTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/vector/VectorBaseStorageTest.java with 91% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/vector/VectorFoldMapTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorFoldMapTest.java with 98% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/vector/VectorImplementationsFixtures.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorImplementationsFixtures.java with 88% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/vector/VectorImplementationsTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorImplementationsTest.java with 95% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/vector/VectorNormTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorNormTest.java with 90% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/vector/VectorToMatrixTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorToMatrixTest.java with 89% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/math/primitives/vector/VectorViewTest.java [moved from modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorViewTest.java with 93% similarity]
modules/ml/src/test/java/org/apache/ignite/ml/nn/MLPConstInitializer.java
modules/ml/src/test/java/org/apache/ignite/ml/nn/MLPTest.java
modules/ml/src/test/java/org/apache/ignite/ml/nn/MLPTrainerIntegrationTest.java
modules/ml/src/test/java/org/apache/ignite/ml/nn/MLPTrainerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/nn/performance/MLPTrainerMnistIntegrationTest.java
modules/ml/src/test/java/org/apache/ignite/ml/nn/performance/MLPTrainerMnistTest.java
modules/ml/src/test/java/org/apache/ignite/ml/nn/performance/MnistMLPTestUtil.java
modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/binarization/BinarizationPreprocessorTest.java
modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/binarization/BinarizationTrainerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/imputing/ImputerPreprocessorTest.java
modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/imputing/ImputerTrainerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/minmaxscaling/MinMaxScalerPreprocessorTest.java
modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/minmaxscaling/MinMaxScalerTrainerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/normalization/NormalizationPreprocessorTest.java
modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/normalization/NormalizationTrainerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/regressions/linear/LinearRegressionLSQRTrainerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/regressions/linear/LinearRegressionModelTest.java
modules/ml/src/test/java/org/apache/ignite/ml/regressions/linear/LinearRegressionSGDTrainerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogRegMultiClassTrainerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionModelTest.java
modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionSGDTrainerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/selection/cv/CrossValidationTest.java
modules/ml/src/test/java/org/apache/ignite/ml/selection/scoring/cursor/CacheBasedLabelPairCursorTest.java
modules/ml/src/test/java/org/apache/ignite/ml/selection/scoring/cursor/LocalLabelPairCursorTest.java
modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMBinaryTrainerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMModelTest.java
modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMMultiClassTrainerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/tree/DecisionTreeClassificationTrainerIntegrationTest.java
modules/ml/src/test/java/org/apache/ignite/ml/tree/DecisionTreeClassificationTrainerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/tree/DecisionTreeRegressionTrainerIntegrationTest.java
modules/ml/src/test/java/org/apache/ignite/ml/tree/DecisionTreeRegressionTrainerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/tree/performance/DecisionTreeMNISTIntegrationTest.java
modules/ml/src/test/java/org/apache/ignite/ml/tree/performance/DecisionTreeMNISTTest.java
modules/ml/src/test/java/org/apache/ignite/ml/tree/randomforest/RandomForestClassifierTrainerTest.java
modules/ml/src/test/java/org/apache/ignite/ml/tree/randomforest/RandomForestRegressionTrainerTest.java

index 44d3a23..e1b9844 100644 (file)
@@ -31,8 +31,8 @@ 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.VectorUtils;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+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;
 
 /**
@@ -81,7 +81,7 @@ public class KMeansClusterizationExample {
                         double[] inputs = Arrays.copyOfRange(val, 1, val.length);
                         double groundTruth = val[0];
 
-                        double prediction = mdl.apply(new DenseLocalOnHeapVector(inputs));
+                        double prediction = mdl.apply(new DenseVector(inputs));
 
                         totalAmount++;
                         if (groundTruth != prediction)
index a3b6abc..1229fb1 100644 (file)
@@ -31,7 +31,7 @@ import org.apache.ignite.ml.dataset.DatasetFactory;
 import org.apache.ignite.ml.dataset.primitive.DatasetWrapper;
 import org.apache.ignite.ml.dataset.primitive.builder.data.SimpleLabeledDatasetDataBuilder;
 import org.apache.ignite.ml.dataset.primitive.data.SimpleLabeledDatasetData;
-import org.apache.ignite.ml.math.VectorUtils;
+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
index 47b0c0c..b5a7059 100644 (file)
@@ -26,7 +26,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ml.dataset.model.Person;
 import org.apache.ignite.ml.dataset.DatasetFactory;
 import org.apache.ignite.ml.dataset.primitive.SimpleDataset;
-import org.apache.ignite.ml.math.VectorUtils;
+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}
index af1ae67..e3af738 100644 (file)
@@ -25,7 +25,7 @@ import org.apache.ignite.Ignition;
 import org.apache.ignite.examples.ml.dataset.model.Person;
 import org.apache.ignite.ml.dataset.DatasetFactory;
 import org.apache.ignite.ml.dataset.primitive.SimpleDataset;
-import org.apache.ignite.ml.math.VectorUtils;
+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}
index a7c248a..88d7037 100644 (file)
@@ -76,10 +76,10 @@ public class OptimizeMakeChangeFitnessFunction implements IFitnessFunction {
         Gene nickelGene = (Gene)genes.get(2);
         Gene pennyGene = (Gene)genes.get(3);
 
-        int numQuarters = ((Coin)quarterGene.getValue()).getNumberOfCoins();
-        int numDimes = ((Coin)dimeGene.getValue()).getNumberOfCoins();
-        int numNickels = ((Coin)nickelGene.getValue()).getNumberOfCoins();
-        int numPennies = ((Coin)pennyGene.getValue()).getNumberOfCoins();
+        int numQuarters = ((Coin)quarterGene.getVal()).getNumberOfCoins();
+        int numDimes = ((Coin)dimeGene.getVal()).getNumberOfCoins();
+        int numNickels = ((Coin)nickelGene.getVal()).getNumberOfCoins();
+        int numPennies = ((Coin)pennyGene.getVal()).getNumberOfCoins();
 
         return (numQuarters * 25) + (numDimes * 10) + (numNickels * 5) + numPennies;
     }
@@ -95,7 +95,7 @@ public class OptimizeMakeChangeFitnessFunction implements IFitnessFunction {
         int totalNumberOfCoins = 0;
 
         for (Gene gene : genes) {
-            int numberOfCoins = ((Coin)gene.getValue()).getNumberOfCoins();
+            int numberOfCoins = ((Coin)gene.getVal()).getNumberOfCoins();
             totalNumberOfCoins = totalNumberOfCoins + numberOfCoins;
 
         }
index 6b832de..829fc4e 100644 (file)
@@ -105,11 +105,11 @@ public class OptimizeMakeChangeGAExample {
             List<Gene> genes = getGenePool();
 
             // set selection method
-            gaConfig.setSelectionMethod(GAGridConstants.SELECTION_METHOD.SELECTON_METHOD_ELETISM);
-            gaConfig.setElitismCount(10);
+            gaConfig.setSelectionMtd(GAGridConstants.SELECTION_METHOD.SELECTON_METHOD_ELETISM);
+            gaConfig.setElitismCnt(10);
 
             // set the Chromosome Length to '4' since we have 4 coins.
-            gaConfig.setChromosomeLength(4);
+            gaConfig.setChromosomeLen(4);
 
             // set population size
             gaConfig.setPopulationSize(500);
index ab3f462..bb4a369 100644 (file)
@@ -76,8 +76,8 @@ public class OptimizeMakeChangeTerminateCriteria implements ITerminateCriteria {
      */
     private void printCoins(List<Gene> genes) {
         for (Gene gene : genes) {
-            igniteLogger.info("Coin Type: " + ((Coin)gene.getValue()).getCoinType().toString());
-            igniteLogger.info("Number of Coins: " + ((Coin)gene.getValue()).getNumberOfCoins());
+            igniteLogger.info("Coin Type: " + ((Coin)gene.getVal()).getCoinType().toString());
+            igniteLogger.info("Number of Coins: " + ((Coin)gene.getVal()).getNumberOfCoins());
         }
 
     }
index 85c00e9..190bd2b 100644 (file)
@@ -54,7 +54,7 @@ public class HelloWorldFitnessFunction implements IFitnessFunction {
         double matches = 0;
 
         for (int i = 0; i < genes.size(); i++) {
-            if (((Character)(genes.get(i).getValue())).equals(targetString.charAt(i))) {
+            if (((Character)(genes.get(i).getVal())).equals(targetString.charAt(i))) {
                 matches = matches + 1;
             }
         }
index 78374d2..9e0eb7a 100644 (file)
@@ -73,7 +73,7 @@ public class HelloWorldGAExample {
             List<Gene> genes = getGenePool();
 
             // set the Chromosome Length to '11' since 'HELLO WORLD' contains 11 characters.
-            gaConfig.setChromosomeLength(11);
+            gaConfig.setChromosomeLen(11);
 
             // initialize gene pool
             gaConfig.setGenePool(genes);
index 24bb5e0..e7ec131 100644 (file)
@@ -81,7 +81,7 @@ public class HelloWorldTerminateCriteria implements ITerminateCriteria {
         StringBuffer sbPhrase = new StringBuffer();
 
         for (Gene gene : genes) {
-            sbPhrase.append(((Character)gene.getValue()).toString());
+            sbPhrase.append(((Character)gene.getVal()).toString());
         }
         igniteLogger.info(sbPhrase.toString());
     }
index 5ccaa8b..bf24edf 100644 (file)
@@ -53,8 +53,8 @@ public class KnapsackFitnessFunction implements IFitnessFunction {
         int badSolution = 1;
 
         for (Gene agene : genes) {
-            weight = weight + ((Item)(agene.getValue())).getWeight();
-            value = value + ((Item)(agene.getValue())).getValue();
+            weight = weight + ((Item)(agene.getVal())).getWeight();
+            value = value + ((Item)(agene.getVal())).getValue();
 
             if (dups.contains(agene.id()) || (weight > maximumWeight)) {
                 badSolution = 0;
index 0029a9e..21b9c01 100644 (file)
@@ -68,7 +68,7 @@ public class KnapsackGAExample {
             List<Gene> genes = getGenePool();
 
             // set the Chromosome Length to '10' since our knapsack may contain a total of 10 items.
-            gaConfig.setChromosomeLength(10);
+            gaConfig.setChromosomeLen(10);
 
             // initialize gene pool
             gaConfig.setGenePool(genes);
index a10a6fc..76af2bb 100644 (file)
@@ -79,7 +79,7 @@ public class KnapsackTerminateCriteria implements ITerminateCriteria {
     private double calculateTotalWeight(List<Gene> genes) {
         double totalWeight = 0;
         for (Gene gene : genes)
-            totalWeight = totalWeight + ((Item)gene.getValue()).getWeight();
+            totalWeight = totalWeight + ((Item)gene.getVal()).getWeight();
 
         return totalWeight;
     }
@@ -92,9 +92,9 @@ public class KnapsackTerminateCriteria implements ITerminateCriteria {
     private void printItems(List<Gene> genes) {
         for (Gene gene : genes) {
             igniteLogger.info("------------------------------------------------------------------------------------------");
-            igniteLogger.info("Name: " + ((Item)gene.getValue()).getName().toString());
-            igniteLogger.info("Weight: " + ((Item)gene.getValue()).getWeight());
-            igniteLogger.info("Value: " + ((Item)gene.getValue()).getValue());
+            igniteLogger.info("Name: " + ((Item)gene.getVal()).getName().toString());
+            igniteLogger.info("Weight: " + ((Item)gene.getVal()).getWeight());
+            igniteLogger.info("Value: " + ((Item)gene.getVal()).getValue());
         }
     }
 }
index 20e04ce..b5f52f7 100644 (file)
 package org.apache.ignite.examples.ml.genetic.movie;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
-import org.apache.ignite.ml.genetic.Chromosome;
 import org.apache.ignite.ml.genetic.Gene;
 import org.apache.ignite.ml.genetic.IFitnessFunction;
 
@@ -69,7 +67,7 @@ public class MovieFitnessFunction implements IFitnessFunction {
         int badSolution = 1;
 
         for (int i = 0; i < genes.size(); i++) {
-            Movie movie = (Movie)genes.get(i).getValue();
+            Movie movie = (Movie)genes.get(i).getVal();
             if (dups.contains(movie.getName())) {
                 badSolution = 0;
             }
index e601081..c52238b 100644 (file)
@@ -96,13 +96,13 @@ public class MovieGAExample {
         List<Gene> genes = getGenePool();
 
         // Define Chromosome
-        gaConfig.setChromosomeLength(3);
+        gaConfig.setChromosomeLen(3);
         gaConfig.setPopulationSize(100);
         gaConfig.setGenePool(genes);
         gaConfig.setTruncateRate(.10);
         gaConfig.setCrossOverRate(.50);
         gaConfig.setMutationRate(.50);
-        gaConfig.setSelectionMethod(GAGridConstants.SELECTION_METHOD.SELECTION_METHOD_TRUNCATION);
+        gaConfig.setSelectionMtd(GAGridConstants.SELECTION_METHOD.SELECTION_METHOD_TRUNCATION);
 
         //Create fitness function
         MovieFitnessFunction function = new MovieFitnessFunction(genres);
index 34a7331..ac56cca 100644 (file)
@@ -78,9 +78,9 @@ public class MovieTerminateCriteria implements ITerminateCriteria {
      */
     private void printMovies(List<Gene> genes) {
         for (Gene gene : genes) {
-            igniteLogger.info("Name: " + ((Movie)gene.getValue()).getName().toString());
-            igniteLogger.info("Genres: " + ((Movie)gene.getValue()).getGenre().toString());
-            igniteLogger.info("IMDB Rating: " + ((Movie)gene.getValue()).getImdbRating());
+            igniteLogger.info("Name: " + ((Movie)gene.getVal()).getName().toString());
+            igniteLogger.info("Genres: " + ((Movie)gene.getVal()).getGenre().toString());
+            igniteLogger.info("IMDB Rating: " + ((Movie)gene.getVal()).getImdbRating());
         }
 
     }
index 2e13cd2..85e2bec 100644 (file)
@@ -30,9 +30,9 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.ml.knn.classification.KNNClassificationModel;
 import org.apache.ignite.ml.knn.classification.KNNClassificationTrainer;
 import org.apache.ignite.ml.knn.classification.KNNStrategy;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.math.distances.EuclideanDistance;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
 import org.apache.ignite.thread.IgniteThread;
 
 /**
@@ -77,7 +77,7 @@ public class KNNClassificationExample {
                         double[] inputs = Arrays.copyOfRange(val, 1, val.length);
                         double groundTruth = val[0];
 
-                        double prediction = knnMdl.apply(new DenseLocalOnHeapVector(inputs));
+                        double prediction = knnMdl.apply(new DenseVector(inputs));
 
                         totalAmount++;
                         if (groundTruth != prediction)
index 566146a..597efe4 100644 (file)
@@ -31,9 +31,9 @@ import org.apache.ignite.ml.knn.classification.KNNClassificationTrainer;
 import org.apache.ignite.ml.knn.classification.KNNStrategy;
 import org.apache.ignite.ml.knn.regression.KNNRegressionModel;
 import org.apache.ignite.ml.knn.regression.KNNRegressionTrainer;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.math.distances.ManhattanDistance;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
 import org.apache.ignite.thread.IgniteThread;
 
 /**
@@ -77,7 +77,7 @@ public class KNNRegressionExample {
                         double[] inputs = Arrays.copyOfRange(val, 1, val.length);
                         double groundTruth = val[0];
 
-                        double prediction = knnMdl.apply(new DenseLocalOnHeapVector(inputs));
+                        double prediction = knnMdl.apply(new DenseVector(inputs));
 
                         mse += Math.pow(prediction - groundTruth, 2.0);
                         mae += Math.abs(prediction - groundTruth);
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/ExampleMatrixStorage.java b/examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/ExampleMatrixStorage.java
deleted file mode 100644 (file)
index 542fbdc..0000000
+++ /dev/null
@@ -1,175 +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.math.matrix;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.Arrays;
-import org.apache.ignite.ml.math.MatrixStorage;
-import org.apache.ignite.ml.math.StorageConstants;
-import org.apache.ignite.ml.math.impls.storage.matrix.ArrayMatrixStorage;
-import org.apache.ignite.ml.math.util.MatrixUtil;
-
-/**
- * Example matrix storage implementation, modeled after {@link ArrayMatrixStorage}.
- */
-class ExampleMatrixStorage implements MatrixStorage {
-    /** Backing data array. */
-    private double[][] data;
-    /** Amount of rows in a matrix storage. */
-    private int rows;
-    /** Amount of columns in a matrix storage. */
-    private int cols;
-
-    /**
-     *
-     */
-    public ExampleMatrixStorage() {
-        // No-op.
-    }
-
-    /**
-     * @param rows Amount of rows in a matrix storage.
-     * @param cols Amount of columns in a matrix storage.
-     */
-    ExampleMatrixStorage(int rows, int cols) {
-        assert rows > 0;
-        assert cols > 0;
-
-        this.data = new double[rows][cols];
-        this.rows = rows;
-        this.cols = cols;
-    }
-
-    /**
-     * @param data Backing data array.
-     */
-    ExampleMatrixStorage(double[][] data) {
-        assert data != null;
-        assert data[0] != null;
-
-        this.data = data;
-        this.rows = data.length;
-        this.cols = data[0].length;
-
-        assert rows > 0;
-        assert cols > 0;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double get(int x, int y) {
-        return data[x][y];
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isSequentialAccess() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isDense() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isRandomAccess() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isDistributed() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void set(int x, int y, double v) {
-        data[x][y] = v;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int columnSize() {
-        return cols;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int rowSize() {
-        return rows;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int storageMode() {
-        // This value indicate that we store matrix data by rows.
-        return StorageConstants.ROW_STORAGE_MODE;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int accessMode() {
-        return StorageConstants.RANDOM_ACCESS_MODE;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isArrayBased() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double[] data() {
-        return MatrixUtil.flatten(data, StorageConstants.ROW_STORAGE_MODE);
-    }
-
-    /** {@inheritDoc */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeInt(rows);
-        out.writeInt(cols);
-
-        out.writeObject(data);
-    }
-
-    /** {@inheritDoc */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        rows = in.readInt();
-        cols = in.readInt();
-
-        data = (double[][])in.readObject();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = 1;
-
-        res += res * 37 + rows;
-        res += res * 37 + cols;
-        res += res * 37 + Arrays.deepHashCode(data);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object o) {
-        if (this == o)
-            return true;
-
-        if (o == null || getClass() != o.getClass())
-            return false;
-
-        ExampleMatrixStorage that = (ExampleMatrixStorage)o;
-
-        return Arrays.deepEquals(data, that.data);
-    }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/MatrixCustomStorageExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/MatrixCustomStorageExample.java
deleted file mode 100644 (file)
index 95bf5cc..0000000
+++ /dev/null
@@ -1,127 +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.math.matrix;
-
-import org.apache.ignite.ml.math.Matrix;
-import org.apache.ignite.ml.math.MatrixStorage;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.impls.matrix.AbstractMatrix;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
-
-/**
- * This example shows how to create custom {@link Matrix} based on custom {@link MatrixStorage}.
- */
-public final class MatrixCustomStorageExample {
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     */
-    public static void main(String[] args) {
-        System.out.println();
-        System.out.println(">>> Matrix API usage example started.");
-
-        System.out.println("\n>>> Creating a matrix to be transposed.");
-        double[][] data = new double[][] {{1, 2, 3}, {4, 5, 6}};
-        Matrix m = new MatrixCustomStorage(data);
-        Matrix transposed = m.transpose();
-
-        System.out.println(">>> Matrix: ");
-        MatrixExampleUtil.print(m);
-        System.out.println(">>> Transposed matrix: ");
-        MatrixExampleUtil.print(transposed);
-
-        MatrixExampleUtil.verifyTransposition(m, transposed);
-
-        System.out.println("\n>>> Creating matrices to be multiplied.");
-        double[][] data1 = new double[][] {{1, 2}, {3, 4}};
-        double[][] data2 = new double[][] {{5, 6}, {7, 8}};
-
-        Matrix m1 = new MatrixCustomStorage(data1);
-        Matrix m2 = new MatrixCustomStorage(data2);
-        Matrix mult = m1.times(m2);
-
-        System.out.println(">>> First matrix: ");
-        MatrixExampleUtil.print(m1);
-        System.out.println(">>> Second matrix: ");
-        MatrixExampleUtil.print(m2);
-        System.out.println(">>> Matrix product: ");
-        MatrixExampleUtil.print(mult);
-
-        System.out.println("\n>>> Matrix API usage example completed.");
-    }
-
-    /**
-     * Example of vector with custom storage, modeled after
-     * {@link org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix}.
-     */
-    static class MatrixCustomStorage extends AbstractMatrix {
-        /**
-         *
-         */
-        public MatrixCustomStorage() {
-            // No-op.
-        }
-
-        /**
-         * @param rows Amount of rows in a matrix.
-         * @param cols Amount of columns in a matrix.
-         */
-        MatrixCustomStorage(int rows, int cols) {
-            assert rows > 0;
-            assert cols > 0;
-
-            setStorage(new ExampleMatrixStorage(rows, cols));
-        }
-
-        /**
-         * @param mtx Source matrix.
-         */
-        MatrixCustomStorage(double[][] mtx) {
-            assert mtx != null;
-
-            setStorage(new ExampleMatrixStorage(mtx));
-        }
-
-        /**
-         * @param orig original matrix to be copied.
-         */
-        private MatrixCustomStorage(MatrixCustomStorage orig) {
-            assert orig != null;
-
-            setStorage(new ExampleMatrixStorage(orig.rowSize(), orig.columnSize()));
-
-            assign(orig);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Matrix copy() {
-            return new MatrixCustomStorage(this);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Matrix like(int rows, int cols) {
-            return new MatrixCustomStorage(rows, cols);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Vector likeVector(int crd) {
-            return new DenseLocalOnHeapVector(crd);
-        }
-    }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/MatrixExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/MatrixExample.java
deleted file mode 100644 (file)
index 3e5e6ff..0000000
+++ /dev/null
@@ -1,65 +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.math.matrix;
-
-import org.apache.ignite.ml.math.Matrix;
-import org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix;
-
-/**
- * This example shows how to use {@link Matrix} API.
- */
-public final class MatrixExample {
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     */
-    public static void main(String[] args) {
-        System.out.println();
-        System.out.println(">>> Basic Matrix API usage example started.");
-
-        System.out.println("\n>>> Creating a matrix to be transposed.");
-        double[][] data = new double[][] {{1, 2, 3}, {4, 5, 6}};
-        Matrix m = new DenseLocalOnHeapMatrix(data);
-        Matrix transposed = m.transpose();
-
-        System.out.println(">>> Matrix: ");
-        MatrixExampleUtil.print(m);
-        System.out.println(">>> Transposed matrix: ");
-        MatrixExampleUtil.print(transposed);
-
-        MatrixExampleUtil.verifyTransposition(m, transposed);
-
-        System.out.println("\n>>> Creating matrices to be multiplied.");
-        double[][] data1 = new double[][] {{1, 2}, {3, 4}};
-        double[][] data2 = new double[][] {{5, 6}, {7, 8}};
-
-        Matrix m1 = new DenseLocalOnHeapMatrix(data1);
-        Matrix m2 = new DenseLocalOnHeapMatrix(data2);
-        Matrix mult = m1.times(m2);
-
-        System.out.println(">>> First matrix: ");
-        MatrixExampleUtil.print(m1);
-        System.out.println(">>> Second matrix: ");
-        MatrixExampleUtil.print(m2);
-        System.out.println(">>> Matrix product: ");
-        MatrixExampleUtil.print(mult);
-
-        System.out.println("\n>>> Basic Matrix API usage example completed.");
-    }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/MatrixExampleUtil.java b/examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/MatrixExampleUtil.java
deleted file mode 100644 (file)
index af12e15..0000000
+++ /dev/null
@@ -1,52 +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.math.matrix;
-
-import org.apache.ignite.ml.math.Matrix;
-import org.apache.ignite.ml.math.Tracer;
-
-/**
- * Utility functions for {@link Matrix} API examples.
- */
-class MatrixExampleUtil {
-    /**
-     * Verifies matrix transposition.
-     *
-     * @param m Original matrix.
-     * @param transposed Transposed matrix.
-     */
-    static void verifyTransposition(Matrix m, Matrix transposed) {
-        for (int row = 0; row < m.rowSize(); row++)
-            for (int col = 0; col < m.columnSize(); col++) {
-                double val = m.get(row, col);
-                double valTransposed = transposed.get(col, row);
-
-                assert val == valTransposed : "Values not equal at (" + row + "," + col
-                    + "), original: " + val + " transposed: " + valTransposed;
-            }
-    }
-
-    /**
-     * Prints matrix values to console.
-     *
-     * @param m Matrix to print.
-     */
-    static void print(Matrix m) {
-        Tracer.showAscii(m);
-    }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/OffHeapMatrixExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/OffHeapMatrixExample.java
deleted file mode 100644 (file)
index 8ad1d1d..0000000
+++ /dev/null
@@ -1,70 +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.math.matrix;
-
-import org.apache.ignite.ml.math.Matrix;
-import org.apache.ignite.ml.math.impls.matrix.DenseLocalOffHeapMatrix;
-
-/**
- * This example shows how to create and use off-heap versions of {@link Matrix}.
- */
-public final class OffHeapMatrixExample {
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     */
-    public static void main(String[] args) {
-        System.out.println();
-        System.out.println(">>> Off-heap matrix API usage example started.");
-
-        System.out.println("\n>>> Creating a matrix to be transposed.");
-        double[][] data = new double[][] {{1, 2, 3}, {4, 5, 6}};
-        Matrix m = new DenseLocalOffHeapMatrix(data.length, data[0].length);
-        m.assign(data);
-        Matrix transposed = m.transpose();
-
-        System.out.println(">>> Matrix: ");
-        MatrixExampleUtil.print(m);
-        System.out.println(">>> Transposed matrix: ");
-        MatrixExampleUtil.print(transposed);
-
-        MatrixExampleUtil.verifyTransposition(m, transposed);
-
-        System.out.println("\n>>> Creating matrices to be multiplied.");
-        double[][] data1 = new double[][] {{1, 2}, {3, 4}};
-        double[][] data2 = new double[][] {{5, 6}, {7, 8}};
-
-        Matrix m1 = new DenseLocalOffHeapMatrix(data1.length, data1[0].length);
-        Matrix m2 = new DenseLocalOffHeapMatrix(data2.length, data2[0].length);
-
-        m1.assign(data1);
-        m2.assign(data2);
-
-        Matrix mult = m1.times(m2);
-
-        System.out.println(">>> First matrix: ");
-        MatrixExampleUtil.print(m1);
-        System.out.println(">>> Second matrix: ");
-        MatrixExampleUtil.print(m2);
-        System.out.println(">>> Matrix product: ");
-        MatrixExampleUtil.print(mult);
-
-        System.out.println("\n>>> Off-heap matrix API usage example completed.");
-    }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/SparseMatrixExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/math/matrix/SparseMatrixExample.java
deleted file mode 100644 (file)
index 2596298..0000000
+++ /dev/null
@@ -1,69 +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.math.matrix;
-
-import org.apache.ignite.ml.math.Matrix;
-import org.apache.ignite.ml.math.impls.matrix.SparseLocalOnHeapMatrix;
-
-/**
- * This example shows how to use sparse {@link Matrix} API.
- */
-public final class SparseMatrixExample {
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     */
-    public static void main(String[] args) {
-        System.out.println();
-        System.out.println(">>> Sparse matrix API usage example started.");
-
-        System.out.println("\n>>> Creating a matrix to be transposed.");
-        double[][] data = new double[][] {{1, 2, 3}, {4, 5, 6}};
-        Matrix m = new SparseLocalOnHeapMatrix(data.length, data[0].length);
-        m.assign(data);
-        Matrix transposed = m.transpose();
-
-        System.out.println(">>> Matrix: ");
-        MatrixExampleUtil.print(m);
-        System.out.println(">>> Transposed matrix: ");
-        MatrixExampleUtil.print(transposed);
-
-        MatrixExampleUtil.verifyTransposition(m, transposed);
-
-        System.out.println("\n>>> Creating matrices to be multiplied.");
-        double[][] data1 = new double[][] {{1, 2}, {3, 4}};
-        double[][] data2 = new double[][] {{5, 6}, {7, 8}};
-
-        Matrix m1 = new SparseLocalOnHeapMatrix(data1.length, data1[0].length);
-        Matrix m2 = new SparseLocalOnHeapMatrix(data2.length, data2[0].length);
-
-        m1.assign(data1);
-        m2.assign(data2);
-
-        Matrix mult = m1.times(m2);
-
-        System.out.println(">>> First matrix: ");
-        MatrixExampleUtil.print(m1);
-        System.out.println(">>> Second matrix: ");
-        MatrixExampleUtil.print(m2);
-        System.out.println(">>> Matrix product: ");
-        MatrixExampleUtil.print(mult);
-        System.out.println("\n>>> Sparse matrix API usage example completed.");
-    }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/math/tracer/TracerExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/math/tracer/TracerExample.java
deleted file mode 100644 (file)
index c14335a..0000000
+++ /dev/null
@@ -1,63 +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.math.tracer;
-
-import java.awt.Color;
-import java.io.IOException;
-import org.apache.ignite.ml.math.Tracer;
-import org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix;
-
-/**
- * Example of using {@link Tracer} utility API.
- */
-public class TracerExample {
-    /**
-     * Double to color mapper example.
-     */
-    private static final Tracer.ColorMapper COLOR_MAPPER = d -> {
-        if (d <= 1.5)
-            return Color.RED;
-        else if (d <= 2.5)
-            return Color.GREEN;
-        else
-            return Color.BLUE;
-    };
-
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     */
-    public static void main(String[] args) throws IOException {
-        System.out.println(">>> Tracer utility example started.");
-
-        // Tracer is a simple utility class that allows pretty-printing of matrices/vectors.
-        DenseLocalOnHeapMatrix m = new DenseLocalOnHeapMatrix(new double[][] {
-            {1.12345, 2.12345},
-            {3.12345, 4.12345}
-        });
-
-        System.out.println("\n>>> Tracer output to console in ASCII.");
-        Tracer.showAscii(m, "%.3g");
-
-        System.out.println("\n>>> Tracer output to browser in HTML.");
-        Tracer.showHtml(m, COLOR_MAPPER, true);
-
-        System.out.println("\n>>> Tracer utility example completed.");
-    }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/math/vector/ExampleVectorStorage.java b/examples/src/main/java/org/apache/ignite/examples/ml/math/vector/ExampleVectorStorage.java
deleted file mode 100644 (file)
index 0289a8c..0000000
+++ /dev/null
@@ -1,127 +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.math.vector;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.Arrays;
-
-import org.apache.ignite.ml.math.VectorStorage;
-import org.apache.ignite.ml.math.impls.storage.vector.ArrayVectorStorage;
-
-/**
- * Example vector storage, modeled after {@link ArrayVectorStorage}.
- */
-class ExampleVectorStorage implements VectorStorage {
-    /** */
-    private double[] data;
-
-    /**
-     * IMPL NOTE required by Externalizable.
-     */
-    public ExampleVectorStorage() {
-        // No-op.
-    }
-
-    /**
-     * @param data Backing data array.
-     */
-    ExampleVectorStorage(double[] data) {
-        assert data != null;
-
-        this.data = data;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int size() {
-        return data == null ? 0 : data.length;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double get(int i) {
-        return data[i];
-    }
-
-    /** {@inheritDoc} */
-    @Override public void set(int i, double v) {
-        data[i] = v;
-    }
-
-    /** {@inheritDoc}} */
-    @Override public boolean isArrayBased() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double[] data() {
-        return data;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isSequentialAccess() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isDense() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isRandomAccess() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isDistributed() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(data);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        data = (double[])in.readObject();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = 1;
-
-        res = res * 37 + Arrays.hashCode(data);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object obj) {
-        if (this == obj)
-            return true;
-
-        if (obj == null || getClass() != obj.getClass())
-            return false;
-
-        ExampleVectorStorage that = (ExampleVectorStorage)obj;
-
-        return Arrays.equals(data, (that.data));
-    }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/math/vector/OffHeapVectorExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/math/vector/OffHeapVectorExample.java
deleted file mode 100644 (file)
index e38f62c..0000000
+++ /dev/null
@@ -1,78 +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.math.vector;
-
-import java.util.Arrays;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOffHeapVector;
-
-/**
- * This example shows how to create and use off-heap versions of {@link Vector}.
- */
-public final class OffHeapVectorExample {
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     */
-    public static void main(String[] args) {
-        System.out.println();
-        System.out.println(">>> Off-heap vector API usage example started.");
-
-        System.out.println("\n>>> Creating perpendicular off-heap vectors.");
-        double[] data1 = new double[] {1, 0, 3, 0, 5, 0};
-        double[] data2 = new double[] {0, 2, 0, 4, 0, 6};
-
-        Vector v1 = new DenseLocalOffHeapVector(data1.length);
-        Vector v2 = new DenseLocalOffHeapVector(data2.length);
-
-        v1.assign(data1);
-        v2.assign(data2);
-
-        System.out.println(">>> First vector: " + Arrays.toString(data1));
-        System.out.println(">>> Second vector: " + Arrays.toString(data2));
-
-        double dotProduct = v1.dot(v2);
-        boolean dotProductIsAsExp = dotProduct == 0;
-
-        System.out.println("\n>>> Dot product of vectors: [" + dotProduct
-            + "], it is 0 as expected: [" + dotProductIsAsExp + "].");
-
-        assert dotProductIsAsExp : "Expect dot product of perpendicular vectors to be 0.";
-
-        Vector hypotenuse = v1.plus(v2);
-
-        System.out.println("\n>>> Hypotenuse (sum of vectors): " + Arrays.toString(hypotenuse.getStorage().data()));
-
-        double lenSquared1 = v1.getLengthSquared();
-        double lenSquared2 = v2.getLengthSquared();
-        double lenSquaredHypotenuse = hypotenuse.getLengthSquared();
-
-        boolean lenSquaredHypotenuseIsAsExp = lenSquaredHypotenuse == lenSquared1 + lenSquared2;
-
-        System.out.println(">>> Squared length of first vector: [" + lenSquared1 + "].");
-        System.out.println(">>> Squared length of second vector: [" + lenSquared2 + "].");
-        System.out.println(">>> Squared length of hypotenuse: [" + lenSquaredHypotenuse
-            + "], equals sum of squared lengths of two original vectors as expected: ["
-            + lenSquaredHypotenuseIsAsExp + "].");
-
-        assert lenSquaredHypotenuseIsAsExp : "Expect squared length of hypotenuse to be as per Pythagorean theorem.";
-
-        System.out.println("\n>>> Off-heap vector API usage example completed.");
-    }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/math/vector/SparseVectorExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/math/vector/SparseVectorExample.java
deleted file mode 100644 (file)
index be3ade1..0000000
+++ /dev/null
@@ -1,76 +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.math.vector;
-
-import java.util.Arrays;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.impls.vector.SparseLocalVector;
-
-import static org.apache.ignite.ml.math.StorageConstants.RANDOM_ACCESS_MODE;
-
-/**
- * This example shows how to use sparse {@link Vector} API.
- */
-public final class SparseVectorExample {
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     */
-    public static void main(String[] args) {
-        System.out.println();
-        System.out.println(">>> Sparse vector API usage example started.");
-
-        System.out.println("\n>>> Creating perpendicular sparse vectors.");
-        double[] data1 = new double[] {1, 0, 3, 0, 5, 0};
-        double[] data2 = new double[] {0, 2, 0, 4, 0, 6};
-
-        Vector v1 = new SparseLocalVector(data1.length, RANDOM_ACCESS_MODE);
-        Vector v2 = new SparseLocalVector(data2.length, RANDOM_ACCESS_MODE);
-
-        v1.assign(data1);
-        v2.assign(data2);
-
-        System.out.println(">>> First vector: " + Arrays.toString(data1));
-        System.out.println(">>> Second vector: " + Arrays.toString(data2));
-
-        double dotProduct = v1.dot(v2);
-        boolean dotProductIsAsExp = dotProduct == 0;
-
-        System.out.println("\n>>> Dot product of vectors: [" + dotProduct
-            + "], it is 0 as expected: [" + dotProductIsAsExp + "].");
-
-        Vector hypotenuse = v1.plus(v2);
-
-        System.out.println("\n>>> Hypotenuse (sum of vectors): " + Arrays.toString(hypotenuse.getStorage().data()));
-
-        double lenSquared1 = v1.getLengthSquared();
-        double lenSquared2 = v2.getLengthSquared();
-        double lenSquaredHypotenuse = hypotenuse.getLengthSquared();
-
-        boolean lenSquaredHypotenuseIsAsExp = lenSquaredHypotenuse == lenSquared1 + lenSquared2;
-
-        System.out.println(">>> Squared length of first vector: [" + lenSquared1 + "].");
-        System.out.println(">>> Squared length of second vector: [" + lenSquared2 + "].");
-        System.out.println(">>> Squared length of hypotenuse: [" + lenSquaredHypotenuse
-            + "], equals sum of squared lengths of two original vectors as expected: ["
-            + lenSquaredHypotenuseIsAsExp + "].");
-
-        System.out.println("\n>>> Sparse vector API usage example completed.");
-    }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/math/vector/VectorCustomStorageExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/math/vector/VectorCustomStorageExample.java
deleted file mode 100644 (file)
index cbb69d0..0000000
+++ /dev/null
@@ -1,120 +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.math.vector;
-
-import java.util.Arrays;
-import org.apache.ignite.ml.math.Matrix;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorStorage;
-import org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix;
-import org.apache.ignite.ml.math.impls.vector.AbstractVector;
-
-/**
- * This example shows how to use {@link Vector} based on custom {@link VectorStorage}.
- */
-public final class VectorCustomStorageExample {
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     */
-    public static void main(String[] args) {
-        System.out.println();
-        System.out.println(">>> Vector custom storage API usage example started.");
-
-        System.out.println("\n>>> Creating perpendicular vectors.");
-        double[] data1 = new double[] {1, 0, 3, 0, 5, 0};
-        double[] data2 = new double[] {0, 2, 0, 4, 0, 6};
-
-        Vector v1 = new VectorCustomStorage(data1);
-        Vector v2 = new VectorCustomStorage(data2);
-
-        System.out.println(">>> First vector: " + Arrays.toString(data1));
-        System.out.println(">>> Second vector: " + Arrays.toString(data2));
-
-        double dotProduct = v1.dot(v2);
-        boolean dotProductIsAsExp = dotProduct == 0;
-
-        System.out.println("\n>>> Dot product of vectors: [" + dotProduct
-            + "], it is 0 as expected: [" + dotProductIsAsExp + "].");
-
-        Vector hypotenuse = v1.plus(v2);
-
-        System.out.println("\n>>> Hypotenuse (sum of vectors): " + Arrays.toString(hypotenuse.getStorage().data()));
-
-        double lenSquared1 = v1.getLengthSquared();
-        double lenSquared2 = v2.getLengthSquared();
-        double lenSquaredHypotenuse = hypotenuse.getLengthSquared();
-
-        boolean lenSquaredHypotenuseIsAsExp = lenSquaredHypotenuse == lenSquared1 + lenSquared2;
-
-        System.out.println(">>> Squared length of first vector: [" + lenSquared1 + "].");
-        System.out.println(">>> Squared length of second vector: [" + lenSquared2 + "].");
-        System.out.println(">>> Squared length of hypotenuse: [" + lenSquaredHypotenuse
-            + "], equals sum of squared lengths of two original vectors as expected: ["
-            + lenSquaredHypotenuseIsAsExp + "].");
-
-        System.out.println("\n>>> Vector custom storage API usage example completed.");
-    }
-
-    /**
-     * Example of vector with custom storage, modeled after
-     * {@link org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector}.
-     */
-    static class VectorCustomStorage extends AbstractVector {
-        /**
-         * @param arr Source array.
-         * @param cp {@code true} to clone array, reuse it otherwise.
-         */
-        private VectorStorage mkStorage(double[] arr, boolean cp) {
-            assert arr != null;
-
-            return new ExampleVectorStorage(cp ? arr.clone() : arr);
-        }
-
-        /** */
-        public VectorCustomStorage() {
-            // No-op.
-        }
-
-        /**
-         * @param arr Source array.
-         * @param shallowCp {@code true} to use shallow copy.
-         */
-        VectorCustomStorage(double[] arr, boolean shallowCp) {
-            setStorage(mkStorage(arr, shallowCp));
-        }
-
-        /**
-         * @param arr Source array.
-         */
-        VectorCustomStorage(double[] arr) {
-            this(arr, false);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Matrix likeMatrix(int rows, int cols) {
-            return new DenseLocalOnHeapMatrix(rows, cols);
-        }
-
-        /** {@inheritDoc */
-        @Override public Vector like(int crd) {
-            return new org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector(crd);
-        }
-    }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/math/vector/VectorExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/math/vector/VectorExample.java
deleted file mode 100644 (file)
index 9970531..0000000
+++ /dev/null
@@ -1,73 +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.math.vector;
-
-import java.util.Arrays;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
-
-/**
- * This example shows how to use {@link Vector} API.
- *
- * Just simple local onheap version.
- */
-public final class VectorExample {
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     */
-    public static void main(String[] args) {
-        System.out.println();
-        System.out.println(">>> Basic Vector API usage example started.");
-
-        System.out.println("\n>>> Creating perpendicular vectors.");
-        double[] data1 = new double[] {1, 0, 3, 0, 5, 0};
-        double[] data2 = new double[] {0, 2, 0, 4, 0, 6};
-
-        Vector v1 = new DenseLocalOnHeapVector(data1);
-        Vector v2 = new DenseLocalOnHeapVector(data2);
-
-        System.out.println(">>> First vector: " + Arrays.toString(data1));
-        System.out.println(">>> Second vector: " + Arrays.toString(data2));
-
-        double dotProduct = v1.dot(v2);
-        boolean dotProductIsAsExp = dotProduct == 0;
-
-        System.out.println("\n>>> Dot product of vectors: [" + dotProduct
-            + "], it is 0 as expected: [" + dotProductIsAsExp + "].");
-
-        Vector hypotenuse = v1.plus(v2);
-
-        System.out.println("\n>>> Hypotenuse (sum of vectors): " + Arrays.toString(hypotenuse.getStorage().data()));
-
-        double lenSquared1 = v1.getLengthSquared();
-        double lenSquared2 = v2.getLengthSquared();
-        double lenSquaredHypotenuse = hypotenuse.getLengthSquared();
-
-        boolean lenSquaredHypotenuseIsAsExp = lenSquaredHypotenuse == lenSquared1 + lenSquared2;
-
-        System.out.println(">>> Squared length of first vector: [" + lenSquared1 + "].");
-        System.out.println(">>> Squared length of second vector: [" + lenSquared2 + "].");
-        System.out.println(">>> Squared length of hypotenuse: [" + lenSquaredHypotenuse
-            + "], equals sum of squared lengths of two original vectors as expected: ["
-            + lenSquaredHypotenuseIsAsExp + "].");
-
-        System.out.println("\n>>> Basic Vector API usage example completed.");
-    }
-}
index e7b7489..68d793f 100644 (file)
@@ -23,9 +23,9 @@ import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ExampleNodeStartup;
-import org.apache.ignite.ml.math.Matrix;
-import org.apache.ignite.ml.math.VectorUtils;
-import org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.apache.ignite.ml.math.primitives.matrix.Matrix;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
+import org.apache.ignite.ml.math.primitives.matrix.impl.DenseMatrix;
 import org.apache.ignite.ml.nn.Activators;
 import org.apache.ignite.ml.nn.MLPTrainer;
 import org.apache.ignite.ml.nn.MultilayerPerceptron;
@@ -111,7 +111,7 @@ public class MLPTrainerExample {
                 // Calculate score.
                 for (int i = 0; i < 4; i++) {
                     LabeledPoint pnt = trainingSet.get(i);
-                    Matrix predicted = mlp.apply(new DenseLocalOnHeapMatrix(new double[][] {{pnt.x, pnt.y}}));
+                    Matrix predicted = mlp.apply(new DenseMatrix(new double[][] {{pnt.x, pnt.y}}));
                     failCnt += Math.abs(predicted.get(0, 0) - pnt.lb) < 0.5 ? 0 : 1;
                 }
 
index a54e5d3..9f2fc8a 100644 (file)
@@ -26,8 +26,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ml.dataset.model.Person;
 import org.apache.ignite.ml.dataset.DatasetFactory;
 import org.apache.ignite.ml.dataset.primitive.SimpleDataset;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.preprocessing.binarization.BinarizationTrainer;
 
index 582f420..239e3a7 100644 (file)
@@ -26,8 +26,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ml.dataset.model.Person;
 import org.apache.ignite.ml.dataset.DatasetFactory;
 import org.apache.ignite.ml.dataset.primitive.SimpleDataset;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.preprocessing.imputing.ImputerTrainer;
 
index 7b08c7a..3348ce0 100644 (file)
@@ -26,8 +26,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ml.dataset.model.Person;
 import org.apache.ignite.ml.dataset.DatasetFactory;
 import org.apache.ignite.ml.dataset.primitive.SimpleDataset;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.preprocessing.imputing.ImputerTrainer;
 import org.apache.ignite.ml.preprocessing.imputing.ImputingStrategy;
index ababa65..37920cf 100644 (file)
@@ -26,8 +26,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ml.dataset.model.Person;
 import org.apache.ignite.ml.dataset.DatasetFactory;
 import org.apache.ignite.ml.dataset.primitive.SimpleDataset;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.preprocessing.minmaxscaling.MinMaxScalerTrainer;
 
index 2df369e..e58154a 100644 (file)
@@ -26,8 +26,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ml.dataset.model.Person;
 import org.apache.ignite.ml.dataset.DatasetFactory;
 import org.apache.ignite.ml.dataset.primitive.SimpleDataset;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.preprocessing.normalization.NormalizationTrainer;
 
index e7a3daf..47cbb76 100644 (file)
@@ -27,8 +27,8 @@ 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.ml.math.VectorUtils;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
 import org.apache.ignite.ml.regressions.linear.LinearRegressionLSQRTrainer;
 import org.apache.ignite.ml.regressions.linear.LinearRegressionModel;
 import org.apache.ignite.thread.IgniteThread;
@@ -131,7 +131,7 @@ public class LinearRegressionLSQRTrainerExample {
                         double[] inputs = Arrays.copyOfRange(val, 1, val.length);
                         double groundTruth = val[0];
 
-                        double prediction = mdl.apply(new DenseLocalOnHeapVector(inputs));
+                        double prediction = mdl.apply(new DenseVector(inputs));
 
                         System.out.printf(">>> | %.4f\t\t| %.4f\t\t|\n", prediction, groundTruth);
                     }
index a56db61..fca86b6 100644 (file)
@@ -27,8 +27,8 @@ 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.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.preprocessing.minmaxscaling.MinMaxScalerPreprocessor;
 import org.apache.ignite.ml.preprocessing.minmaxscaling.MinMaxScalerTrainer;
index 78874eb..a518c87 100644 (file)
@@ -27,8 +27,8 @@ 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.ml.math.VectorUtils;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
 import org.apache.ignite.ml.nn.UpdatesStrategy;
 import org.apache.ignite.ml.optimization.updatecalculators.RPropParameterUpdate;
 import org.apache.ignite.ml.optimization.updatecalculators.RPropUpdateCalculator;
@@ -138,7 +138,7 @@ public class LinearRegressionSGDTrainerExample {
                         double[] inputs = Arrays.copyOfRange(val, 1, val.length);
                         double groundTruth = val[0];
 
-                        double prediction = mdl.apply(new DenseLocalOnHeapVector(inputs));
+                        double prediction = mdl.apply(new DenseVector(inputs));
 
                         System.out.printf(">>> | %.4f\t\t| %.4f\t\t|\n", prediction, groundTruth);
                     }
index 27ecead..9648bbd 100644 (file)
@@ -27,8 +27,8 @@ 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.ml.math.VectorUtils;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
 import org.apache.ignite.ml.nn.UpdatesStrategy;
 import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDParameterUpdate;
 import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDUpdateCalculator;
@@ -83,7 +83,7 @@ public class LogisticRegressionSGDTrainerSample {
                         double[] inputs = Arrays.copyOfRange(val, 1, val.length);
                         double groundTruth = val[0];
 
-                        double prediction = mdl.apply(new DenseLocalOnHeapVector(inputs));
+                        double prediction = mdl.apply(new DenseVector(inputs));
 
                         totalAmount++;
                         if(groundTruth != prediction)
index 40ab74d..362e9b7 100644 (file)
@@ -27,10 +27,10 @@ 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.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
 import org.apache.ignite.ml.nn.UpdatesStrategy;
 import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDParameterUpdate;
 import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDUpdateCalculator;
@@ -122,8 +122,8 @@ public class LogRegressionMultiClassClassificationExample {
                         double[] inputs = Arrays.copyOfRange(val, 1, val.length);
                         double groundTruth = val[0];
 
-                        double prediction = mdl.apply(new DenseLocalOnHeapVector(inputs));
-                        double predictionWithNormalization = mdlWithNormalization.apply(new DenseLocalOnHeapVector(inputs));
+                        double prediction = mdl.apply(new DenseVector(inputs));
+                        double predictionWithNormalization = mdlWithNormalization.apply(new DenseVector(inputs));
 
                         totalAmount++;
 
index 8086962..83656c5 100644 (file)
@@ -25,7 +25,7 @@ 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.tree.DecisionTreeClassificationTrainerExample;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.selection.cv.CrossValidation;
 import org.apache.ignite.ml.selection.scoring.metric.Accuracy;
 import org.apache.ignite.ml.tree.DecisionTreeClassificationTrainer;
index 275d835..e310ded 100644 (file)
@@ -27,8 +27,8 @@ 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.ml.math.VectorUtils;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
 import org.apache.ignite.ml.regressions.linear.LinearRegressionLSQRTrainer;
 import org.apache.ignite.ml.regressions.linear.LinearRegressionModel;
 import org.apache.ignite.ml.selection.split.TrainTestDatasetSplitter;
@@ -140,7 +140,7 @@ public class TrainTestDatasetSplitterExample {
                         double[] inputs = Arrays.copyOfRange(val, 1, val.length);
                         double groundTruth = val[0];
 
-                        double prediction = mdl.apply(new DenseLocalOnHeapVector(inputs));
+                        double prediction = mdl.apply(new DenseVector(inputs));
 
                         System.out.printf(">>> | %.4f\t\t| %.4f\t\t|\n", prediction, groundTruth);
                     }
index f275ffd..855517d 100644 (file)
@@ -27,8 +27,8 @@ 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.ml.math.VectorUtils;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
 import org.apache.ignite.ml.svm.SVMLinearBinaryClassificationModel;
 import org.apache.ignite.ml.svm.SVMLinearBinaryClassificationTrainer;
 import org.apache.ignite.thread.IgniteThread;
@@ -78,7 +78,7 @@ public class SVMBinaryClassificationExample {
                         double[] inputs = Arrays.copyOfRange(val, 1, val.length);
                         double groundTruth = val[0];
 
-                        double prediction = mdl.apply(new DenseLocalOnHeapVector(inputs));
+                        double prediction = mdl.apply(new DenseVector(inputs));
 
                         totalAmount++;
                         if(groundTruth != prediction)
index 8455ced..b835a5f 100644 (file)
@@ -27,10 +27,10 @@ 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.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
 import org.apache.ignite.ml.preprocessing.minmaxscaling.MinMaxScalerTrainer;
 import org.apache.ignite.ml.svm.SVMLinearMultiClassClassificationModel;
 import org.apache.ignite.ml.svm.SVMLinearMultiClassClassificationTrainer;
@@ -109,8 +109,8 @@ public class SVMMultiClassClassificationExample {
                         double[] inputs = Arrays.copyOfRange(val, 1, val.length);
                         double groundTruth = val[0];
 
-                        double prediction = mdl.apply(new DenseLocalOnHeapVector(inputs));
-                        double predictionWithNormalization = mdlWithNormalization.apply(new DenseLocalOnHeapVector(inputs));
+                        double prediction = mdl.apply(new DenseVector(inputs));
+                        double predictionWithNormalization = mdlWithNormalization.apply(new DenseVector(inputs));
 
                         totalAmount++;
 
index 744e0fc..f5a804d 100644 (file)
@@ -23,7 +23,7 @@ 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.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.tree.DecisionTreeClassificationTrainer;
 import org.apache.ignite.ml.tree.DecisionTreeNode;
 import org.apache.ignite.thread.IgniteThread;
index 63454c6..3ebc56a 100644 (file)
@@ -22,7 +22,7 @@ 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.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.tree.DecisionTreeNode;
 import org.apache.ignite.ml.tree.DecisionTreeRegressionTrainer;
 import org.apache.ignite.thread.IgniteThread;
index f484ac0..384d2d9 100644 (file)
@@ -23,8 +23,8 @@ import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.ml.Model;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.trainers.DatasetTrainer;
 import org.apache.ignite.ml.tree.boosting.GDBBinaryClassifierOnTreesTrainer;
 import org.apache.ignite.thread.IgniteThread;
index 062c446..71d405a 100644 (file)
@@ -23,8 +23,8 @@ import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.ml.Model;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.trainers.DatasetTrainer;
 import org.apache.ignite.ml.tree.boosting.GDBRegressionOnTreesTrainer;
 import org.apache.ignite.thread.IgniteThread;
index a43c4e9..33c3a5f 100644 (file)
@@ -28,7 +28,7 @@ import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.ml.composition.ModelsComposition;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.tree.randomforest.RandomForestClassifierTrainer;
 import org.apache.ignite.ml.tree.randomforest.RandomForestTrainer;
 import org.apache.ignite.thread.IgniteThread;
index 4ae775e..4704268 100644 (file)
@@ -28,7 +28,7 @@ import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.ml.composition.ModelsComposition;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.tree.randomforest.RandomForestRegressionTrainer;
 import org.apache.ignite.ml.tree.randomforest.RandomForestTrainer;
 import org.apache.ignite.thread.IgniteThread;
index d8601f7..3910edb 100644 (file)
@@ -21,8 +21,8 @@ import java.io.FileNotFoundException;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.selection.scoring.evaluator.Evaluator;
 import org.apache.ignite.ml.selection.scoring.metric.Accuracy;
index b63e3ac..52dc434 100644 (file)
@@ -21,8 +21,8 @@ import java.io.FileNotFoundException;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.preprocessing.imputing.ImputerTrainer;
 import org.apache.ignite.ml.selection.scoring.evaluator.Evaluator;
index 1f6995c..7eb3d3b 100644 (file)
@@ -21,7 +21,7 @@ import java.io.FileNotFoundException;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.preprocessing.encoding.stringencoder.StringEncoderTrainer;
 import org.apache.ignite.ml.preprocessing.imputing.ImputerTrainer;
index 26d5973..67615dd 100644 (file)
@@ -21,7 +21,7 @@ import java.io.FileNotFoundException;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.preprocessing.encoding.stringencoder.StringEncoderTrainer;
 import org.apache.ignite.ml.preprocessing.imputing.ImputerTrainer;
index 88da548..88a38ef 100644 (file)
@@ -21,7 +21,7 @@ import java.io.FileNotFoundException;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.preprocessing.encoding.stringencoder.StringEncoderTrainer;
 import org.apache.ignite.ml.preprocessing.imputing.ImputerTrainer;
index 142baca..42a531b 100644 (file)
@@ -24,7 +24,7 @@ import org.apache.ignite.Ignition;
 import org.apache.ignite.ml.knn.classification.KNNClassificationModel;
 import org.apache.ignite.ml.knn.classification.KNNClassificationTrainer;
 import org.apache.ignite.ml.knn.classification.KNNStrategy;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.preprocessing.encoding.stringencoder.StringEncoderTrainer;
 import org.apache.ignite.ml.preprocessing.imputing.ImputerTrainer;
index 0d8fa67..3a882e0 100644 (file)
@@ -21,7 +21,7 @@ import java.io.FileNotFoundException;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.preprocessing.encoding.stringencoder.StringEncoderTrainer;
 import org.apache.ignite.ml.preprocessing.imputing.ImputerTrainer;
index 89710df..077d8c8 100644 (file)
@@ -22,7 +22,7 @@ import java.util.Arrays;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.preprocessing.encoding.stringencoder.StringEncoderTrainer;
 import org.apache.ignite.ml.preprocessing.imputing.ImputerTrainer;
index c06f089..701039a 100644 (file)
@@ -22,7 +22,7 @@ import java.util.Arrays;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.nn.UpdatesStrategy;
 import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDParameterUpdate;
index f0e6cc6..41b10b9 100644 (file)
@@ -29,7 +29,7 @@ public interface Model<T, V> extends IgniteFunction<T, V> {
      * @param combiner Combiner.
      * @return Combination of models.
      */
-    default <X, W> Model<T, X> combine(Model<T, W> other, BiFunction<V, W, X> combiner) {
+    public default <X, W> Model<T, X> combine(Model<T, W> other, BiFunction<V, W, X> combiner) {
         return v -> combiner.apply(apply(v), other.apply(v));
     }
 }
index c900efd..6c09f9d 100644 (file)
@@ -20,7 +20,7 @@ package org.apache.ignite.ml.clustering.kmeans;
 import java.util.Arrays;
 import org.apache.ignite.ml.Exportable;
 import org.apache.ignite.ml.Exporter;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.distances.DistanceMeasure;
 
 /**
index 2663701..a0f6cc7 100644 (file)
@@ -21,7 +21,7 @@ import java.io.Serializable;
 import java.util.Arrays;
 import org.apache.ignite.ml.Exportable;
 import org.apache.ignite.ml.Exporter;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.distances.DistanceMeasure;
 
 /**
index c189e1a..b26ff68 100644 (file)
@@ -28,12 +28,12 @@ import org.apache.ignite.ml.dataset.Dataset;
 import org.apache.ignite.ml.dataset.DatasetBuilder;
 import org.apache.ignite.ml.dataset.PartitionDataBuilder;
 import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.math.distances.DistanceMeasure;
 import org.apache.ignite.ml.math.distances.EuclideanDistance;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
 import org.apache.ignite.ml.math.util.MapUtil;
 import org.apache.ignite.ml.structures.LabeledDataset;
 import org.apache.ignite.ml.structures.LabeledVector;
@@ -89,7 +89,7 @@ public class KMeansTrainer implements SingleLabelDatasetTrainer<KMeansModel> {
             int iteration = 0;
 
             while (iteration < maxIterations && !converged) {
-                Vector[] newCentroids = new DenseLocalOnHeapVector[k];
+                Vector[] newCentroids = new DenseVector[k];
 
                 TotalCostAndCounts totalRes = calcDataForNewCentroids(centers, dataset, cols);
 
@@ -181,7 +181,7 @@ public class KMeansTrainer implements SingleLabelDatasetTrainer<KMeansModel> {
     private Vector[] initClusterCentersRandomly(Dataset<EmptyContext, LabeledDataset<Double, LabeledVector>> dataset,
         int k) {
 
-        Vector[] initCenters = new DenseLocalOnHeapVector[k];
+        Vector[] initCenters = new DenseVector[k];
 
         List<LabeledVector> rndPnts = dataset.compute(data -> {
             List<LabeledVector> rndPnt = new ArrayList<>();
index 514cd21..d73bd4e 100644 (file)
@@ -26,8 +26,8 @@ import java.util.stream.IntStream;
 import org.apache.ignite.ml.Model;
 import org.apache.ignite.ml.composition.predictionsaggregator.PredictionsAggregator;
 import org.apache.ignite.ml.dataset.DatasetBuilder;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.math.functions.IgniteFunction;
 import org.apache.ignite.ml.selection.split.mapper.SHA256UniformMapper;
index 71ea36d..5877afa 100644 (file)
@@ -20,8 +20,8 @@ package org.apache.ignite.ml.composition;
 import java.util.Collections;
 import java.util.Map;
 import org.apache.ignite.ml.Model;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 
 /**
  * Model trained on a features subspace with mapping from original features space to subspace.
index f5212cb..661c941 100644 (file)
@@ -21,7 +21,7 @@ import java.util.Collections;
 import java.util.List;
 import org.apache.ignite.ml.Model;
 import org.apache.ignite.ml.composition.predictionsaggregator.PredictionsAggregator;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 
 /**
  * Model consisting of several models and prediction aggregation strategy.
index dfd3c75..25ae237 100644 (file)
@@ -25,7 +25,7 @@ import java.util.stream.Collectors;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.ml.dataset.DatasetBuilder;
 import org.apache.ignite.ml.dataset.primitive.builder.context.EmptyContextBuilder;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.math.functions.IgniteFunction;
 import org.apache.ignite.ml.math.functions.IgniteTriFunction;
@@ -76,9 +76,8 @@ public abstract class GDBBinaryClassifierTrainer extends GDBTrainer {
 
         List<Double> uniqLabels = new ArrayList<Double>(
             builder.build(new EmptyContextBuilder<>(), new LabeledDatasetPartitionDataBuilderOnHeap<>(featureExtractor, lExtractor))
-                .compute((IgniteFunction<LabeledDataset<Double,LabeledVector>, Set<Double>>) x -> {
-                        return Arrays.stream(x.labels()).boxed().collect(Collectors.toSet());
-                    }, (a, b) -> {
+                .compute((IgniteFunction<LabeledDataset<Double,LabeledVector>, Set<Double>>) x ->
+                    Arrays.stream(x.labels()).boxed().collect(Collectors.toSet()), (a, b) -> {
                         if (a == null)
                             return b;
                         if (b == null)
index 76cefc5..2c8caba 100644 (file)
@@ -18,7 +18,7 @@
 package org.apache.ignite.ml.composition.boosting;
 
 import org.apache.ignite.ml.dataset.DatasetBuilder;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 
 /**
index dd4d0ad..8bdb9b8 100644 (file)
@@ -29,7 +29,7 @@ import org.apache.ignite.ml.dataset.DatasetBuilder;
 import org.apache.ignite.ml.dataset.primitive.builder.context.EmptyContextBuilder;
 import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
 import org.apache.ignite.ml.knn.regression.KNNRegressionTrainer;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.math.functions.IgniteTriFunction;
 import org.apache.ignite.ml.regressions.linear.LinearRegressionLSQRTrainer;
index 18d2050..488c0e3 100644 (file)
@@ -24,12 +24,10 @@ import org.apache.ignite.ml.math.functions.IgniteTriFunction;
  */
 public class LossGradientPerPredictionFunctions {
     /** Mean squared error loss for regression. */
-    public static IgniteTriFunction<Long, Double, Double, Double> MSE = (sampleSize, answer, prediction) -> {
-        return (2.0 / sampleSize) * (prediction - answer);
-    };
+    public static IgniteTriFunction<Long, Double, Double, Double> MSE =
+        (sampleSize, answer, prediction) -> (2.0 / sampleSize) * (prediction - answer);
 
     /** Logarithmic loss for binary classification. */
-    public static IgniteTriFunction<Long, Double, Double, Double> LOG_LOSS = (sampleSize, answer, prediction) -> {
-        return (prediction - answer) / (prediction * (1.0 - prediction));
-    };
+    public static IgniteTriFunction<Long, Double, Double, Double> LOG_LOSS =
+        (sampleSize, answer, prediction) -> (prediction - answer) / (prediction * (1.0 - prediction));
 }
index 67c7d2f..f6bbe9c 100644 (file)
@@ -55,9 +55,11 @@ public class WeightedPredictionsAggregator implements PredictionsAggregator {
         A.ensure(answers.length == weights.length,
             "Composition vector must have same size as weights vector");
 
-        double result = bias;
+        double res = bias;
+
         for(int i = 0; i< answers.length; i++)
-            result += weights[i] * answers[i];
-        return result;
+            res += weights[i] * answers[i];
+
+        return res;
     }
 }
index 76e1281..75ac6d3 100644 (file)
@@ -31,7 +31,7 @@ import org.apache.ignite.ml.dataset.primitive.builder.data.SimpleLabeledDatasetD
 import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
 import org.apache.ignite.ml.dataset.primitive.data.SimpleDatasetData;
 import org.apache.ignite.ml.dataset.primitive.data.SimpleLabeledDatasetData;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 
 /**
index f02a71a..e2f98c2 100644 (file)
@@ -22,7 +22,7 @@ import java.util.Iterator;
 import org.apache.ignite.ml.dataset.PartitionDataBuilder;
 import org.apache.ignite.ml.dataset.UpstreamEntry;
 import org.apache.ignite.ml.dataset.primitive.data.SimpleDatasetData;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 
 /**
index d110df8..1bfd949 100644 (file)
@@ -22,7 +22,7 @@ import java.util.Iterator;
 import org.apache.ignite.ml.dataset.PartitionDataBuilder;
 import org.apache.ignite.ml.dataset.UpstreamEntry;
 import org.apache.ignite.ml.dataset.primitive.data.SimpleLabeledDatasetData;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 
 /**
index 35f4a78..d262efe 100644 (file)
@@ -79,17 +79,17 @@ public class CrossOverJob extends ComputeJobAdapter {
     /**
      * helper routine to assist cross over
      *
-     * @param newKeySwapArrayForChrome New gene keys to copy starting at updateIdx
+     * @param newKeySwapArrForChrome New gene keys to copy starting at updateIdx
      * @param updateIdx Update Index
      * @param genekeys Original gene Keys for a chromosome
      * @return New Gene keys
      */
-    private long[] crossOver(long[] newKeySwapArrayForChrome, int updateIdx, long[] genekeys) {
+    private long[] crossOver(long[] newKeySwapArrForChrome, int updateIdx, long[] genekeys) {
         long[] newGeneKeys = genekeys.clone();
 
         int k = 0;
         for (int x = updateIdx; x < newGeneKeys.length; x++) {
-            newGeneKeys[x] = newKeySwapArrayForChrome[k];
+            newGeneKeys[x] = newKeySwapArrForChrome[k];
             k = k + 1;
         }
         return newGeneKeys;
@@ -115,15 +115,15 @@ public class CrossOverJob extends ComputeJobAdapter {
             Random rn = new Random();
 
             // compute index to start for copying respective genes
-            int geneIndexStartSwap = rn.nextInt(genesforChrom1.length);
+            int geneIdxStartSwap = rn.nextInt(genesforChrom1.length);
 
-            long[] newKeySwapArrayForChrome1 =
-                Arrays.copyOfRange(genesforChrom2, geneIndexStartSwap, genesforChrom1.length);
-            long[] newKeySwapArrayForChrome2 =
-                Arrays.copyOfRange(genesforChrom1, geneIndexStartSwap, genesforChrom1.length);
+            long[] newKeySwapArrForChrome1 =
+                Arrays.copyOfRange(genesforChrom2, geneIdxStartSwap, genesforChrom1.length);
+            long[] newKeySwapArrForChrome2 =
+                Arrays.copyOfRange(genesforChrom1, geneIdxStartSwap, genesforChrom1.length);
 
-            long[] newGeneKeysForChrom1 = crossOver(newKeySwapArrayForChrome1, geneIndexStartSwap, genesforChrom1);
-            long[] newGeneKeysForChrom2 = crossOver(newKeySwapArrayForChrome2, geneIndexStartSwap, genesforChrom2);
+            long[] newGeneKeysForChrom1 = crossOver(newKeySwapArrForChrome1, geneIdxStartSwap, genesforChrom1);
+            long[] newGeneKeysForChrom2 = crossOver(newKeySwapArrForChrome2, geneIdxStartSwap, genesforChrom2);
 
             chromosome1.setGenes(newGeneKeysForChrom1);
             populationCache.put(chromosome1.id(), chromosome1);
index 5d342da..02d90be 100644 (file)
@@ -51,13 +51,13 @@ public class CrossOverTask extends ComputeTaskAdapter<List<Long>, Boolean> {
     private Ignite ignite = null;
 
     /** GAConfiguration */
-    private GAConfiguration config = null;
+    private GAConfiguration cfg;
 
     /**
-     * @param config GAConfiguration
+     * @param cfg GAConfiguration
      */
-    public CrossOverTask(GAConfiguration config) {
-        this.config = config;
+    public CrossOverTask(GAConfiguration cfg) {
+        this.cfg = cfg;
     }
 
     /**
@@ -121,13 +121,13 @@ public class CrossOverTask extends ComputeTaskAdapter<List<Long>, Boolean> {
         Map<ComputeJob, ClusterNode> map) {
         // Calculate number of Jobs = keys / 2
         // as we desire pairs of Chromosomes to be swapped
-        int numberOfJobs = keys.size() / 2;
+        int numOfJobs = keys.size() / 2;
         int k = 0;
-        for (int i = 0; i < numberOfJobs; i++) {
+        for (int i = 0; i < numOfJobs; i++) {
             Long key1 = keys.get(k);
             Long key2 = keys.get(k + 1);
 
-            CrossOverJob job = new CrossOverJob(key1, key2, this.config.getCrossOverRate());
+            CrossOverJob job = new CrossOverJob(key1, key2, this.cfg.getCrossOverRate());
             map.put(job, clusterNode);
             k = k + 2;
         }
index 182b7dc..c11490a 100644 (file)
@@ -49,7 +49,7 @@ public class FitnessJob extends ComputeJobAdapter {
     private IgniteLogger log = null;
 
     /** IFitnessFunction */
-    private IFitnessFunction fitnessFuncton = null;
+    private IFitnessFunction fitnessFuncton;
 
     /**
      * @param key Chromosome primary Key
@@ -85,9 +85,9 @@ public class FitnessJob extends ComputeJobAdapter {
             genes.add(aGene);
         }
 
-        Double value = fitnessFuncton.evaluate(genes);
+        Double val = fitnessFuncton.evaluate(genes);
 
-        chromosome.setFitnessScore(value);
+        chromosome.setFitnessScore(val);
 
         Transaction tx = ignite.transactions().txStart();
 
@@ -95,7 +95,7 @@ public class FitnessJob extends ComputeJobAdapter {
 
         tx.commit();
 
-        return value;
+        return val;
     }
 
 }
index 4403be4..cfae767 100644 (file)
@@ -43,13 +43,13 @@ public class FitnessTask extends ComputeTaskAdapter<List<Long>, Boolean> {
     private Ignite ignite = null;
 
     /** GAConfiguration */
-    private GAConfiguration config = null;
+    private GAConfiguration cfg;
 
     /**
-     * @param config GAConfiguration
+     * @param cfg GAConfiguration
      */
-    public FitnessTask(GAConfiguration config) {
-        this.config = config;
+    public FitnessTask(GAConfiguration cfg) {
+        this.cfg = cfg;
     }
 
     /**
@@ -65,7 +65,7 @@ public class FitnessTask extends ComputeTaskAdapter<List<Long>, Boolean> {
 
         for (Long key : chromosomeKeys) {
 
-            FitnessJob ajob = new FitnessJob(key, this.config.getFitnessFunction());
+            FitnessJob ajob = new FitnessJob(key, this.cfg.getFitnessFunction());
 
             ClusterNode primary = affinity.mapKeyToNode(key);
 
index 2f67054..4133adf 100644 (file)
@@ -42,27 +42,27 @@ import org.apache.ignite.ml.genetic.parameter.GAGridConstants;
  */
 public class GAGrid {
     /** Ignite logger */
-    IgniteLogger igniteLogger = null;
+    private IgniteLogger igniteLog;
     /** GAConfiguraton */
-    private GAConfiguration config = null;
+    private GAConfiguration cfg;
     /** Ignite instance */
-    private Ignite ignite = null;
+    private Ignite ignite;
     /** Population cache */
-    private IgniteCache<Long, Chromosome> populationCache = null;
+    private IgniteCache<Long, Chromosome> populationCache;
     /** Gene cache */
-    private IgniteCache<Long, Gene> geneCache = null;
+    private IgniteCache<Long, Gene> geneCache;
     /** population keys */
     private List<Long> populationKeys = new ArrayList<Long>();
 
     /**
-     * @param config GAConfiguration
+     * @param cfg GAConfiguration
      * @param ignite Ignite
      */
-    public GAGrid(GAConfiguration config, Ignite ignite) {
+    public GAGrid(GAConfiguration cfg, Ignite ignite) {
         this.ignite = ignite;
-        this.config = config;
+        this.cfg = cfg;
         this.ignite = ignite;
-        this.igniteLogger = ignite.log();
+        this.igniteLog = ignite.log();
 
         // Get/Create cache
         populationCache = this.ignite.getOrCreateCache(PopulationCacheConfig.populationCache());
@@ -102,7 +102,7 @@ public class GAGrid {
      * @param chromosomeKeys List of chromosome primary keys
      */
     private void calculateFitness(List<Long> chromosomeKeys) {
-       this.ignite.compute().execute(new FitnessTask(this.config), chromosomeKeys);
+       this.ignite.compute().execute(new FitnessTask(this.cfg), chromosomeKeys);
     }
 
     /**
@@ -111,32 +111,30 @@ public class GAGrid {
      * @return Boolean value
      */
     private Boolean copyFitterChromosomesToPopulation(List<Long> fittestKeys, List<Long> selectedKeys) {
-        double truncatePercentage = this.config.getTruncateRate();
+        double truncatePercentage = this.cfg.getTruncateRate();
 
         int totalSize = this.populationKeys.size();
 
-        int truncateCount = (int)(truncatePercentage * totalSize);
+        int truncateCnt = (int)(truncatePercentage * totalSize);
 
-        int numberOfCopies = selectedKeys.size() / truncateCount;
+        int numOfCopies = selectedKeys.size() / truncateCnt;
 
-        Boolean boolValue = this.ignite.compute()
-            .execute(new TruncateSelectionTask(fittestKeys, numberOfCopies), selectedKeys);
-
-        return boolValue;
+        return this.ignite.compute()
+            .execute(new TruncateSelectionTask(fittestKeys, numOfCopies), selectedKeys);
 
     }
 
     /**
      * create a Chromsome
      *
-     * @param numberOfGenes Number of Genes in resepective Chromosome
+     * @param numOfGenes Number of Genes in resepective Chromosome
      * @return Chromosome
      */
-    private Chromosome createChromosome(int numberOfGenes) {
-        long[] genes = new long[numberOfGenes];
+    private Chromosome createChromosome(int numOfGenes) {
+        long[] genes = new long[numOfGenes];
         List<Long> keys = new ArrayList<Long>();
         int k = 0;
-        while (k < numberOfGenes) {
+        while (k < numOfGenes) {
             long key = selectGene(k);
 
             if (!(keys.contains(key))) {
@@ -145,8 +143,7 @@ public class GAGrid {
                 k = k + 1;
             }
         }
-        Chromosome aChromsome = new Chromosome(genes);
-        return aChromsome;
+        return new Chromosome(genes);
     }
 
     /**
@@ -155,7 +152,7 @@ public class GAGrid {
      * @param leastFitKeys List of primary keys for Chromsomes that are considered 'least fit'
      */
     private void crossover(List<Long> leastFitKeys) {
-        this.ignite.compute().execute(new CrossOverTask(this.config), leastFitKeys);
+        this.ignite.compute().execute(new CrossOverTask(this.cfg), leastFitKeys);
     }
 
     /**
@@ -165,9 +162,9 @@ public class GAGrid {
      */
     public Chromosome evolve() {
         // keep track of current generation
-        int generationCount = 1;
+        int generationCnt = 1;
 
-        Chromosome fittestChomosome = null;
+        Chromosome fittestChomosome;
 
         initializeGenePopulation();
 
@@ -185,9 +182,9 @@ public class GAGrid {
         fittestChomosome = populationCache.get(keys.get(0));
 
         // while NOT terminateCondition met
-        while (!(config.getTerminateCriteria().isTerminationConditionMet(fittestChomosome, averageFitnessScore,
-            generationCount))) {
-            generationCount = generationCount + 1;
+        while (!(cfg.getTerminateCriteria().isTerminationConditionMet(fittestChomosome, averageFitnessScore,
+            generationCnt))) {
+            generationCnt = generationCnt + 1;
 
             // We will crossover/mutate over chromosomes based on selection method
 
@@ -226,7 +223,7 @@ public class GAGrid {
         List<Long> orderChromKeysByFittest = new ArrayList<Long>();
         String orderDirection = "desc";
 
-        if (!config.isHigherFitnessValueFitter())
+        if (!cfg.isHigherFitnessValFitter())
             orderDirection = "asc";
 
         String fittestSQL = "select _key from Chromosome order by fitnessScore " + orderDirection;
@@ -249,13 +246,11 @@ public class GAGrid {
      * @return List of keys for respective Chromosomes
      */
     private List<Long> getFittestKeysForTruncation(List<Long> keys) {
-        double truncatePercentage = this.config.getTruncateRate();
-
-        int truncateCount = (int)(truncatePercentage * keys.size());
+        double truncatePercentage = this.cfg.getTruncateRate();
 
-        List<Long> selectedKeysToRetain = keys.subList(0, truncateCount);
+        int truncateCnt = (int)(truncatePercentage * keys.size());
 
-        return selectedKeysToRetain;
+        return keys.subList(0, truncateCnt);
     }
 
     /**
@@ -264,22 +259,21 @@ public class GAGrid {
     void initializeGenePopulation() {
         geneCache.clear();
 
-        List<Gene> genePool = config.getGenePool();
+        List<Gene> genePool = cfg.getGenePool();
 
-        for (Gene gene : genePool) {
+        for (Gene gene : genePool)
             geneCache.put(gene.id(), gene);
-        }
     }
 
     /**
      * Initialize the population of Chromosomes
      */
     void initializePopulation() {
-        int populationSize = config.getPopulationSize();
+        int populationSize = cfg.getPopulationSize();
         populationCache.clear();
 
         for (int j = 0; j < populationSize; j++) {
-            Chromosome chromosome = createChromosome(config.getChromosomeLength());
+            Chromosome chromosome = createChromosome(cfg.getChromosomeLen());
             populationCache.put(chromosome.id(), chromosome);
             populationKeys.add(chromosome.id());
         }
@@ -290,11 +284,11 @@ public class GAGrid {
      * initialize the population of Chromosomes based on GAConfiguration
      */
     void intializePopulation() {
-        int populationSize = config.getPopulationSize();
+        int populationSize = cfg.getPopulationSize();
         populationCache.clear();
 
         for (int j = 0; j < populationSize; j++) {
-            Chromosome chromosome = createChromosome(config.getChromosomeLength());
+            Chromosome chromosome = createChromosome(cfg.getChromosomeLen());
             populationCache.put(chromosome.id(), chromosome);
             populationKeys.add(chromosome.id());
         }
@@ -307,7 +301,7 @@ public class GAGrid {
      * @param leastFitKeys List of primary keys for Chromosomes that are considered 'least fit'.
      */
     private void mutation(List<Long> leastFitKeys) {
-         this.ignite.compute().execute(new MutateTask(this.config), leastFitKeys);
+         this.ignite.compute().execute(new MutateTask(this.cfg), leastFitKeys);
     }
 
     /**
@@ -316,8 +310,8 @@ public class GAGrid {
      * @return Primary key of respective Gene
      */
     private long selectAnyGene() {
-        int idx = selectRandomIndex(config.getGenePool().size());
-        Gene gene = config.getGenePool().get(idx);
+        int idx = selectRandomIndex(cfg.getGenePool().size());
+        Gene gene = cfg.getGenePool().get(idx);
         return gene.id();
     }
 
@@ -331,9 +325,8 @@ public class GAGrid {
      * @return List of primary Keys for respective Chromosomes that are considered least fit
      */
     private List<Long> selectByElitism(List<Long> keys) {
-        int elitismCount = this.config.getElitismCount();
-        List<Long> leastFitKeys = keys.subList(elitismCount, keys.size());
-        return leastFitKeys;
+        int elitismCnt = this.cfg.getElitismCnt();
+        return keys.subList(elitismCnt, keys.size());
     }
 
     /**
@@ -344,13 +337,11 @@ public class GAGrid {
      * @return List of keys
      */
     private List<Long> selectByTruncation(List<Long> keys) {
-        double truncatePercentage = this.config.getTruncateRate();
-
-        int truncateCount = (int)(truncatePercentage * keys.size());
+        double truncatePercentage = this.cfg.getTruncateRate();
 
-        List<Long> selectedKeysForCrossOver = keys.subList(truncateCount, keys.size());
+        int truncateCnt = (int)(truncatePercentage * keys.size());
 
-        return selectedKeysForCrossOver;
+        return keys.subList(truncateCnt, keys.size());
     }
 
     /**
@@ -358,9 +349,9 @@ public class GAGrid {
      * @return Primary key of respective Gene chosen
      */
     private long selectGene(int k) {
-        if (config.getChromosomeCriteria() == null)
+        if (cfg.getChromosomeCriteria() == null)
             return (selectAnyGene());
-        else 
+        else
             return (selectGeneByChromsomeCriteria(k));
     }
 
@@ -375,7 +366,7 @@ public class GAGrid {
 
         StringBuffer sbSqlClause = new StringBuffer("_val like '");
         sbSqlClause.append("%");
-        sbSqlClause.append(config.getChromosomeCriteria().getCriteria().get(k));
+        sbSqlClause.append(cfg.getChromosomeCriteria().getCriteria().get(k));
         sbSqlClause.append("%'");
 
         IgniteCache<Long, Gene> cache = ignite.cache(GAGridConstants.GENE_CACHE);
@@ -399,8 +390,7 @@ public class GAGrid {
      */
     private int selectRandomIndex(int sizeOfGenePool) {
         Random randomGenerator = new Random();
-        int index = randomGenerator.nextInt(sizeOfGenePool);
-        return index;
+        return randomGenerator.nextInt(sizeOfGenePool);
     }
 
     /**
@@ -412,9 +402,9 @@ public class GAGrid {
     private List<Long> selection(List<Long> chromosomeKeys) {
         List<Long> selectedKeys = new ArrayList();
 
-        GAGridConstants.SELECTION_METHOD selectionMethod = config.getSelectionMethod();
+        GAGridConstants.SELECTION_METHOD selectionMtd = cfg.getSelectionMtd();
 
-        switch (selectionMethod) {
+        switch (selectionMtd) {
             case SELECTON_METHOD_ELETISM:
                 selectedKeys = selectByElitism(chromosomeKeys);
                 break;
index d585330..f15d988 100644 (file)
@@ -43,32 +43,32 @@ public class Gene {
     private Long id;
 
     /** value used to model an individual Gene. */
-    private Object value;
+    private Object val;
 
     /**
      * object Object  parameter.
      *
-     * @param object
+     * @param obj
      */
-    public Gene(Object object) {
+    public Gene(Object obj) {
         id = ID_GEN.incrementAndGet();
-        this.value = object;
+        this.val = obj;
     }
 
     /**
      * @return value for Gene
      */
-    public Object getValue() {
-        return value;
+    public Object getVal() {
+        return val;
     }
 
     /**
      * Set the Gene value
      *
-     * @param object Value for Gene
+     * @param obj Value for Gene
      */
-    public void setValue(Object object) {
-        this.value = object;
+    public void setVal(Object obj) {
+        this.val = obj;
     }
 
     /**
@@ -80,7 +80,7 @@ public class Gene {
 
     /** {@inheritDoc} */
     @Override public String toString() {
-        return "Gene [id=" + id + ", value=" + value + "]";
+        return "Gene [id=" + id + ", value=" + val + "]";
     }
 
 }
index 3a7b0c5..704cf00 100644 (file)
@@ -53,13 +53,13 @@ public class MutateTask extends ComputeTaskAdapter<List<Long>, Boolean> {
     private Ignite ignite = null;
 
     /** GAConfiguration */
-    private GAConfiguration config = null;
+    private GAConfiguration cfg;
 
     /**
-     * @param config GAConfiguration
+     * @param cfg GAConfiguration
      */
-    public MutateTask(GAConfiguration config) {
-        this.config = config;
+    public MutateTask(GAConfiguration cfg) {
+        this.cfg = cfg;
     }
 
     /**
@@ -69,11 +69,11 @@ public class MutateTask extends ComputeTaskAdapter<List<Long>, Boolean> {
      */
     private List<Long> getMutatedGenes() {
         List<Long> mutatedGenes = new ArrayList<Long>();
-        config.getChromosomeLength();
+        cfg.getChromosomeLen();
 
-        for (int i = 0; i < config.getChromosomeLength(); i++) 
+        for (int i = 0; i < cfg.getChromosomeLen(); i++)
             mutatedGenes.add(selectGene(i));
-      
+
         return mutatedGenes;
     }
 
@@ -87,7 +87,7 @@ public class MutateTask extends ComputeTaskAdapter<List<Long>, Boolean> {
         Affinity affinity = ignite.affinity(GAGridConstants.POPULATION_CACHE);
 
         for (Long key : chromosomeKeys) {
-            MutateJob ajob = new MutateJob(key, getMutatedGenes(), this.config.getMutationRate());
+            MutateJob ajob = new MutateJob(key, getMutatedGenes(), this.cfg.getMutationRate());
             ClusterNode primary = affinity.mapKeyToNode(key);
             map.put(ajob, primary);
         }
@@ -126,8 +126,8 @@ public class MutateTask extends ComputeTaskAdapter<List<Long>, Boolean> {
      * @return Primary key of Gene
      */
     private long selectAnyGene() {
-        int idx = selectRandomIndex(config.getGenePool().size());
-        Gene gene = config.getGenePool().get(idx);
+        int idx = selectRandomIndex(cfg.getGenePool().size());
+        Gene gene = cfg.getGenePool().get(idx);
         return gene.id();
     }
 
@@ -138,9 +138,9 @@ public class MutateTask extends ComputeTaskAdapter<List<Long>, Boolean> {
      * @return Primary key of Gene
      */
     private long selectGene(int k) {
-        if (config.getChromosomeCriteria() == null) 
+        if (cfg.getChromosomeCriteria() == null)
             return (selectAnyGene());
-        else 
+        else
             return (selectGeneByChromsomeCriteria(k));
     }
 
@@ -155,7 +155,7 @@ public class MutateTask extends ComputeTaskAdapter<List<Long>, Boolean> {
 
         StringBuffer sbSqlClause = new StringBuffer("_val like '");
         sbSqlClause.append("%");
-        sbSqlClause.append(config.getChromosomeCriteria().getCriteria().get(k));
+        sbSqlClause.append(cfg.getChromosomeCriteria().getCriteria().get(k));
         sbSqlClause.append("%'");
 
         IgniteCache<Long, Gene> cache = ignite.cache(GAGridConstants.GENE_CACHE);
@@ -181,8 +181,7 @@ public class MutateTask extends ComputeTaskAdapter<List<Long>, Boolean> {
      */
     private int selectRandomIndex(int sizeOfGenePool) {
         Random randomGenerator = new Random();
-        int index = randomGenerator.nextInt(sizeOfGenePool);
-        return index;
+        return randomGenerator.nextInt(sizeOfGenePool);
     }
 
 }
index 1317b0e..e657ca0 100644 (file)
@@ -63,9 +63,8 @@ public class TruncateSelectionJob extends ComputeJobAdapter {
 
         long[] geneKeys = chromosome.getGenes();
 
-        for (int k = 0; k < this.mutatedGeneKeys.size(); k++) {
+        for (int k = 0; k < this.mutatedGeneKeys.size(); k++)
             geneKeys[k] = this.mutatedGeneKeys.get(k);
-        }
 
         chromosome.setGenes(geneKeys);
 
index d017741..09f17cb 100644 (file)
@@ -47,10 +47,10 @@ public class TruncateSelectionTask extends ComputeTaskAdapter<List<Long>, Boolea
     private Ignite ignite = null;
 
     /** Fittest keys. */
-    private List<Long> fittestKeys = null;
+    private List<Long> fittestKeys;
 
     /** Number of Copies. */
-    private int numOfCopies = 0;
+    private int numOfCopies;
 
     /**
      * @param fittestKeys List of long.
@@ -95,13 +95,13 @@ public class TruncateSelectionTask extends ComputeTaskAdapter<List<Long>, Boolea
         List<List<Long>> list = new ArrayList<List<Long>>();
 
         for (Long key : fittestKeys) {
-            Chromosome copy = getChromosome(key);
+            Chromosome cp = getChromosome(key);
             for (int i = 0; i < numOfCopies; i++) {
-                long[] thegenes = copy.getGenes();
+                long[] thegenes = cp.getGenes();
                 List<Long> geneList = new ArrayList<Long>();
-                for (int k = 0; k < copy.getGenes().length; k++) {
+                for (int k = 0; k < cp.getGenes().length; k++)
                     geneList.add(thegenes[k]);
-                }
+
                 list.add(geneList);
             }
         }
index d28bc02..9911eea 100644 (file)
@@ -28,7 +28,6 @@ import org.h2.tools.SimpleResultSet;
 
 import org.apache.ignite.ml.genetic.Chromosome;
 import org.apache.ignite.ml.genetic.Gene;
-import org.apache.ignite.ml.genetic.parameter.GAConfiguration;
 import org.apache.ignite.ml.genetic.utils.GAGridUtils;
 
 /**
@@ -81,30 +80,30 @@ public class GAGridFunction {
     /**
      * Helper routine to return 'pivoted' results using the provided query param.
      *
-     * @param query Sql
+     * @param qry Sql
      * @return Result set
      */
-    private static SimpleResultSet getChromosomes(String query) {
+    private static SimpleResultSet getChromosomes(String qry) {
         Ignite ignite = Ignition.localIgnite();
 
-        List<Chromosome> chromosomes = GAGridUtils.getChromosomes(ignite, query);
+        List<Chromosome> chromosomes = GAGridUtils.getChromosomes(ignite, qry);
 
         SimpleResultSet rs2 = new SimpleResultSet();
 
         Chromosome aChrom = chromosomes.get(0);
-        int genesCount = aChrom.getGenes().length;
+        int genesCnt = aChrom.getGenes().length;
 
         rs2.addColumn("Chromosome Id", Types.INTEGER, 0, 0);
         rs2.addColumn("Fitness Score", Types.DOUBLE, 0, 0);
 
-        for (int i = 0; i < genesCount; i++) {
-            int columnIndex = i + 1;
-            rs2.addColumn("Gene " + columnIndex, Types.VARCHAR, 0, 0);
+        for (int i = 0; i < genesCnt; i++) {
+            int colIdx = i + 1;
+            rs2.addColumn("Gene " + colIdx, Types.VARCHAR, 0, 0);
         }
 
         for (Chromosome rowChrom : chromosomes) {
 
-            Object[] row = new Object[genesCount + 2];
+            Object[] row = new Object[genesCnt + 2];
             row[0] = rowChrom.id();
             row[1] = rowChrom.getFitnessScore();
 
@@ -112,7 +111,7 @@ public class GAGridFunction {
             int i = 2;
 
             for (Gene gene : genes) {
-                row[i] = gene.getValue().toString();
+                row[i] = gene.getVal().toString();
                 i = i + 1;
             }
             //Add a row for an individual Chromosome
index 70c7ad9..ccacda6 100644 (file)
@@ -40,7 +40,7 @@ import org.apache.ignite.ml.genetic.IFitnessFunction;
  */
 public class GAConfiguration {
     /** Selection method */
-    private GAGridConstants.SELECTION_METHOD selectionMethod = null;
+    private GAGridConstants.SELECTION_METHOD selectionMtd = null;
 
     /** Criteria used to describe a chromosome */
     private ChromosomeCriteria chromosomeCriteria = null;
@@ -60,13 +60,13 @@ public class GAConfiguration {
      *
      * NOTE: This parameter is only considered when selectionMethod is SELECTON_METHOD_ELETISM.
      */
-    private int elitismCount = 0;
+    private int elitismCnt = 0;
 
     /**
      * Indicates how chromosome fitness values should be evaluated. </br> A chromosome with
      * isHigherFitnessValueFitter=true is considered fittest.
      */
-    private boolean isHigherFitnessValueFitter = true;
+    private boolean isHigherFitnessValFitter = true;
     /**
      * Population size represents the number of potential solutions (ie: chromosomes) between each generation Default
      * size is 500
@@ -79,7 +79,7 @@ public class GAConfiguration {
     private List<Gene> genePool = new ArrayList<Gene>();
 
     /** Number of genes within a chromosome */
-    private int chromosomeLength = 0;
+    private int chromosomeLen = 0;
     /**
      * Crossover rate is the probability that two chromosomes will breed with each other. offspring with traits of each
      * of the parents.
@@ -107,7 +107,7 @@ public class GAConfiguration {
     private IFitnessFunction fitnessFunction = null;
 
     public GAConfiguration() {
-        this.setSelectionMethod(GAGridConstants.SELECTION_METHOD.SELECTION_METHOD_TRUNCATION);
+        this.setSelectionMtd(GAGridConstants.SELECTION_METHOD.SELECTION_METHOD_TRUNCATION);
         this.setTruncateRate(.10);
     }
 
@@ -131,19 +131,10 @@ public class GAConfiguration {
     }
 
     /**
-     * set Boolean value indicating how fitness values should be evaluated
-     *
-     * @param isHigherFitnessValueFitter Boolean value indicating how fitness values should be evaluated
-     */
-    public void setIsHigherFitnessValueFitter(boolean isHigherFitnessValueFitter) {
-        this.isHigherFitnessValueFitter = isHigherFitnessValueFitter;
-    }
-
-    /**
      * @return Boolean value indicating how fitness values should be evaluated.
      */
-    public boolean isHigherFitnessValueFitter() {
-        return this.isHigherFitnessValueFitter;
+    public boolean isHigherFitnessValFitter() {
+        return this.isHigherFitnessValFitter;
     }
 
     /**
@@ -151,17 +142,17 @@ public class GAConfiguration {
      *
      * @return Size of Chromosome
      */
-    public int getChromosomeLength() {
-        return chromosomeLength;
+    public int getChromosomeLen() {
+        return chromosomeLen;
     }
 
     /**
      * Set the Chromsome length
      *
-     * @param chromosomeLength Size of Chromosome
+     * @param chromosomeLen Size of Chromosome
      */
-    public void setChromosomeLength(int chromosomeLength) {
-        this.chromosomeLength = chromosomeLength;
+    public void setChromosomeLen(int chromosomeLen) {
+        this.chromosomeLen = chromosomeLen;
     }
 
     /**
@@ -187,17 +178,17 @@ public class GAConfiguration {
      *
      * @return Elitism count
      */
-    public int getElitismCount() {
-        return elitismCount;
+    public int getElitismCnt() {
+        return elitismCnt;
     }
 
     /**
      * Set the elitism count.
      *
-     * @param elitismCount Elitism count
+     * @param elitismCnt Elitism count
      */
-    public void setElitismCount(int elitismCount) {
-        this.elitismCount = elitismCount;
+    public void setElitismCnt(int elitismCnt) {
+        this.elitismCnt = elitismCnt;
     }
 
     /**
@@ -281,17 +272,17 @@ public class GAConfiguration {
      *
      * @return Selection method
      */
-    public GAGridConstants.SELECTION_METHOD getSelectionMethod() {
-        return selectionMethod;
+    public GAGridConstants.SELECTION_METHOD getSelectionMtd() {
+        return selectionMtd;
     }
 
     /**
      * Set the selection method
      *
-     * @param selectionMethod Selection method
+     * @param selectionMtd Selection method
      */
-    public void setSelectionMethod(GAGridConstants.SELECTION_METHOD selectionMethod) {
-        this.selectionMethod = selectionMethod;
+    public void setSelectionMtd(GAGridConstants.SELECTION_METHOD selectionMtd) {
+        this.selectionMtd = selectionMtd;
     }
 
     /**
index 9a5bd66..6d1645f 100644 (file)
@@ -28,8 +28,7 @@ public interface GAGridConstants {
     public static final String GENE_CACHE = "geneCache";
 
     /** Selection Method type **/
-    public static enum SELECTION_METHOD {
+    public enum SELECTION_METHOD {
         SELECTON_METHOD_ELETISM, SELECTION_METHOD_TRUNCATION
-    };
-
+    }
 }
index e27ddac..76c292d 100644 (file)
@@ -18,7 +18,6 @@
 package org.apache.ignite.ml.genetic.utils;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 import javax.cache.Cache.Entry;
@@ -41,15 +40,15 @@ public class GAGridUtils {
      * Retrieve chromosomes
      *
      * @param ignite Ignite
-     * @param query Sql
+     * @param qry Sql
      * @return List of Chromosomes
      */
-    public static List<Chromosome> getChromosomes(Ignite ignite, String query) {
+    public static List<Chromosome> getChromosomes(Ignite ignite, String qry) {
         List<Chromosome> chromosomes = new ArrayList<Chromosome>();
 
         IgniteCache<Long, Chromosome> populationCache = ignite.getOrCreateCache(PopulationCacheConfig.populationCache());
 
-        SqlQuery sql = new SqlQuery(Chromosome.class, query);
+        SqlQuery sql = new SqlQuery(Chromosome.class, qry);
 
         try (QueryCursor<Entry<Long, Chromosome>> cursor = populationCache.query(sql)) {
             for (Entry<Long, Chromosome> e : cursor)
index 2ba919a..6c27ab7 100644 (file)
@@ -21,7 +21,7 @@ import org.apache.ignite.ml.dataset.Dataset;
 import org.apache.ignite.ml.dataset.DatasetBuilder;
 import org.apache.ignite.ml.dataset.PartitionDataBuilder;
 import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.structures.LabeledDataset;
 import org.apache.ignite.ml.structures.LabeledVector;
index 4f25a16..22b6832 100644 (file)
@@ -33,7 +33,7 @@ import org.apache.ignite.ml.Exporter;
 import org.apache.ignite.ml.Model;
 import org.apache.ignite.ml.dataset.Dataset;
 import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.distances.DistanceMeasure;
 import org.apache.ignite.ml.math.distances.EuclideanDistance;
 import org.apache.ignite.ml.structures.LabeledDataset;
index c84bfd8..99b70ab 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.ignite.ml.knn.classification;
 
 import org.apache.ignite.ml.dataset.DatasetBuilder;
 import org.apache.ignite.ml.knn.KNNUtils;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.trainers.SingleLabelDatasetTrainer;
 
index 5fbaa89..5db2a30 100644 (file)
@@ -20,7 +20,7 @@ import java.util.List;
 import org.apache.ignite.ml.dataset.Dataset;
 import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
 import org.apache.ignite.ml.knn.classification.KNNClassificationModel;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.exceptions.UnsupportedOperationException;
 import org.apache.ignite.ml.structures.LabeledDataset;
 import org.apache.ignite.ml.structures.LabeledVector;
index 4960370..5f1b349 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.ignite.ml.knn.regression;
 
 import org.apache.ignite.ml.dataset.DatasetBuilder;
 import org.apache.ignite.ml.knn.KNNUtils;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.trainers.SingleLabelDatasetTrainer;
 
index bc603c8..18aea1a 100644 (file)
@@ -23,13 +23,12 @@ import java.util.Set;
 import org.apache.ignite.ml.math.exceptions.CardinalityException;
 import org.apache.ignite.ml.math.exceptions.MathIllegalArgumentException;
 import org.apache.ignite.ml.math.exceptions.NonSquareMatrixException;
-import org.apache.ignite.ml.math.impls.matrix.DenseLocalOffHeapMatrix;
-import org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix;
-import org.apache.ignite.ml.math.impls.matrix.SparseLocalOnHeapMatrix;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOffHeapVector;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
-import org.apache.ignite.ml.math.impls.vector.SparseLocalOffHeapVector;
-import org.apache.ignite.ml.math.impls.vector.SparseLocalVector;
+import org.apache.ignite.ml.math.primitives.matrix.Matrix;
+import org.apache.ignite.ml.math.primitives.matrix.impl.DenseMatrix;
+import org.apache.ignite.ml.math.primitives.matrix.impl.SparseMatrix;
+import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
+import org.apache.ignite.ml.math.primitives.vector.impl.SparseVector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.util.MatrixUtil;
 
 /**
@@ -58,8 +57,8 @@ public class Blas {
 
         if (x.isArrayBased() && y.isArrayBased())
             axpy(a, x.getStorage().data(), y.getStorage().data());
-        else if (x instanceof SparseLocalVector && y.isArrayBased())
-            axpy(a, (SparseLocalVector)x, y.getStorage().data());
+        else if (x instanceof SparseVector && y.isArrayBased())
+            axpy(a, (SparseVector)x, y.getStorage().data());
         else
             throw new MathIllegalArgumentException("Operation 'axpy' doesn't support this combination of parameters [x="
                 + x.getClass().getName() + ", y=" + y.getClass().getName() + "].");
@@ -71,7 +70,7 @@ public class Blas {
     }
 
     /** */
-    private static void axpy(Double a, SparseLocalVector x, double[] y) {
+    private static void axpy(Double a, SparseVector x, double[] y) {
         int xSize = x.size();
 
         if (a == 1.0) {
@@ -121,7 +120,7 @@ public class Blas {
             if (x.isArrayBased())
                 System.arraycopy(x.getStorage().data(), 0, y.getStorage().data(), 0, n);
             else {
-                if (y instanceof SparseLocalVector) {
+                if (y instanceof SparseVector) {
                     for (int i = 0; i < n; i++)
                         yData[i] = x.getX(i);
                 }
@@ -140,8 +139,8 @@ public class Blas {
     public static void scal(Double a, Vector x) {
         if (x.isArrayBased())
             f2jBlas.dscal(x.size(), a, x.getStorage().data(), 1);
-        else if (x instanceof SparseLocalVector) {
-            Set<Integer> indexes = ((SparseLocalVector)x).indexes();
+        else if (x instanceof SparseVector) {
+            Set<Integer> indexes = ((SparseVector)x).indexes();
 
             for (Integer i : indexes)
                 x.compute(i, (ind, v) -> v * a);
@@ -155,12 +154,12 @@ public class Blas {
      *
      * @param u the upper triangular part of the matrix in a [[DenseVector]](column major)
      */
-    public static void spr(Double alpha, DenseLocalOnHeapVector v, DenseLocalOnHeapVector u) {
+    public static void spr(Double alpha, DenseVector v, DenseVector u) {
         nativeBlas.dspr("U", v.size(), alpha, v.getStorage().data(), 1, u.getStorage().data());
     }
 
     /** */
-    public static void spr(Double alpha, SparseLocalVector v, DenseLocalOnHeapVector u) {
+    public static void spr(Double alpha, SparseVector v, DenseVector u) {
         int prevNonDfltInd = 0;
         int startInd = 0;
         double av;
@@ -185,7 +184,7 @@ public class Blas {
      * @param x the vector x that contains the n elements.
      * @param a the symmetric matrix A. Size of n x n.
      */
-    void syr(Double alpha, Vector x, DenseLocalOnHeapMatrix a) {
+    void syr(Double alpha, Vector x, DenseMatrix a) {
         int mA = a.rowSize();
         int nA = a.columnSize();
 
@@ -196,9 +195,9 @@ public class Blas {
             throw new CardinalityException(x.size(), mA);
 
         // TODO: IGNITE-5535, Process DenseLocalOffHeapVector
-        if (x instanceof DenseLocalOnHeapVector)
+        if (x instanceof DenseVector)
             syr(alpha, x, a);
-        else if (x instanceof SparseLocalVector)
+        else if (x instanceof SparseVector)
             syr(alpha, x, a);
         else
             throw new IllegalArgumentException("Operation 'syr' does not support vector [class="
@@ -206,7 +205,7 @@ public class Blas {
     }
 
     /** TODO: IGNTIE-5770, add description for a */
-    static void syr(Double alpha, DenseLocalOnHeapVector x, DenseLocalOnHeapMatrix a) {
+    static void syr(Double alpha, DenseVector x, DenseMatrix a) {
         int nA = a.rowSize();
         int mA = a.columnSize();
 
@@ -226,7 +225,7 @@ public class Blas {
     }
 
     /** */
-    public static void syr(Double alpha, SparseLocalVector x, DenseLocalOnHeapMatrix a) {
+    public static void syr(Double alpha, SparseVector x, DenseMatrix a) {
         int mA = a.columnSize();
 
         for (Integer i : x.indexes()) {
@@ -246,9 +245,6 @@ public class Blas {
         else if (alpha == 0.0)
             scal(c, beta);
         else {
-            checkMatrixType(a, "gemm");
-            checkMatrixType(b, "gemm");
-            checkMatrixType(c, "gemm");
 
             double[] fA = a.getStorage().data();
             double[] fB = b.getStorage().data();
@@ -259,30 +255,12 @@ public class Blas {
             nativeBlas.dgemm("N", "N", a.rowSize(), b.columnSize(), a.columnSize(), alpha, fA,
                 a.rowSize(), fB, b.rowSize(), beta, fC, c.rowSize());
 
-            if (c instanceof SparseLocalOnHeapMatrix)
+            if (c instanceof SparseMatrix)
                 MatrixUtil.unflatten(fC, c);
         }
     }
 
     /**
-     * Currently we support only local onheap matrices for BLAS.
-     */
-    private static void checkMatrixType(Matrix a, String op) {
-        if (a instanceof DenseLocalOffHeapMatrix)
-            throw new IllegalArgumentException("Operation doesn't support for matrix [class="
-                + a.getClass().getName() + ", operation=" + op + "].");
-    }
-
-    /**
-     * Currently we support only local onheap vectors for BLAS.
-     */
-    private static void checkVectorType(Vector a, String op) {
-        if (a instanceof DenseLocalOffHeapVector || a instanceof SparseLocalOffHeapVector)
-            throw new IllegalArgumentException("Operation doesn't support for vector [class="
-                + a.getClass().getName() + ", operation=" + op + "].");
-    }
-
-    /**
      * y := alpha * A * x + beta * y.
      *
      * @param alpha Alpha.
@@ -297,10 +275,6 @@ public class Blas {
         if (a.rowSize() != y.size())
             throw new CardinalityException(a.columnSize(), y.size());
 
-        checkMatrixType(a, "gemv");
-        checkVectorType(x, "gemv");
-        checkVectorType(y, "gemv");
-
         if (alpha == 0.0 && beta == 1.0)
             return;
 
@@ -315,7 +289,7 @@ public class Blas {
 
         nativeBlas.dgemv("N", a.rowSize(), a.columnSize(), alpha, fA, a.rowSize(), fX, 1, beta, fY, 1);
 
-        if (y instanceof SparseLocalVector)
+        if (y instanceof SparseVector)
             y.assign(fY);
     }
 
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/KeyMapper.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/KeyMapper.java
deleted file mode 100644 (file)
index 1ac2f3d..0000000
+++ /dev/null
@@ -1,33 +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.math;
-
-import java.io.Serializable;
-
-/**
- * Maps key objects to index in {@link Vector} or {@link Matrix}.
- */
-public interface KeyMapper<K> extends Serializable {
-    /**
-     * Checks given cache key corresponds to a valid index in vector or matrix.
-     *
-     * @param k Key to check.
-     * @return {@code true} if there is a valid index, {@code false} otherwise.
-     */
-    public boolean isValid(K k);
-}
index b73ee3e..eacf0b8 100644 (file)
@@ -34,6 +34,8 @@ import java.util.function.Function;
 import java.util.stream.Collectors;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.ml.math.primitives.matrix.Matrix;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 
 /**
  * Utility methods to support output of {@link Vector} and {@link Matrix} instances to plain text or HTML.
index 7ea8fb3..50324c1 100644 (file)
@@ -17,7 +17,7 @@
 package org.apache.ignite.ml.math.distances;
 
 import java.io.Externalizable;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.exceptions.CardinalityException;
 
 /**
index 64ea285..935e19b 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.ignite.ml.math.distances;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.exceptions.CardinalityException;
 import org.apache.ignite.ml.math.util.MatrixUtil;
 
@@ -61,9 +61,6 @@ public class EuclideanDistance implements DistanceMeasure {
         if (this == obj)
             return true;
 
-        if (obj == null || getClass() != obj.getClass())
-            return false;
-
-        return true;
+        return obj != null && getClass() == obj.getClass();
     }
 }
index cb99074..f08ff7b 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.ignite.ml.math.distances;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.exceptions.CardinalityException;
 import org.apache.ignite.ml.math.functions.Functions;
 import org.apache.ignite.ml.math.functions.IgniteDoubleFunction;
@@ -62,9 +62,6 @@ public class HammingDistance implements DistanceMeasure {
         if (this == obj)
             return true;
 
-        if (obj == null || getClass() != obj.getClass())
-            return false;
-
-        return true;
+        return obj != null && getClass() == obj.getClass();
     }
 }
index 9ea36b3..d298e3c 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.ignite.ml.math.distances;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.exceptions.CardinalityException;
 import org.apache.ignite.ml.math.util.MatrixUtil;
 
@@ -56,9 +56,6 @@ public class ManhattanDistance implements DistanceMeasure {
         if (this == obj)
             return true;
 
-        if (obj == null || getClass() != obj.getClass())
-            return false;
-
-        return true;
+        return obj != null && getClass() == obj.getClass();
     }
 }
index f2312a1..2fc6cee 100644 (file)
@@ -27,9 +27,9 @@ public class UnknownStringValue extends IgniteException {
     private static final long serialVersionUID = 0L;
 
     /**
-     * @param unknownString String value that caused this exception.
+     * @param unknownStr String value that caused this exception.
      */
-    public UnknownStringValue(String unknownString) {
-        super("This String value is unknown for StringEncoder: " + unknownString);
+    public UnknownStringValue(String unknownStr) {
+        super("This String value is unknown for StringEncoder: " + unknownStr);
     }
 }
index 560be4b..b44d77b 100644 (file)
@@ -28,7 +28,7 @@ import java.util.function.BiFunction;
  */
 public interface IgniteBiFunction<T, U, R> extends BiFunction<T, U, R>, Serializable {
     /** */
-    default <V> IgniteBiFunction<T, U, V> andThen(IgniteFunction<? super R, ? extends V> after) {
+    public default <V> IgniteBiFunction<T, U, V> andThen(IgniteFunction<? super R, ? extends V> after) {
         Objects.requireNonNull(after);
         return (T t, U u) -> after.apply(apply(t, u));
     }
index e97ee41..985b2d5 100644 (file)
@@ -27,5 +27,5 @@ public interface IgniteDifferentiableDoubleToDoubleFunction extends IgniteDouble
      * @param pnt Point to calculate differential at.
      * @return Function differential at a given point.
      */
-    double differential(double pnt);
+    public double differential(double pnt);
 }
index 3132c63..8f55525 100644 (file)
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.ml.math.functions;
 
-import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 
 /**
  * Interface for differentiable functions from vector to double.
@@ -29,5 +29,5 @@ public interface IgniteDifferentiableVectorToDoubleFunction extends IgniteFuncti
      * @param pnt Point to calculate differential at.
      * @return Function differential at a given point.
      */
-    Vector differential(Vector pnt);
+    public Vector differential(Vector pnt);
 }
index af304c9..2954016 100644 (file)
@@ -36,5 +36,5 @@ public interface IgniteTriConsumer<A, B, C> extends Serializable {
      * @param second Second parameter.
      * @param third Third parameter.
      */
-    void accept(A first, B second, C third);
+    public void accept(A first, B second, C third);
 }
index 4d8fd20..e1f7ae5 100644 (file)
@@ -25,10 +25,10 @@ import java.util.function.Function;
 @FunctionalInterface
 public interface IgniteTriFunction<A, B, C, R> extends Serializable {
     /** */
-    R apply(A a, B b, C c);
+    public R apply(A a, B b, C c);
 
     /** */
-    default <V> IgniteTriFunction<A, B, C, V> andThen(Function<? super R, ? extends V> after) {
+    public default <V> IgniteTriFunction<A, B, C, V> andThen(Function<? super R, ? extends V> after) {
         Objects.requireNonNull(after);
 
         return (A a, B b, C c) -> after.apply(apply(a, b, c));
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/DenseLocalOffHeapMatrix.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/DenseLocalOffHeapMatrix.java
deleted file mode 100644 (file)
index 08c9142..0000000
+++ /dev/null
@@ -1,114 +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.math.impls.matrix;
-
-import org.apache.ignite.ml.math.Matrix;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.exceptions.CardinalityException;
-import org.apache.ignite.ml.math.impls.storage.matrix.DenseOffHeapMatrixStorage;
-import org.apache.ignite.ml.math.impls.vector.DenseLocalOffHeapVector;
-
-/**
- * Dense local off-heap implementation of the {@link Matrix} interface.
- */
-public class DenseLocalOffHeapMatrix extends AbstractMatrix {
-    /** */
-    public DenseLocalOffHeapMatrix() {
-        // No-op.
-    }
-
-    /**
-     * @param data Backing data array.
-     */
-    public DenseLocalOffHeapMatrix(double[][] data) {
-        assert data != null;
-
-        setStorage(new DenseOffHeapMatrixStorage(data));
-    }
-
-    /**
-     * @param rows Amount of rows in matrix.
-     * @param cols Amount of columns in matrix.
-     */
-    public DenseLocalOffHeapMatrix(int rows, int cols) {
-        assert rows > 0;
-        assert cols > 0;
-
-        setStorage(new DenseOffHeapMatrixStorage(rows, cols));
-    }
-
-    /** {@inheritDoc} */
-    @Override public Matrix copy() {
-        DenseLocalOffHeapMatrix cp = new DenseLocalOffHeapMatrix(getStorage().rowSize(), getStorage().columnSize());
-
-        cp.assign(this);
-
-        return cp;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Matrix like(int rows, int cols) {
-        return new DenseLocalOffHeapMatrix(rows, cols);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Vector likeVector(int crd) {
-        return new DenseLocalOffHeapVector(crd);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected Matrix likeIdentity() {
-        int n = rowSize();
-        Matrix res = like(n, n);
-
-        // IMPL NOTE as opposed to on-heap matrices this one isn't initialized with zeroes
-        for (int i = 0; i < n; i++)
-            for (int j = 0; j < n; j++)
-                res.setX(i, j, i == j ? 1.0 : 0.0);
-
-        return res;
-    }
-
-    /**
-     * TODO: IGNITE-5535, WIP, currently it`s tmp naive impl.
-     */
-    @Override public Matrix times(Matrix mtx) {
-        int cols = columnSize();
-
-        if (cols != mtx.rowSize())
-            throw new CardinalityException(cols, mtx.rowSize());
-
-        int rows = rowSize();
-
-        int mtxCols = mtx.columnSize();
-
-        Matrix res = like(rows, mtxCols);
-
-        for (int x = 0; x < rows; x++)
-            for (int y = 0; y < mtxCols; y++) {
-                double sum = 0.0;
-
-                for (int k = 0; k < cols; k++)
-                    sum += getX(x, k) * mtx.getX(k, y);
-
-                res.setX(x, y, sum);
-            }
-
-        return res;
-    }
-}
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/package-info.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/package-info.java
deleted file mode 100644 (file)
index d531014..0000000
+++ /dev/null
@@ -1,22 +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 description. -->
- * Contains specific implementations for core algebra.
- */
-package org.apache.ignite.ml.math.impls;
\ No newline at end of file
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java
deleted file mode 100644 (file)
index 37801d5..0000000
+++ /dev/null
@@ -1,217 +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.math.impls.storage.matrix;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import org.apache.ignite.internal.util.GridUnsafe;
-import org.apache.ignite.ml.math.MatrixStorage;
-import org.apache.ignite.ml.math.StorageConstants;
-
-/**
- * Local, dense off-heap matrix storage.
- */
-public class DenseOffHeapMatrixStorage implements MatrixStorage {
-    /** */
-    private int rows;
-    /** */
-    private int cols;
-    /** */
-    private transient long ptr;
-    //TODO: IGNITE-5535, temp solution.
-    /** */
-    private int ptrInitHash;
-
-    /** */
-    public DenseOffHeapMatrixStorage() {
-        // No-op.
-    }
-
-    /**
-     * @param rows Amount of rows in the matrix.
-     * @param cols Amount of columns in the matrix.
-     */
-    public DenseOffHeapMatrixStorage(int rows, int cols) {
-        assert rows > 0;
-        assert cols > 0;
-
-        this.rows = rows;
-        this.cols = cols;
-
-        allocateMemory(rows, cols);
-    }
-
-    /**
-     * @param data Backing data array.
-     */
-    public DenseOffHeapMatrixStorage(double[][] data) {
-        assert data != null;
-        assert data[0] != null;
-
-        this.rows = data.length;
-        this.cols = data[0].length;
-
-        assert rows > 0;
-        assert cols > 0;
-
-        allocateMemory(rows, cols);
-
-        for (int i = 0; i < rows; i++)
-            for (int j = 0; j < cols; j++)
-                set(i, j, data[i][j]);
-    }
-
-    /** {@inheritDoc} */
-    @Override public double get(int x, int y) {
-        return GridUnsafe.getDouble(pointerOffset(x, y));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void set(int x, int y, double v) {
-        GridUnsafe.putDouble(pointerOffset(x, y), v);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int columnSize() {
-        return cols;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isSequentialAccess() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isDense() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isRandomAccess() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isDistributed() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int rowSize() {
-        return rows;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int storageMode() {
-        return StorageConstants.ROW_STORAGE_MODE;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int accessMode() {
-        return StorageConstants.RANDOM_ACCESS_MODE;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isArrayBased() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double[] data() {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeInt(rows);
-        out.writeInt(cols);
-        out.writeInt(ptrInitHash);
-
-        for (int i = 0; i < rows; i++)
-            for (int j = 0; j < cols; j++)
-                out.writeDouble(get(i, j));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        rows = in.readInt();
-        cols = in.readInt();
-
-        allocateMemory(rows, cols);
-
-        ptrInitHash = in.readInt();
-
-        for (int i = 0; i < rows; i++)
-            for (int j = 0; j < cols; j++)
-                set(i, j, in.readDouble());
-    }
-
-    /** {@inheritDoc} */
-    @Override public void destroy() {
-        GridUnsafe.freeMemory(ptr);
-    }
-
-    /** */
-    private long pointerOffset(int x, int y) {
-        return ptr + x * cols * Double.BYTES + y * Double.BYTES;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object obj) {
-        return obj != null &&
-            getClass().equals(obj.getClass()) &&
-            (rows == ((DenseOffHeapMatrixStorage)obj).rows) &&
-            (cols == ((DenseOffHeapMatrixStorage)obj).cols) &&
-            (rows == 0 || cols == 0 || ptr == ((DenseOffHeapMatrixStorage)obj).ptr || isMemoryEquals((DenseOffHeapMatrixStorage)obj));
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = 1;
-
-        res = res * 37 + rows;
-        res = res * 37 + cols;
-        res = res * 37 + ptrInitHash;
-
-        return res;
-    }
-
-    /** */
-    private boolean isMemoryEquals(DenseOffHeapMatrixStorage otherStorage) {
-        boolean res = true;
-
-        for (int i = 0; i < otherStorage.rows; i++) {
-            for (int j = 0; j < otherStorage.cols; j++) {
-                if (Double.compare(get(i, j), otherStorage.get(i, j)) != 0) {
-                    res = false;
-                    break;
-                }
-            }
-        }
-
-        return res;
-    }
-
-    /** */
-    private void allocateMemory(int rows, int cols) {
-        ptr = GridUnsafe.allocateMemory((long)rows * cols * Double.BYTES);
-
-        ptrInitHash = Long.hashCode(ptr);
-    }
-}
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/MapWrapperStorage.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/MapWrapperStorage.java
deleted file mode 100644 (file)
index 3a02e44..0000000
+++ /dev/null
@@ -1,120 +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.math.impls.storage.matrix;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.Map;
-import java.util.Set;
-import org.apache.ignite.internal.util.GridArgumentCheck;
-import org.apache.ignite.ml.math.VectorStorage;
-
-/**
- * Storage for wrapping given map.
- */
-public class MapWrapperStorage implements VectorStorage {
-    /** Underlying map. */
-    private Map<Integer, Double> data;
-
-    /** Vector size. */
-    private int size;
-
-    /**
-     * Construct a wrapper around given map.
-     *
-     * @param map Map to wrap.
-     */
-    public MapWrapperStorage(Map<Integer, Double> map) {
-        data = map;
-
-        Set<Integer> keys = map.keySet();
-
-        GridArgumentCheck.notEmpty(keys, "map");
-
-        Integer min = keys.stream().mapToInt(Integer::valueOf).min().getAsInt();
-        Integer max = keys.stream().mapToInt(Integer::valueOf).max().getAsInt();
-
-        assert min >= 0;
-
-        size = (max - min) + 1;
-    }
-
-    /**
-     * No-op constructor for serialization.
-     */
-    public MapWrapperStorage() {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public int size() {
-        return size;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double get(int i) {
-        return data.getOrDefault(i, 0.0);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void set(int i, double v) {
-        if (v != 0.0)
-            data.put(i, v);
-        else if (data.containsKey(i))
-            data.remove(i);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(data);
-        out.writeInt(size);
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        data = (Map<Integer, Double>)in.readObject();
-        size = in.readInt();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isSequentialAccess() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isRandomAccess() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isDense() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isArrayBased() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isDistributed() {
-        return false;
-    }
-}
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/package-info.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/package-info.java
deleted file mode 100644 (file)
index e0a760c..0000000
+++ /dev/null
@@ -1,22 +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 description. -->
- * Contains specific implementations for matrix storage models.
- */
-package org.apache.ignite.ml.math.impls.storage.matrix;
\ No newline at end of file
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/DenseLocalOffHeapVectorStorage.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/DenseLocalOffHeapVectorStorage.java
deleted file mode 100644 (file)
index 71b7793..0000000
+++ /dev/null
@@ -1,172 +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.math.impls.storage.vector;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.stream.IntStream;
-import org.apache.ignite.internal.util.GridUnsafe;
-import org.apache.ignite.ml.math.VectorStorage;
-
-/**
- * Local, dense off-heap vector storage.
- */
-public class DenseLocalOffHeapVectorStorage implements VectorStorage {
-    /** Vector size. */
-    private int size;
-
-    /** */
-    private transient long ptr;
-    //TODO: IGNITE-5535, temp solution.
-    /** */
-    private int ptrInitHash;
-
-    /**
-     *
-     */
-    public DenseLocalOffHeapVectorStorage() {
-        // No-op.
-    }
-
-    /**
-     * @param size Vector size.
-     */
-    public DenseLocalOffHeapVectorStorage(int size) {
-        assert size > 0;
-
-        this.size = size;
-
-        allocateMemory(size);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int size() {
-        return size;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double get(int i) {
-        return GridUnsafe.getDouble(pointerOffset(i));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void set(int i, double v) {
-        GridUnsafe.putDouble(pointerOffset(i), v);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isArrayBased() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double[] data() {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isSequentialAccess() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isDense() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isRandomAccess() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isDistributed() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeInt(size);
-        out.writeInt(ptrInitHash);
-
-        for (int i = 0; i < size; i++)
-            out.writeDouble(get(i));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        size = in.readInt();
-
-        allocateMemory(size);
-
-        ptrInitHash = in.readInt();
-
-        for (int i = 0; i < size; i++)
-            set(i, in.readDouble());
-    }
-
-    /** {@inheritDoc} */
-    @Override public void destroy() {
-        GridUnsafe.freeMemory(ptr);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = 1;
-
-        res = res * 37 + size;
-        res = res * 37 + ptrInitHash;
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object o) {
-        if (this == o)
-            return true;
-
-        if (o == null || getClass() != o.getClass())
-            return false;
-
-        DenseLocalOffHeapVectorStorage that = (DenseLocalOffHeapVectorStorage)o;
-
-        return size == that.size && isMemoryEquals(that);
-    }
-
-    /** */
-    private boolean isMemoryEquals(DenseLocalOffHeapVectorStorage otherStorage) {
-        return IntStream.range(0, size).parallel().noneMatch(idx -> Double.compare(get(idx), otherStorage.get(idx)) != 0);
-    }
-
-    /**
-     * Pointer offset for specific index.
-     *
-     * @param i Offset index.
-     */
-    private long pointerOffset(int i) {
-        return ptr + i * Double.BYTES;
-    }
-
-    /** */
-    private void allocateMemory(int size) {
-        ptr = GridUnsafe.allocateMemory(size * Double.BYTES);
-
-        ptrInitHash = Long.hashCode(ptr);
-    }
-}
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOffHeapVectorStorage.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOffHeapVectorStorage.java
deleted file mode 100644 (file)
index a858364..0000000
+++ /dev/null
@@ -1,153 +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.math.impls.storage.vector;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.nio.ByteBuffer;
-import org.apache.ignite.internal.util.offheap.GridOffHeapMap;
-import org.apache.ignite.internal.util.offheap.GridOffHeapMapFactory;
-import org.apache.ignite.ml.math.VectorStorage;
-import org.apache.ignite.ml.math.exceptions.UnsupportedOperationException;
-import org.apache.ignite.ml.math.impls.vector.SparseLocalOffHeapVector;
-
-/**
- * {@link VectorStorage} implementation for {@link SparseLocalOffHeapVector}.
- */
-public class SparseLocalOffHeapVectorStorage implements VectorStorage {
-    /** Assume 10% density. */
-    private static final int INIT_DENSITY = 10;
-
-    /** Storage capacity. */
-    private int size;
-
-    /** Local off heap map. */
-    private GridOffHeapMap gridOffHeapMap;
-
-    /** */
-    public SparseLocalOffHeapVectorStorage() {
-        //No-op.
-    }
-
-    /**
-     * @param cap Initial capacity.
-     */
-    public SparseLocalOffHeapVectorStorage(int cap) {
-        assert cap > 0;
-
-        gridOffHeapMap = GridOffHeapMapFactory.unsafeMap(cap / INIT_DENSITY);
-        size = cap;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int size() {
-        return size;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double get(int i) {
-        byte[] bytes = gridOffHeapMap.get(hash(i), intToByteArray(i));
-        return bytes == null ? 0 : ByteBuffer.wrap(bytes).getDouble();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void set(int i, double v) {
-        if (v != 0.0)
-            gridOffHeapMap.put(hash(i), intToByteArray(i), doubleToByteArray(v));
-        else if (gridOffHeapMap.contains(hash(i), intToByteArray(i)))
-            gridOffHeapMap.remove(hash(i), intToByteArray(i));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        throw new UnsupportedOperationException(); // TODO: IGNITE-5801, add externalization support.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        throw new UnsupportedOperationException();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isSequentialAccess() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isRandomAccess() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isDense() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isArrayBased() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isDistributed() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void destroy() {
-        gridOffHeapMap.destruct();
-    }
-
-    /** */
-    private int hash(int h) {
-        // Apply base step of MurmurHash; see http://code.google.com/p/smhasher/
-        // Despite two multiplies, this is often faster than others
-        // with comparable bit-spread properties.
-        h ^= h >>> 16;
-        h *= 0x85ebca6b;
-        h ^= h >>> 13;
-        h *= 0xc2b2ae35;
-
-        return (h >>> 16) ^ h;
-    }
-
-    /** */
-    private byte[] intToByteArray(int val) {
-        return new byte[] {
-            (byte)(val >>> 24),
-            (byte)(val >>> 16),
-            (byte)(val >>> 8),
-            (byte)val};
-    }
-
-    /** */
-    private byte[] doubleToByteArray(double val) {
-        long l = Double.doubleToRawLongBits(val);
-        return new byte[] {
-            (byte)((l >> 56) & 0xff),
-            (byte)((l >> 48) & 0xff),
-            (byte)((l >> 40) & 0xff),
-            (byte)((l >> 32) & 0xff),
-            (byte)((l >> 24) & 0xff),
-            (byte)((l >> 16) & 0xff),
-            (byte)((l >> 8) & 0xff),
-            (byte)((l) & 0xff),
-        };
-    }
-}
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/package-info.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/package-info.java
deleted file mode 100644 (file)
index a9825b3..0000000
+++ /dev/null
@@ -1,22 +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 description. -->
- * Contains specific implementations for vector storage models.
- */
-package org.apache.ignite.ml.math.impls.storage.vector;
\ No newline at end of file
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/DenseLocalOffHeapVector.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/DenseLocalOffHeapVector.java
deleted file mode 100644 (file)
index c635572..0000000
+++ /dev/null
@@ -1,89 +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.math.impls.vector;
-
-import java.util.stream.IntStream;
-import org.apache.ignite.ml.math.Matrix;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.impls.matrix.DenseLocalOffHeapMatrix;
-import org.apache.ignite.ml.math.impls.storage.vector.DenseLocalOffHeapVectorStorage;
-
-/**
- * Implementation for {@link Vector} assuming dense logic and local offheap JVM storage.
- * It is suitable for data sets where local, non-distributed execution is satisfactory and on-heap JVM storage
- * is not enough to keep the entire data set.
- */
-public class DenseLocalOffHeapVector extends AbstractVector {
-    /** */
-    public DenseLocalOffHeapVector() {
-        // No-op.
-    }
-
-    /** */
-    private void makeOffheapStorage(int size) {
-        setStorage(new DenseLocalOffHeapVectorStorage(size));
-    }
-
-    /**
-     * @param arr Array to copy to offheap storage.
-     */
-    public DenseLocalOffHeapVector(double[] arr) {
-        makeOffheapStorage(arr.length);
-
-        assign(arr);
-    }
-
-    /**
-     * @param size Vector cardinality.
-     */
-    public DenseLocalOffHeapVector(int size) {
-        makeOffheapStorage(size);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Vector assign(Vector vec) {
-        checkCardinality(vec);
-
-        IntStream.range(0, size()).parallel().forEach(idx -> set(idx, vec.get(idx)));
-
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Vector times(double x) {
-        if (x == 0.0)
-            return like(size()).assign(0);
-        else
-            return super.times(x);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Vector like(int crd) {
-        return new DenseLocalOffHeapVector(crd);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Matrix likeMatrix(int rows, int cols) {
-        return new DenseLocalOffHeapMatrix(rows, cols);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object o) {
-        return o != null && getClass().equals(o.getClass()) && (getStorage().equals(((Vector)o).getStorage()));
-    }
-}
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/MapWrapperVector.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/MapWrapperVector.java
deleted file mode 100644 (file)
index d79f98b..0000000
+++ /dev/null
@@ -1,54 +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.math.impls.vector;
-
-import java.util.Map;
-import org.apache.ignite.ml.math.Matrix;
-import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.impls.storage.matrix.MapWrapperStorage;
-
-/**
- * Vector wrapping a given map.
- */
-public class MapWrapperVector extends AbstractVector {
-    /**
-     * Construct a vector wrapping given map.
-     *
-     * @param map Map to wrap.
-     */
-    public MapWrapperVector(Map<Integer, Double> map) {
-        setStorage(new MapWrapperStorage(map));
-    }
-
-    /**
-     * No-op constructor for serialization.
-     */
-    public MapWrapperVector() {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override publi