├── .gitignore ├── .travis.yml ├── MIT-LICENSE.txt ├── Makefile ├── README.mkd ├── changes.mkd ├── docs ├── pca_outlier.png └── pca_outlier.svg ├── pom.xml └── src ├── main └── java │ └── com │ └── mkobos │ └── pca_transform │ ├── Assume.java │ ├── DataReader.java │ ├── PCA.java │ ├── SampleRun.java │ ├── covmatrixevd │ ├── CovarianceMatrixEVDCalculator.java │ ├── EVD.java │ ├── EVDBased.java │ ├── EVDResult.java │ ├── SVDBased.java │ └── package.html │ └── package.html └── test ├── java └── com │ └── mkobos │ └── pca_transform │ ├── DataReaderTest.java │ ├── EVDBasedPCATest.java │ ├── SVDBasedPCATest.java │ └── TemplatePCATest.java └── resources └── data ├── dim_reduction-artificial_data ├── all-non_outliers.csv ├── all-outliers.csv ├── all.csv ├── data_2d.csv ├── data_3d.csv ├── generate_sample_data.R └── no_dim_reduction.csv ├── dim_reduction-image_segmentation_data ├── built-in_rotated.csv ├── built-in_whitened.csv ├── eigen_rotated.csv ├── eigen_whitened.csv ├── image-segmentation-class1.csv └── make_pca.R ├── iris_data_set ├── built-in-iris_rotated.csv ├── built-in-iris_whitened.csv ├── built-in-other_rotated.csv ├── built-in-other_whitened.csv ├── eigen-iris_rotated.csv ├── eigen-iris_whitened.csv ├── eigen-other_rotated.csv ├── eigen-other_whitened.csv ├── iris-other.csv ├── iris.csv └── make_pca.R ├── iris_data_set_normalized ├── built-in-iris_rotated.csv ├── built-in-iris_whitened.csv ├── eigen-iris_rotated.csv ├── eigen-iris_whitened.csv ├── iris-normalized.csv ├── iris.csv └── make_pca.R └── no_of_samples_smaller_than_no_of_dims ├── built-in-rotated.csv ├── built-in-whitened.csv ├── data.csv ├── eigen-rotated.csv ├── eigen-whitened.csv └── make_pca.R /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /dist 3 | /lib 4 | /bin 5 | /.classpath 6 | /.project 7 | .idea 8 | pca_transform.iml 9 | /target/ 10 | README.html 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | -------------------------------------------------------------------------------- /MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2014 Mateusz Kobos 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ## This file contains couple of commands that help managing the project. 2 | ## 3 | ## Below you can find information about repositories where the project is deployed. The original information about destination repositories is available at http://central.sonatype.org/pages/ossrh-guide.html. 4 | 5 | ## Deploy the project to the snapshot repository. It will be deployed to the https://oss.sonatype.org/content/repositories/snapshots/ public repository. Note that the version string of the project must end with "-SNAPSHOT". 6 | deploy-snapshot: 7 | mvn clean deploy 8 | 9 | ## Deploy the project to the public repository containing release versions of the libraries. The public repository is available at https://oss.sonatype.org/content/repositories/releases/. This repository is synced with Maven's Central Repository. 10 | deploy-release: 11 | mvn clean deploy -P release 12 | 13 | ## Create HTML version of the README file 14 | readme-html: 15 | pandoc -N -t html -s --no-wrap --toc -o README.html README.mkd 16 | 17 | ## Compile the library and run sample program 18 | run-example: 19 | mvn clean install 20 | mvn dependency:copy-dependencies 21 | java -cp ./target/*:./target/dependency/* com.mkobos.pca_transform.SampleRun 22 | 23 | clean: 24 | mvn clean 25 | -------------------------------------------------------------------------------- /README.mkd: -------------------------------------------------------------------------------- 1 | Introduction 2 | ============ 3 | [![Build Status](https://travis-ci.org/mkobos/pca_transform.png?branch=master)](https://travis-ci.org/mkobos/pca_transform) 4 | 5 | This is a Java library that implements Principal Component Analysis (PCA) data transformation. It operates on data matrices where each row corresponds to a single real vector and each column corresponds to a single dimension. 6 | 7 | Features 8 | ======== 9 | The main use case of the library is to create a PCA transformation based on training data and then to apply it on test data. The library can perform two transformations on the test data: 10 | 11 | - **Rotation** -- the data matrix is transformed to get a diagonal covariance matrix. This transformation is sometimes simply called PCA. 12 | - **Whitening** -- the data matrix is transformed to get the unit covariance matrix. 13 | 14 | The method deals with situations where some **columns in the data matrix are linearly dependent** or when there are **more columns than rows in the data matrix** i.e. there are more dimensions than samples in the data set. In such cases, the method discards some output space dimensions, or in other words a transformation is generated where the output vectors have fewer dimensions than the input ones. To handle situations where the columns are _almost_ linearly dependent, we use a threshold parameter to discard dimensions with almost zero standard deviation; it set to a default value (`tol = sqrt(.Machine$double.eps)`) introduced in the help page of the `prcomp` function from the R statistical environment (see the part of the help page where the `tol` parameter is described). The `.Machine$double.eps` is the floating-point number machine precision from the R statistical environment (normally equal to `2.220446e-16`) 15 | 16 | The library can be also used to **check if given test point lies in the PCA-generated subspace**. If it does not, it means that it does not belong to the transformation domain and can be treated as an **outlier** (see Fig.1 for an illustration). Here, we use the following practical rule to decide if a vector belongs to the domain. If the vector belongs to the domain space, its non-significant components (those with standard deviation equal 0) should be zeroed by the matrix transformation; if they are not, we assume that the vector is an outlier. We use a somewhat ad-hoc threshold to check if the values are different from zero (if the absolute value is smaller than the threshold, it is assumed to be zero). The threshold is equal to `3 * sqrt(.Machine$double.eps) * sd(PC1)`, where `sqrt(.Machine$double.eps)` is a value mentioned in the previous paragraph and `sd(PC1)` is a standard deviation of the first principal component. 17 | 18 | ![](https://raw.githubusercontent.com/mkobos/pca_transform/master/docs/pca_outlier.png "An example of dimensionality reduction and outliers detection in PCA") 19 | 20 | **Fig.1**: An example of dimensionality reduction and outliers detection in PCA. On the left we have a situation before and on the right after the PCA transformation. The black dots correspond to two-dimensional samples from the training data set (situated on a single line) which are used to set the transformation parameters. The red point is an outlier point from the testing set, and the green point is a non-outlier point from the testing set. It can be seen that the two-dimensional samples from the training set are reduced to one-dimensional samples by the rotation transformation -- they all lay on the X axis now (their Y coordinate equals 0). The same goes for the green non-outlier point from the testing set. The red outlier point, on the other hand, does not have its Y coordinate equal 0. 21 | 22 | **Two methods of obtaining the transformation matrix** are implemented. The first is based on the SVD and the second is based on the eigenvalue decomposition. The first one as the one more numerically stable is used by default. 23 | 24 | Reliability 25 | =========== 26 | The default SVD-based version of the algorithm is checked to return the same results as the implementation of the PCA from the R statistical environment -- the `prcomp` function (see the unit tests in the source code). Some columns of the transformed testing data matrix might be multiplied by `-1` when compared with data returned by the R's `prcomp`. This is nothing to be worried about since both versions of the matrix are correct outputs of the PCA transformation and both are essentially equivalent as far as data processing applications are concerned. 27 | 28 | Example usage 29 | ============= 30 | Here is an example usage from one of the library's source files (`src/main/java/com/mkobos/pca_transform/SampleRun.java`): 31 | 32 | package com.mkobos.pca_transform; 33 | 34 | import Jama.Matrix; 35 | 36 | /** An example program using the library */ 37 | public class SampleRun { 38 | public static void main(String[] args){ 39 | System.out.println("Running a demonstration program on some sample data ..."); 40 | /** Training data matrix with each row corresponding to data point and 41 | * each column corresponding to dimension. */ 42 | Matrix trainingData = new Matrix(new double[][] { 43 | {1, 2, 3, 4, 5, 6}, 44 | {6, 5, 4, 3, 2, 1}, 45 | {2, 2, 2, 2, 2, 2}}); 46 | PCA pca = new PCA(trainingData); 47 | /** Test data to be transformed. The same convention of representing 48 | * data points as in the training data matrix is used. */ 49 | Matrix testData = new Matrix(new double[][] { 50 | {1, 2, 3, 4, 5, 6}, 51 | {1, 2, 1, 2, 1, 2}}); 52 | /** The transformed test data. */ 53 | Matrix transformedData = 54 | pca.transform(testData, PCA.TransformationType.WHITENING); 55 | System.out.println("Transformed data (each row corresponding to transformed data point):"); 56 | for(int r = 0; r < transformedData.getRowDimension(); r++){ 57 | for(int c = 0; c < transformedData.getColumnDimension(); c++){ 58 | System.out.print(transformedData.get(r, c)); 59 | if (c == transformedData.getColumnDimension()-1) continue; 60 | System.out.print(", "); 61 | } 62 | System.out.println(""); 63 | } 64 | } 65 | } 66 | 67 | This results in the following output: 68 | 69 | Running a demonstration program on some sample data ... 70 | Transformed data (each row corresponding to transformed data point): 71 | -0.9999999999999998, -0.5773502691896268 72 | -0.08571428571428596, 1.732050807568878 73 | 74 | This demonstration program can be run by executing the library's JAR file from the binary distribution package. 75 | 76 | How to get it 77 | ============= 78 | Since the library is deployed in Maven's [Central Repository](http://search.maven.org), if you use [Maven build system](http://maven.apache.org/), you can start using the library in your project after simply adding a **dependency in your Maven POM file** of the form of 79 | 80 | 81 | com.mkobos 82 | pca_transform 83 | XXX 84 | 85 | 86 | You can find the most current binary, source, and javadoc distributions of the library in Maven's [Central Repository](http://search.maven.org/#search|ga|1|pca_transform). 87 | 88 | The source can be also retrieved straight from the Git repository: `git clone git@github.com:mkobos/pca_transform.git`. 89 | 90 | License and conditions of use 91 | ============================= 92 | The library is available under permissive MIT license (see file `MIT-LICENSE.txt` file for the text of the license). 93 | -------------------------------------------------------------------------------- /changes.mkd: -------------------------------------------------------------------------------- 1 | 1.0 (2014-11-01) 2 | ================ 3 | - Migrating the project from Ant and Ivy to Maven build system - by Fredrik Bridell 4 | - Publishing the project in Maven's Central Repository - by Mateusz Kobos 5 | 6 | 0.8 (2013-06-21) 7 | ================ 8 | - Performing PCA on already centered data matrix - by Sean McKenna 9 | - Making the code conform more to the R `prcomp` function - by Sean McKenna 10 | 11 | 12 | 0.7 (2011-10-06) 13 | ================ 14 | - Extending the README 15 | 16 | 0.6 (2011-10-05) 17 | ================ 18 | - Initial commit 19 | 20 | -------------------------------------------------------------------------------- /docs/pca_outlier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkobos/pca_transform/0f73f443465eeae2d2131fc0da82a7cf7dc92bc2/docs/pca_outlier.png -------------------------------------------------------------------------------- /docs/pca_outlier.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 23 | 30 | 36 | 37 | 44 | 50 | 51 | 58 | 64 | 65 | 72 | 78 | 79 | 86 | 92 | 93 | 94 | 118 | 120 | 121 | 123 | image/svg+xml 124 | 126 | 127 | 128 | 129 | 130 | 135 | 140 | PCA rotation 151 | 164 | 169 | 174 | 175 | 180 | 192 | 204 | 216 | 228 | 240 | 252 | 264 | 276 | 288 | 300 | 312 | 324 | 336 | 339 | 344 | 349 | 350 | 362 | 374 | 386 | 398 | 410 | 422 | 434 | 446 | 458 | 470 | 482 | 494 | 506 | X 517 | Y 528 | X 539 | Y 550 | 551 | 552 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | com.mkobos 5 | pca_transform 6 | 1.1-SNAPSHOT 7 | jar 8 | ${project.groupId}:${project.artifactId} 9 | Library that implements Principal Component Analysis (PCA) data transformation 10 | https://github.com/mkobos/pca_transform 11 | 12 | 13 | MIT License 14 | http://www.opensource.org/licenses/mit-license.php 15 | repo 16 | 17 | 18 | 19 | git@github.com:mkobos/pca_transform 20 | scm:git:git://github.com/mkobos/pca_transform.git 21 | scm:git:git@github.com:mkobos/pca_transform.git 22 | 23 | 24 | 25 | mateusz@mkobos.com 26 | Mateusz Kobos 27 | https://github.com/mkobos 28 | mkobos 29 | 30 | 31 | 32 | 33 | gov.nist.math 34 | jama 35 | 1.0.2 36 | 37 | 38 | 39 | 40 | junit 41 | junit 42 | 4.11 43 | test 44 | 45 | 46 | 47 | 48 | ossrh 49 | https://oss.sonatype.org/content/repositories/snapshots 50 | 51 | 52 | 53 | 54 | 55 | 56 | maven-compiler-plugin 57 | 2.3.2 58 | 59 | 1.7 60 | 1.7 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | org.sonatype.plugins 69 | nexus-staging-maven-plugin 70 | 1.6.3 71 | true 72 | 73 | ossrh 74 | https://oss.sonatype.org/ 75 | true 76 | 77 | 78 | 79 | org.apache.maven.plugins 80 | maven-jar-plugin 81 | 82 | 83 | 84 | true 85 | com.mkobos.pca_transform.SampleRun 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | release 95 | 96 | 97 | 98 | org.apache.maven.plugins 99 | maven-source-plugin 100 | 2.2.1 101 | 102 | 103 | attach-sources 104 | 105 | jar-no-fork 106 | 107 | 108 | 109 | 110 | 111 | org.apache.maven.plugins 112 | maven-javadoc-plugin 113 | 2.9.1 114 | 115 | 116 | attach-javadocs 117 | 118 | jar 119 | 120 | 121 | 122 | 123 | 124 | org.apache.maven.plugins 125 | maven-gpg-plugin 126 | 1.5 127 | 128 | 129 | sign-artifacts 130 | verify 131 | 132 | sign 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /src/main/java/com/mkobos/pca_transform/Assume.java: -------------------------------------------------------------------------------- 1 | package com.mkobos.pca_transform; 2 | 3 | /** 4 | * A set of convenience assert-like methods that throw an exception if 5 | * given condition is not met. 6 | * @author Mateusz Kobos 7 | */ 8 | public class Assume { 9 | public static void assume(boolean expression){ 10 | assume(expression, ""); 11 | } 12 | 13 | public static void assume(boolean expression, String comment){ 14 | if(!expression){ 15 | throw new RuntimeException(comment); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/mkobos/pca_transform/DataReader.java: -------------------------------------------------------------------------------- 1 | package com.mkobos.pca_transform; 2 | 3 | import Jama.Matrix; 4 | 5 | import java.io.BufferedReader; 6 | import java.io.DataInputStream; 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | import java.io.InputStreamReader; 10 | import java.util.ArrayList; 11 | 12 | /** 13 | * Reads data matrix from a CSV file 14 | * 15 | * @author Mateusz Kobos 16 | * @author Fredrik Bridell 17 | */ 18 | public class DataReader { 19 | 20 | /** 21 | * Read data matrix from a CSV file. The first row (corresponding to the header) is ignored. 22 | * Some lines may be commented out by a '#' character. 23 | * 24 | * This is a convenience wrapper for {@link #read(BufferedReader br, boolean ignoreLastColumn)} 25 | * 26 | * @param inStream CSV file 27 | * @param ignoreLastColumn if True, the last column is ignored. This is helpful when the last 28 | * column corresponds to a class of a vector. 29 | * @return data matrix 30 | */ 31 | public static Matrix read(InputStream inStream, boolean ignoreLastColumn) 32 | throws IOException { 33 | DataInputStream in = new DataInputStream(inStream); 34 | BufferedReader br = new BufferedReader(new InputStreamReader(in)); 35 | return read(br, ignoreLastColumn); 36 | } 37 | 38 | 39 | /** 40 | * Read data matrix from a CSV file. The first row (corresponding to the header) is ignored. 41 | * Some lines may be commented out by a '#' character. 42 | * 43 | * @param br a BufferedReader for the CSV file 44 | * @param ignoreLastColumn if True, the last column is ignored. This is helpful when the last 45 | * column corresponds to a class of a vector. 46 | * @return data matrix 47 | */ 48 | public static Matrix read(BufferedReader br, boolean ignoreLastColumn) 49 | throws IOException { 50 | 51 | String line; 52 | int lineNo = 0; 53 | ArrayList vectors = new ArrayList(); 54 | while ((line = br.readLine()) != null) { 55 | lineNo++; 56 | /** Ignore the header line */ 57 | if (lineNo == 1) { 58 | continue; 59 | } 60 | /** Ignore the comments */ 61 | int commentIndex = line.indexOf('#'); 62 | if (commentIndex != -1) { 63 | line.substring(0, commentIndex); 64 | } 65 | line = line.trim(); 66 | /** Ignore empty lines */ 67 | if (line.length() == 0) { 68 | continue; 69 | } 70 | String[] elems = line.split(","); 71 | int elemsNo = elems.length; 72 | if (ignoreLastColumn) { 73 | elemsNo = elems.length - 1; 74 | } 75 | double[] vector = new double[elemsNo]; 76 | for (int i = 0; i < elemsNo; i++) { 77 | vector[i] = Double.parseDouble(elems[i]); 78 | } 79 | vectors.add(vector); 80 | } 81 | 82 | double[][] vectorsArray = new double[vectors.size()][]; 83 | for (int r = 0; r < vectors.size(); r++) { 84 | vectorsArray[r] = vectors.get(r); 85 | } 86 | Matrix m = new Matrix(vectorsArray); 87 | return m; 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/com/mkobos/pca_transform/PCA.java: -------------------------------------------------------------------------------- 1 | package com.mkobos.pca_transform; 2 | 3 | import Jama.Matrix; 4 | import com.mkobos.pca_transform.covmatrixevd.*; 5 | 6 | 7 | /** The class responsible mainly for preparing the PCA transformation parameters 8 | * based on training data and executing the actual transformation on test data. 9 | * @author Mateusz Kobos 10 | */ 11 | public final class PCA { 12 | /** Type of the possible data transformation. 13 | * ROTATION: rotate the data matrix to get a diagonal covariance matrix. 14 | * This transformation is sometimes simply called PCA. 15 | * WHITENING: rotate and scale the data matrix to get 16 | * the unit covariance matrix 17 | */ 18 | public enum TransformationType { ROTATION, WHITENING }; 19 | 20 | /** Whether the input data matrix should be centered. */ 21 | private final boolean centerMatrix; 22 | 23 | /** Number of input dimensions. */ 24 | private final int inputDim; 25 | 26 | private final Matrix whiteningTransformation; 27 | private final Matrix pcaRotationTransformation; 28 | private final Matrix v; 29 | /** Part of the original SVD vector that is responsible for transforming the 30 | * input data into a vector of zeros.*/ 31 | private final Matrix zerosRotationTransformation; 32 | private final Matrix d; 33 | private final double[] means; 34 | private final double threshold; 35 | 36 | /** Create the PCA transformation. Use the popular SVD method for internal 37 | * calculations 38 | * @param data data matrix used to compute the PCA transformation. 39 | * Rows of the matrix are the instances/samples, columns are dimensions. 40 | * It is assumed that the matrix is already centered. 41 | * */ 42 | public PCA(Matrix data){ 43 | this(data, new SVDBased(), true); 44 | } 45 | 46 | /** Create the PCA transformation. Use the popular SVD method for internal 47 | * calculations 48 | * @param data data matrix used to compute the PCA transformation. 49 | * Rows of the matrix are the instances/samples, columns are dimensions. 50 | * @param center should the data matrix be centered before doing the 51 | * calculations? 52 | * */ 53 | public PCA(Matrix data, boolean center){ 54 | this(data, new SVDBased(), center); 55 | } 56 | 57 | /** Create the PCA transformation. 58 | * @param data data matrix used to compute the PCA transformation. 59 | * Rows of the matrix are the instances/samples, columns are dimensions. 60 | * It is assumed that the matrix is already centered. 61 | * @param evdCalc method of computing eigenvalue decomposition of data's 62 | * covariance matrix 63 | * */ 64 | public PCA(Matrix data, CovarianceMatrixEVDCalculator evdCalc){ 65 | this(data, evdCalc, true); 66 | } 67 | 68 | /** Create the PCA transformation 69 | * @param data data matrix used to compute the PCA transformation. 70 | * Rows of the matrix are the instances/samples, columns are dimensions. 71 | * @param evdCalc method of computing eigenvalue decomposition of data's 72 | * covariance matrix 73 | * @param center should the data matrix be centered before doing the 74 | * calculations? 75 | */ 76 | public PCA(Matrix data, CovarianceMatrixEVDCalculator evdCalc, boolean center){ 77 | /** Determine if input matrix should be centered */ 78 | this.centerMatrix = center; 79 | /** Get the number of input dimensions. */ 80 | this.inputDim = data.getColumnDimension(); 81 | this.means = getColumnsMeans(data); 82 | 83 | Matrix centeredData = data; 84 | /** Center the data matrix columns about zero */ 85 | if(centerMatrix){ 86 | centeredData = shiftColumns(data, means); 87 | } 88 | //debugWrite(centeredData, "centeredData.csv"); 89 | 90 | EVDResult evd = evdCalc.run(centeredData); 91 | EVDWithThreshold evdT = new EVDWithThreshold(evd); 92 | /** Get only the values of the matrices that correspond to 93 | * standard deviations above the threshold*/ 94 | this.d = evdT.getDAboveThreshold(); 95 | this.v = evdT.getVAboveThreshold(); 96 | this.zerosRotationTransformation = evdT.getVBelowThreshold(); 97 | /** A 3-sigma-like ad-hoc rule */ 98 | this.threshold = 3*evdT.getThreshold(); 99 | 100 | //debugWrite(this.evd.v, "eigen-v.csv"); 101 | //debugWrite(this.evd.d, "eigen-d.csv"); 102 | 103 | Matrix sqrtD = sqrtDiagonalMatrix(d); 104 | Matrix scaling = inverseDiagonalMatrix(sqrtD); 105 | //debugWrite(scaling, "scaling.csv"); 106 | this.pcaRotationTransformation = v; 107 | this.whiteningTransformation = 108 | this.pcaRotationTransformation.times(scaling); 109 | } 110 | 111 | /** 112 | * @return matrix where eigenvectors are placed in columns 113 | */ 114 | public Matrix getEigenvectorsMatrix(){ 115 | return v; 116 | } 117 | 118 | /** 119 | * Get selected eigenvalue 120 | * @param dimNo dimension number corresponding to given eigenvalue 121 | */ 122 | public double getEigenvalue(int dimNo){ 123 | return d.get(dimNo, dimNo); 124 | } 125 | 126 | /** 127 | * Get number of dimensions of the input vectors 128 | */ 129 | public int getInputDimsNo(){ 130 | return inputDim; 131 | } 132 | 133 | /** 134 | * Get number of dimensions of the output vectors 135 | */ 136 | public int getOutputDimsNo(){ 137 | return v.getColumnDimension(); 138 | } 139 | 140 | /** 141 | * Execute selected transformation on given data. 142 | * @param data data to transform. Rows of the matrix are the 143 | * instances/samples, columns are dimensions. 144 | * If the original PCA data matrix was set to be centered, this 145 | * matrix will also be centered using the same parameters. 146 | * @param type transformation to apply 147 | * @return transformed data 148 | */ 149 | public Matrix transform(Matrix data, TransformationType type){ 150 | Matrix centeredData = data; 151 | if(centerMatrix){ 152 | centeredData = shiftColumns(data, means); 153 | } 154 | Matrix transformation = getTransformation(type); 155 | return centeredData.times(transformation); 156 | } 157 | 158 | /** 159 | * Check if given point lies in PCA-generated subspace. 160 | * If it does not, it means that the point doesn't belong 161 | * to the transformation domain i.e. it is an outlier. 162 | * @param pt point. If the original PCA data matrix was set to be centered, 163 | * this point will also be centered using the same parameters. 164 | * @return true iff the point lies on all principal axes 165 | */ 166 | public boolean belongsToGeneratedSubspace(Matrix pt){ 167 | Assume.assume(pt.getRowDimension()==1); 168 | Matrix centeredPt = pt; 169 | if(centerMatrix){ 170 | centeredPt = shiftColumns(pt, means); 171 | } 172 | Matrix zerosTransformedPt = centeredPt.times(zerosRotationTransformation); 173 | assert zerosTransformedPt.getRowDimension()==1; 174 | /** Check if all coordinates of the point were zeroed by the 175 | * transformation */ 176 | for(int c = 0; c < zerosTransformedPt.getColumnDimension(); c++) 177 | if(Math.abs(zerosTransformedPt.get(0, c)) > threshold) { 178 | return false; 179 | } 180 | return true; 181 | } 182 | 183 | /** 184 | * Function for JUnit testing purposes only 185 | * */ 186 | protected static Matrix calculateCovarianceMatrix(Matrix data){ 187 | double[] means = getColumnsMeans(data); 188 | Matrix centeredData = shiftColumns(data, means); 189 | return EVDBased.calculateCovarianceMatrixOfCenteredData( 190 | centeredData); 191 | } 192 | 193 | private Matrix getTransformation(TransformationType type){ 194 | switch(type){ 195 | case ROTATION: return pcaRotationTransformation; 196 | case WHITENING: return whiteningTransformation; 197 | default: throw new RuntimeException("Unknown enum type: "+type); 198 | } 199 | } 200 | 201 | private static Matrix shiftColumns(Matrix data, double[] shifts){ 202 | Assume.assume(shifts.length==data.getColumnDimension()); 203 | Matrix m = new Matrix( 204 | data.getRowDimension(), data.getColumnDimension()); 205 | for(int c = 0; c < data.getColumnDimension(); c++) 206 | for(int r = 0; r < data.getRowDimension(); r++) 207 | m.set(r, c, data.get(r, c) - shifts[c]); 208 | return m; 209 | } 210 | 211 | private static double[] getColumnsMeans(Matrix m){ 212 | double[] means = new double[m.getColumnDimension()]; 213 | for(int c = 0; c < m.getColumnDimension(); c++){ 214 | double sum = 0; 215 | for(int r = 0; r < m.getRowDimension(); r++) 216 | sum += m.get(r, c); 217 | means[c] = sum/m.getRowDimension(); 218 | } 219 | return means; 220 | } 221 | 222 | private static Matrix sqrtDiagonalMatrix(Matrix m){ 223 | assert m.getRowDimension()==m.getColumnDimension(); 224 | Matrix newM = new Matrix(m.getRowDimension(), m.getRowDimension()); 225 | for(int i = 0; i < m.getRowDimension(); i++) 226 | newM.set(i, i, Math.sqrt(m.get(i, i))); 227 | return newM; 228 | } 229 | 230 | private static Matrix inverseDiagonalMatrix(Matrix m){ 231 | assert m.getRowDimension()==m.getColumnDimension(); 232 | Matrix newM = new Matrix(m.getRowDimension(), m.getRowDimension()); 233 | for(int i = 0; i < m.getRowDimension(); i++) 234 | newM.set(i, i, 1/m.get(i, i)); 235 | return newM; 236 | } 237 | 238 | } 239 | 240 | /** 241 | * Version of the eigenvalue decomposition where values of standard deviations 242 | * (i.e. square roots of the eigenvalues) below a certain threshold are omitted. 243 | */ 244 | class EVDWithThreshold { 245 | /** Double machine precision in the R environment 246 | * (i.e. in the R environment: {@code .Machine$double.eps}) */ 247 | public static final double precision = 2.220446e-16; 248 | 249 | private final EVDResult evd; 250 | private final double threshold; 251 | 252 | /** 253 | * The tol parameter of the method assumes a default value equal to 254 | * {@code sqrt(.Machine$double.eps)} from the R environment. In the help 255 | * page of the R environment {@code prcomp} function 256 | * (see the paragraph on {@code tol} parameter) it is written that 257 | * in such setting we will "omit essentially constant components". */ 258 | public EVDWithThreshold(EVDResult evd){ 259 | this(evd, Math.sqrt(precision)); 260 | } 261 | /** 262 | * @param tol threshold parameter of the method - the same parameter 263 | * as used in R environment's `prcomp` function (see the paragraph on 264 | * {@code tol} parameter). */ 265 | public EVDWithThreshold(EVDResult evd, double tol){ 266 | this.evd = evd; 267 | this.threshold = firstComponentSD(evd)*tol; 268 | } 269 | 270 | private static double firstComponentSD(EVDResult evd){ 271 | return Math.sqrt(evd.d.get(0, 0)); 272 | } 273 | 274 | /** Magnitude below which components should be omitted. This parameter 275 | * corresponds to the one in the `prcomp` function from the R 276 | * environment (see the paragraph on {@code tol} parameter). 277 | * The components are omitted if their standard deviations are less than 278 | * or equal to {@code tol} (a parameter given in the constructor) times 279 | * the standard deviation of the first component. 280 | */ 281 | public double getThreshold(){ 282 | return threshold; 283 | } 284 | 285 | public Matrix getDAboveThreshold(){ 286 | int aboveThresholdElemsNo = getElementsNoAboveThreshold(); 287 | Matrix newD = evd.d.getMatrix(0, aboveThresholdElemsNo-1, 288 | 0, aboveThresholdElemsNo-1); 289 | return newD; 290 | } 291 | 292 | public Matrix getVAboveThreshold(){ 293 | return evd.v.getMatrix(0, evd.v.getRowDimension()-1, 294 | 0, getElementsNoAboveThreshold()-1); 295 | } 296 | 297 | public Matrix getVBelowThreshold(){ 298 | return evd.v.getMatrix(0, evd.v.getRowDimension()-1, 299 | getElementsNoAboveThreshold(), evd.v.getColumnDimension()-1); 300 | } 301 | 302 | private int getElementsNoAboveThreshold(){ 303 | for(int i = 0; i < evd.d.getColumnDimension(); i++){ 304 | double val = Math.sqrt(evd.d.get(i, i)); 305 | if(!(val > threshold)) return i; 306 | } 307 | return evd.d.getColumnDimension(); 308 | } 309 | } 310 | 311 | 312 | -------------------------------------------------------------------------------- /src/main/java/com/mkobos/pca_transform/SampleRun.java: -------------------------------------------------------------------------------- 1 | package com.mkobos.pca_transform; 2 | 3 | import Jama.Matrix; 4 | 5 | /** An example program using the library */ 6 | public class SampleRun { 7 | public static void main(String[] args){ 8 | System.out.println("Running a demonstration program on some sample data ..."); 9 | /** Training data matrix with each row corresponding to data point and 10 | * each column corresponding to dimension. */ 11 | Matrix trainingData = new Matrix(new double[][] { 12 | {1, 2, 3, 4, 5, 6}, 13 | {6, 5, 4, 3, 2, 1}, 14 | {2, 2, 2, 2, 2, 2}}); 15 | PCA pca = new PCA(trainingData); 16 | /** Test data to be transformed. The same convention of representing 17 | * data points as in the training data matrix is used. */ 18 | Matrix testData = new Matrix(new double[][] { 19 | {1, 2, 3, 4, 5, 6}, 20 | {1, 2, 1, 2, 1, 2}}); 21 | /** The transformed test data. */ 22 | Matrix transformedData = 23 | pca.transform(testData, PCA.TransformationType.WHITENING); 24 | System.out.println("Transformed data (each row corresponding to transformed data point):"); 25 | for(int r = 0; r < transformedData.getRowDimension(); r++){ 26 | for(int c = 0; c < transformedData.getColumnDimension(); c++){ 27 | System.out.print(transformedData.get(r, c)); 28 | if (c == transformedData.getColumnDimension()-1) continue; 29 | System.out.print(", "); 30 | } 31 | System.out.println(""); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/mkobos/pca_transform/covmatrixevd/CovarianceMatrixEVDCalculator.java: -------------------------------------------------------------------------------- 1 | package com.mkobos.pca_transform.covmatrixevd; 2 | 3 | import Jama.Matrix; 4 | 5 | /** Calculates eigenvalue decomposition of the covariance matrix of the 6 | * given data 7 | * @author Mateusz Kobos 8 | * */ 9 | public interface CovarianceMatrixEVDCalculator { 10 | /** Calculate covariance matrix of the given data 11 | * @param centeredData data matrix where rows are the instances/samples and 12 | * columns are dimensions. It has to be centered. 13 | */ 14 | public EVDResult run(Matrix centeredData); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/mkobos/pca_transform/covmatrixevd/EVD.java: -------------------------------------------------------------------------------- 1 | package com.mkobos.pca_transform.covmatrixevd; 2 | 3 | import Jama.EigenvalueDecomposition; 4 | import Jama.Matrix; 5 | 6 | import java.io.Serializable; 7 | import java.util.ArrayList; 8 | import java.util.Collections; 9 | 10 | /** 11 | * Eigenvalue decomposition with eigenvectors sorted according to corresponding 12 | * eigenvalues in a decreasing order. The eigenvalues in matrix {@code d} are 13 | * also sorted in the same way. This is the way the eigendecomposition 14 | * works in the R environment. 15 | * @author Mateusz Kobos 16 | */ 17 | public class EVD implements Serializable{ 18 | private static final long serialVersionUID = 1L; 19 | 20 | public final Matrix d; 21 | public final Matrix v; 22 | 23 | public EVD(Matrix m){ 24 | EigenvalueDecomposition evd = m.eig(); 25 | 26 | double[] diagonal = getDiagonal(evd.getD()); 27 | PermutationResult result= 28 | calculateNondecreasingPermutation(diagonal); 29 | int[] permutation = result.permutation; 30 | double[] newDiagonal = result.values; 31 | this.v = permutateColumns(evd.getV(), permutation); 32 | this.d = createDiagonalMatrix(newDiagonal); 33 | assert eigenvaluesAreNonIncreasing(this.d); 34 | } 35 | 36 | private static Matrix createDiagonalMatrix(double[] diagonal){ 37 | Matrix m = new Matrix(diagonal.length, diagonal.length); 38 | for(int i = 0; i < diagonal.length; i++) m.set(i, i, diagonal[i]); 39 | return m; 40 | } 41 | 42 | private static double[] getDiagonal(Matrix m){ 43 | assert m.getRowDimension()==m.getColumnDimension(); 44 | double[] diag = new double[m.getRowDimension()]; 45 | for(int i = 0; i < m.getRowDimension(); i++) 46 | diag[i] = m.get(i, i); 47 | return diag; 48 | } 49 | 50 | private static PermutationResult calculateNondecreasingPermutation( 51 | double[] vals){ 52 | ArrayList list = new ArrayList(); 53 | for(int i = 0; i < vals.length; i++) 54 | list.add(new ValuePlace(vals[i], i)); 55 | Collections.sort(list); 56 | double[] newVals = new double[vals.length]; 57 | int[] permutation = new int[vals.length]; 58 | for(int i = 0; i < vals.length; i++){ 59 | newVals[i] = list.get(i).value; 60 | permutation[i] = list.get(i).place; 61 | } 62 | return new PermutationResult(permutation, newVals); 63 | } 64 | 65 | private static Matrix permutateColumns(Matrix m, int[] permutation){ 66 | assert m.getColumnDimension()==permutation.length; 67 | 68 | Matrix newM = new Matrix(m.getRowDimension(), m.getColumnDimension()); 69 | for(int c = 0; c < newM.getColumnDimension(); c++){ 70 | int copyFrom = permutation[c]; 71 | for(int r = 0; r < newM.getRowDimension(); r++){ 72 | newM.set(r, c, m.get(r, copyFrom)); 73 | } 74 | } 75 | return newM; 76 | } 77 | 78 | private static boolean eigenvaluesAreNonIncreasing(Matrix d){ 79 | for(int i = 0; i < d.getRowDimension()-1; i++) 80 | if(d.get(i, i) < d.get(i+1, i+1)) return false; 81 | return true; 82 | } 83 | } 84 | 85 | class PermutationResult { 86 | public int[] permutation; 87 | public double[] values; 88 | 89 | public PermutationResult(int[] permutation, double[] values){ 90 | this.permutation = permutation; 91 | this.values = values; 92 | } 93 | } 94 | 95 | class ValuePlace implements Comparable{ 96 | public double value; 97 | public int place; 98 | 99 | public ValuePlace(double value, int place){ 100 | this.value = value; 101 | this.place = place; 102 | } 103 | 104 | /** 105 | * Reverse comparison values to make the sorting in descending order 106 | */ 107 | @Override 108 | public int compareTo(ValuePlace other) { 109 | if(this.value < other.value) return 1; 110 | if(this.value==other.value) return 0; 111 | return -1; 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/main/java/com/mkobos/pca_transform/covmatrixevd/EVDBased.java: -------------------------------------------------------------------------------- 1 | package com.mkobos.pca_transform.covmatrixevd; 2 | 3 | import com.mkobos.pca_transform.Assume; 4 | import Jama.Matrix; 5 | 6 | /** 7 | * Basic covariance matrix eigenvalue decomposition 8 | * @author Mateusz Kobos 9 | * 10 | */ 11 | public class EVDBased implements CovarianceMatrixEVDCalculator { 12 | 13 | @Override 14 | public EVDResult run(Matrix centeredData) { 15 | Matrix cov = calculateCovarianceMatrixOfCenteredData(centeredData); 16 | EVD evd = new EVD(cov); 17 | return new EVDResult(evd.d, evd.v); 18 | } 19 | 20 | /** 21 | * Calculate covariance matrix with an assumption that data matrix is 22 | * centered i.e. for each column i: x_i' = x_i - E(x_i) 23 | */ 24 | public static Matrix calculateCovarianceMatrixOfCenteredData(Matrix data){ 25 | Assume.assume(data.getRowDimension()>1, "Number of data samples is "+ 26 | data.getRowDimension()+", but it has to be >1 to compute "+ 27 | "covariances"); 28 | int dimsNo = data.getColumnDimension(); 29 | int samplesNo = data.getRowDimension(); 30 | Matrix m = new Matrix(dimsNo, dimsNo); 31 | for(int r = 0; r < dimsNo; r++) 32 | for(int c = r; c < dimsNo; c++){ 33 | double sum = 0; 34 | for(int i = 0; i < samplesNo; i++) 35 | sum += data.get(i, r)*data.get(i, c); 36 | m.set(r, c, sum/(samplesNo-1)); 37 | } 38 | for(int r = 0; r < dimsNo; r++) 39 | for(int c = 0; c < r; c++) m.set(r, c, m.get(c, r)); 40 | return m; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/mkobos/pca_transform/covmatrixevd/EVDResult.java: -------------------------------------------------------------------------------- 1 | package com.mkobos.pca_transform.covmatrixevd; 2 | 3 | import Jama.Matrix; 4 | 5 | /** 6 | * 7 | * @author Mateusz Kobos 8 | * 9 | */ 10 | public class EVDResult { 11 | public Matrix d; 12 | public Matrix v; 13 | 14 | public EVDResult(Matrix d, Matrix v) { 15 | this.d = d; 16 | this.v = v; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/mkobos/pca_transform/covmatrixevd/SVDBased.java: -------------------------------------------------------------------------------- 1 | package com.mkobos.pca_transform.covmatrixevd; 2 | 3 | import Jama.Matrix; 4 | import Jama.SingularValueDecomposition; 5 | 6 | 7 | /** 8 | * SVD-based covariance matrix eigenvalue decomposition 9 | * @author Mateusz Kobos 10 | * 11 | */ 12 | public class SVDBased implements CovarianceMatrixEVDCalculator{ 13 | @Override 14 | public EVDResult run(Matrix centeredData) { 15 | int m = centeredData.getRowDimension(); 16 | int n = centeredData.getColumnDimension(); 17 | SingularValueDecomposition svd = centeredData.svd(); 18 | double[] singularValues = svd.getSingularValues(); 19 | Matrix d = Matrix.identity(n, n); 20 | for(int i = 0; i < n; i++){ 21 | /** TODO: This is true according to SVD properties in my notes*/ 22 | double val; 23 | if(i < m) val = singularValues[i]; 24 | else val = 0; 25 | 26 | d.set(i, i, 1.0/(m-1) * Math.pow(val, 2)); 27 | } 28 | Matrix v = svd.getV(); 29 | return new EVDResult(d, v); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/mkobos/pca_transform/covmatrixevd/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | A package containing two different implementations of the data's covariance matrix eigenvalue decomposition. 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/main/java/com/mkobos/pca_transform/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | A library implementing Principal Component Analysis (PCA) data transformation; in majority of cases the only class that the library's user should be interested in is the {@link pca_transform.PCA} class. 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/test/java/com/mkobos/pca_transform/DataReaderTest.java: -------------------------------------------------------------------------------- 1 | package com.mkobos.pca_transform; 2 | 3 | import Jama.Matrix; 4 | 5 | import org.junit.Test; 6 | 7 | import java.io.BufferedReader; 8 | import java.io.FileReader; 9 | import java.io.IOException; 10 | 11 | import junit.framework.TestCase; 12 | 13 | /** 14 | * @author Fredrik Bridell 15 | * @author Mateusz Kobos 16 | */ 17 | public class DataReaderTest extends TestCase { 18 | @Test 19 | public void testReadingData() throws IOException { 20 | String resource = "target/test-classes/data/dim_reduction-artificial_data/data_2d.csv"; 21 | 22 | BufferedReader br = new BufferedReader(new FileReader(resource)); 23 | Matrix read = DataReader.read(br, false); 24 | 25 | assertNotNull(read); 26 | assertEquals(30, read.getRowDimension()); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/com/mkobos/pca_transform/EVDBasedPCATest.java: -------------------------------------------------------------------------------- 1 | package com.mkobos.pca_transform; 2 | 3 | import com.mkobos.pca_transform.covmatrixevd.EVDBased; 4 | 5 | import Jama.Matrix; 6 | 7 | import java.io.IOException; 8 | 9 | public class EVDBasedPCATest extends TemplatePCATest { 10 | 11 | public EVDBasedPCATest() { 12 | super(1e-8, new EVDBased()); 13 | } 14 | 15 | /** An example from 16 | * http://www.itl.nist.gov/div898/handbook/pmc/section5/pmc541.htm 17 | */ 18 | public void testCovarianceMatrix(){ 19 | Matrix data = new Matrix(new double[][] { 20 | {4.0, 2.0, .6}, 21 | {4.2, 2.1, .59}, 22 | {3.9, 2.0, .58}, 23 | {4.3, 2.1, .62}, 24 | {4.1, 2.2, .63}}); 25 | Matrix actual = PCA.calculateCovarianceMatrix(data); 26 | Matrix expected = new Matrix(new double[][] { 27 | {.025, .0075, .00175}, 28 | {.0075, .007, .00135}, 29 | {.00175, .00135, .00043}}); 30 | assertEquals(expected.getRowDimension(), actual.getRowDimension()); 31 | assertEquals(expected.getColumnDimension(), 32 | actual.getColumnDimension()); 33 | for(int r = 0; r < expected.getRowDimension(); r++) 34 | for(int c = 0; c < expected.getColumnDimension(); c++) 35 | assertEquals(expected.get(r, c), actual.get(r, c), .000000001); 36 | } 37 | 38 | public void testIris() throws IOException{ 39 | checkPCATransformation("data/iris_data_set/iris.csv", 40 | "data/iris_data_set/iris.csv", 41 | "data/iris_data_set/eigen-iris_rotated.csv", 42 | "data/iris_data_set/eigen-iris_whitened.csv"); 43 | checkPCATransformation("data/iris_data_set/iris.csv", 44 | "data/iris_data_set/iris-other.csv", 45 | "data/iris_data_set/eigen-other_rotated.csv", 46 | "data/iris_data_set/eigen-other_whitened.csv"); 47 | checkPCATransformation("data/iris_data_set_normalized/iris-normalized.csv", 48 | "data/iris_data_set_normalized/iris-normalized.csv", 49 | "data/iris_data_set_normalized/eigen-iris_rotated.csv", 50 | "data/iris_data_set_normalized/eigen-iris_whitened.csv", false); 51 | } 52 | 53 | public void testImageSegementationClass1() throws IOException{ 54 | checkPCATransformation( 55 | "data/dim_reduction-image_segmentation_data/image-segmentation-class1.csv", 56 | "data/dim_reduction-image_segmentation_data/image-segmentation-class1.csv", 57 | "data/dim_reduction-image_segmentation_data/eigen_rotated.csv", 58 | "data/dim_reduction-image_segmentation_data/eigen_whitened.csv"); 59 | } 60 | 61 | 62 | public void testOutliers() throws IOException{ 63 | checkOutliers("data/dim_reduction-artificial_data/all.csv", 64 | "data/dim_reduction-artificial_data/all-outliers.csv", 65 | "data/dim_reduction-artificial_data/all-non_outliers.csv"); 66 | } 67 | 68 | public void testDimsReduction() throws IOException{ 69 | checkDimsReduction("data/dim_reduction-artificial_data/all.csv", 6, 2); 70 | checkDimsReduction("data/dim_reduction-artificial_data/data_3d.csv", 3, 1); 71 | checkDimsReduction("data/dim_reduction-artificial_data/data_2d.csv", 2, 1); 72 | checkDimsReduction("data/dim_reduction-artificial_data/no_dim_reduction.csv", 2, 2); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/test/java/com/mkobos/pca_transform/SVDBasedPCATest.java: -------------------------------------------------------------------------------- 1 | package com.mkobos.pca_transform; 2 | 3 | import com.mkobos.pca_transform.covmatrixevd.SVDBased; 4 | 5 | import java.io.IOException; 6 | 7 | 8 | public class SVDBasedPCATest extends TemplatePCATest { 9 | 10 | public SVDBasedPCATest() { 11 | super(1e-12, new SVDBased()); 12 | } 13 | 14 | public void testIris() throws IOException{ 15 | checkPCATransformation("data/iris_data_set/iris.csv", 16 | "data/iris_data_set/iris.csv", 17 | "data/iris_data_set/built-in-iris_rotated.csv", 18 | "data/iris_data_set/built-in-iris_whitened.csv"); 19 | checkPCATransformation("data/iris_data_set/iris.csv", 20 | "data/iris_data_set/iris-other.csv", 21 | "data/iris_data_set/built-in-other_rotated.csv", 22 | "data/iris_data_set/built-in-other_whitened.csv"); 23 | checkPCATransformation("data/iris_data_set_normalized/iris-normalized.csv", 24 | "data/iris_data_set_normalized/iris-normalized.csv", 25 | "data/iris_data_set_normalized/built-in-iris_rotated.csv", 26 | "data/iris_data_set_normalized/built-in-iris_whitened.csv", false); 27 | } 28 | 29 | public void testImageSegementationClass1() throws IOException{ 30 | checkPCATransformation( 31 | "data/dim_reduction-image_segmentation_data/image-segmentation-class1.csv", 32 | "data/dim_reduction-image_segmentation_data/image-segmentation-class1.csv", 33 | "data/dim_reduction-image_segmentation_data/built-in_rotated.csv", 34 | "data/dim_reduction-image_segmentation_data/built-in_whitened.csv"); 35 | } 36 | 37 | 38 | public void testOutliers() throws IOException{ 39 | checkOutliers("data/dim_reduction-artificial_data/all.csv", 40 | "data/dim_reduction-artificial_data/all-outliers.csv", 41 | "data/dim_reduction-artificial_data/all-non_outliers.csv"); 42 | } 43 | 44 | public void testDimsReduction() throws IOException{ 45 | checkDimsReduction("data/dim_reduction-artificial_data/all.csv", 6, 2); 46 | checkDimsReduction("data/dim_reduction-artificial_data/data_3d.csv", 3, 1); 47 | checkDimsReduction("data/dim_reduction-artificial_data/data_2d.csv", 2, 1); 48 | checkDimsReduction("data/dim_reduction-artificial_data/no_dim_reduction.csv", 2, 2); 49 | } 50 | 51 | public void testNoOfSamplesSmallerThanNoOfDims() throws IOException { 52 | checkPCATransformation("data/no_of_samples_smaller_than_no_of_dims/data.csv", 53 | "data/no_of_samples_smaller_than_no_of_dims/data.csv", 54 | "data/no_of_samples_smaller_than_no_of_dims/built-in-rotated.csv", 55 | "data/no_of_samples_smaller_than_no_of_dims/built-in-whitened.csv"); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/test/java/com/mkobos/pca_transform/TemplatePCATest.java: -------------------------------------------------------------------------------- 1 | package com.mkobos.pca_transform; 2 | 3 | import com.mkobos.pca_transform.covmatrixevd.CovarianceMatrixEVDCalculator; 4 | 5 | import Jama.Matrix; 6 | 7 | import junit.framework.TestCase; 8 | 9 | import java.io.BufferedReader; 10 | import java.io.FileNotFoundException; 11 | import java.io.FileReader; 12 | import java.io.IOException; 13 | 14 | public abstract class TemplatePCATest extends TestCase { 15 | private final double precision; 16 | private final CovarianceMatrixEVDCalculator evdCalc; 17 | 18 | public TemplatePCATest(double precision, 19 | CovarianceMatrixEVDCalculator evdCalc){ 20 | this.precision = precision; 21 | this.evdCalc = evdCalc; 22 | } 23 | 24 | protected void checkPCATransformation(String trainingDataPath, 25 | String testingDataPath, 26 | String expectedRotatedDataPath, String expectedWhitenedDataPath) 27 | throws IOException{ 28 | checkPCATransformation(trainingDataPath, testingDataPath, 29 | expectedRotatedDataPath, expectedWhitenedDataPath, true); 30 | } 31 | 32 | protected void checkPCATransformation(String trainingDataPath, 33 | String testingDataPath, 34 | String expectedRotatedDataPath, String expectedWhitenedDataPath, 35 | boolean center) 36 | throws IOException{ 37 | Matrix training = DataReader.read(getFile(trainingDataPath), false); 38 | Matrix testing = DataReader.read(getFile(testingDataPath), false); 39 | Matrix expectedRotated = DataReader.read( 40 | getFile(expectedRotatedDataPath), false); 41 | PCA pca = createPCA(training, center); 42 | Matrix actualRotated = 43 | pca.transform(testing, PCA.TransformationType.ROTATION); 44 | assertTrue(equalColumnsWithSignAccuracy( 45 | expectedRotated, actualRotated, precision)); 46 | Matrix expectedWhitened = DataReader.read( 47 | getFile(expectedWhitenedDataPath), false); 48 | Matrix actualWhitened = 49 | pca.transform(testing, PCA.TransformationType.WHITENING); 50 | assertTrue(equalColumnsWithSignAccuracy( 51 | expectedWhitened, actualWhitened, precision)); 52 | } 53 | 54 | protected void checkOutliers(String allDataFile, 55 | String outliersDataFile, String nonOutliersDataFile) throws IOException{ 56 | Matrix pts = DataReader.read(getFile(allDataFile), false); 57 | PCA pca = createPCA(pts, true); 58 | Matrix outliers = DataReader.read(getFile(outliersDataFile), false); 59 | for(int r = 0; r < outliers.getRowDimension(); r++){ 60 | Matrix vector = outliers.getMatrix( 61 | r, r, 0, outliers.getColumnDimension()-1); 62 | assertFalse(pca.belongsToGeneratedSubspace(vector)); 63 | } 64 | Matrix nonOutliers = DataReader.read( 65 | getFile(nonOutliersDataFile), false); 66 | for(int r = 0; r < nonOutliers.getRowDimension(); r++){ 67 | Matrix vector = nonOutliers.getMatrix( 68 | r, r, 0, nonOutliers.getColumnDimension()-1); 69 | assertTrue(pca.belongsToGeneratedSubspace(vector)); 70 | } 71 | } 72 | 73 | protected void checkDimsReduction(String filePath, int inputDimsNo, 74 | int outputDimsNo) throws IOException{ 75 | Matrix pts = DataReader.read(getFile(filePath), false); 76 | PCA pca = createPCA(pts, true); 77 | assertEquals(inputDimsNo, pca.getInputDimsNo()); 78 | assertEquals(outputDimsNo, pca.getOutputDimsNo()); 79 | } 80 | 81 | 82 | protected BufferedReader getFile(String filePath) throws FileNotFoundException { 83 | BufferedReader br = new BufferedReader(new FileReader("target/test-classes/" + filePath)); 84 | return br; 85 | } 86 | 87 | private static boolean equalColumnsWithSignAccuracy( 88 | Matrix expected, Matrix actual, double precision){ 89 | if(expected.getColumnDimension() != actual.getColumnDimension() || 90 | expected.getRowDimension() != actual.getRowDimension()) 91 | return false; 92 | for(int c = 0; c < expected.getColumnDimension(); c++){ 93 | Matrix expectedColumn = expected.getMatrix( 94 | 0, expected.getRowDimension()-1, c, c); 95 | Matrix actualColumn = actual.getMatrix( 96 | 0, expected.getRowDimension()-1, c, c); 97 | Matrix negatedActualColumn = actualColumn.times(-1); 98 | if(!(areEqual(expectedColumn, actualColumn, precision) || 99 | areEqual(expectedColumn, negatedActualColumn, precision))) 100 | return false; 101 | } 102 | return true; 103 | } 104 | 105 | private static boolean areEqual(Matrix m0, Matrix m1, 106 | double precision){ 107 | if(m0.getColumnDimension() != m1.getColumnDimension() || 108 | m0.getRowDimension() != m1.getRowDimension()) 109 | return false; 110 | for(int c = 0; c < m0.getColumnDimension(); c++){ 111 | for(int r = 0; r < m0.getRowDimension(); r++){ 112 | if(Math.abs(m0.get(r, c) - m1.get(r, c)) > precision) 113 | return false; 114 | } 115 | } 116 | return true; 117 | } 118 | 119 | private PCA createPCA(Matrix pts, boolean center){ 120 | return new PCA(pts, evdCalc, center); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/test/resources/data/dim_reduction-artificial_data/all-non_outliers.csv: -------------------------------------------------------------------------------- 1 | "x1","x2","x3","x4","x5","x6" 2 | 1,5,-0.6,2,-2,0 3 | 2,7,-0.2,1,-2.8,-2.5 4 | -------------------------------------------------------------------------------- /src/test/resources/data/dim_reduction-artificial_data/all-outliers.csv: -------------------------------------------------------------------------------- 1 | "x1","x2","x3","x4","x5","x6" 2 | 3,5,-0.6,2,-2,0 3 | 1,10,-0.1,-1,-1.8,-6.5 4 | 0.4,3.8,-0.84,0.7,-1.519,-3.25 5 | -------------------------------------------------------------------------------- /src/test/resources/data/dim_reduction-artificial_data/all.csv: -------------------------------------------------------------------------------- 1 | "x1","x2","x3","x4","x5","x6" 2 | 0.349385318367024,3.69877063673405,-0.86024587265319,0.688534356294212,-1.47950825469362,-3.27866410926447 3 | 0.392176099636105,3.78435219927221,-0.843129560145558,1.78300945789929,-1.51374087970888,-0.542476355251776 4 | -0.407677792703622,2.18464441459276,-1.16307111708145,1.35295996243974,-0.873857765837103,-1.61760009390064 5 | 1.60400072206693,6.20800144413386,-0.358399711173228,-0.261833812066837,-2.48320057765354,-5.65458453016709 6 | 1.72603621289585,6.4520724257917,-0.309585514841661,0.374466582676190,-2.58082897031668,-4.06383354330953 7 | -0.529477283285522,1.94104543342896,-1.21179091331421,1.32065618213299,-0.776418173371583,-1.69835954466752 8 | -1.36326117390933,0.273477652181332,-1.54530446956373,-0.377953721895027,-0.109391060872533,-5.94488430473757 9 | 0.0142393481132536,3.02847869622651,-0.994304260754699,-1.18015504918993,-1.21139147849060,-7.95038762297483 10 | -0.481901054644548,2.03619789071090,-1.19276042185782,-0.272304156239692,-0.814479156284362,-5.68076039059923 11 | -1.7349328700158,-0.469865740031599,-1.69397314800632,0.0924516226274897,0.187946296012640,-4.76887094343128 12 | -0.901499395554696,1.19700120889061,-1.36059975822188,0.136398823263255,-0.478800483556243,-4.65900294184186 13 | -0.684515734020765,1.63096853195847,-1.27380629360831,0.607443181636655,-0.652387412783388,-3.48139204590836 14 | -1.30267391535622,0.394652169287558,-1.52106956614249,-0.489423180204475,-0.157860867715023,-6.22355795051119 15 | 1.72935138692620,6.45870277385239,-0.308259445229522,-0.597827058741928,-2.58348110954096,-6.49456764685482 16 | 0.990665279361403,4.98133055872281,-0.603733888255439,-0.514658870649396,-1.99253222348912,-6.28664717662349 17 | 0.76937759240585,4.5387551848117,-0.69224896303766,-0.460347454635092,-1.81550207392468,-6.15086863658773 18 | -0.730426086039635,1.53914782792073,-1.29217043441585,0.499495788973616,-0.615659131168292,-3.75126052756596 19 | 0.206956447688634,3.41391289537727,-0.917217420924547,2.57878951274916,-1.36556515815091,1.44697378187290 20 | 0.00896670165173385,3.01793340330347,-0.996413319339306,-0.465648225682434,-1.20717336132139,-6.16412056420609 21 | -0.859763400544974,1.28047319891005,-1.34390536021799,-0.232343799513405,-0.512189279564021,-5.58085949878351 22 | 0.201876567922115,3.40375313584423,-0.919249372831154,1.87298830357119,-1.36150125433769,-0.317529241072034 23 | 1.64237400143539,6.28474800287077,-0.343050399425845,1.52653873612122,-2.51389920114831,-1.18365315969694 24 | 1.13254086883659,5.26508173767318,-0.546983652465364,1.72535836875372,-2.10603269506927,-0.6866040781157 25 | -0.309595353686807,2.38080929262639,-1.12383814147472,0.576350332430038,-0.952323717050554,-3.55912416892490 26 | -0.393091120102992,2.21381775979402,-1.15723644804120,-1.15042490588801,-0.885527103917606,-7.87606226472004 27 | -1.05091462280377,0.898170754392464,-1.42036584912151,0.456732951985855,-0.359268301756986,-3.85816762003536 28 | 0.512233480949799,4.0244669618996,-0.79510660762008,0.894748289136269,-1.60978678475984,-2.76312927715933 29 | 1.49632807727881,5.99265615455761,-0.401468769088477,1.74100265969223,-2.39706246182305,-0.647493350769416 30 | 0.860287402107774,4.72057480421555,-0.65588503915689,0.157578689133965,-1.88822992168622,-4.60605327716509 31 | 0.967929395273516,4.93585879054703,-0.612828241890594,-0.458446992457457,-1.97434351621881,-6.14611748114364 32 | -------------------------------------------------------------------------------- /src/test/resources/data/dim_reduction-artificial_data/data_2d.csv: -------------------------------------------------------------------------------- 1 | "x1","x2" 2 | 0.349385318367024,3.69877063673405 3 | 0.392176099636105,3.78435219927221 4 | -0.407677792703622,2.18464441459276 5 | 1.60400072206693,6.20800144413386 6 | 1.72603621289585,6.4520724257917 7 | -0.529477283285522,1.94104543342896 8 | -1.36326117390933,0.273477652181332 9 | 0.0142393481132536,3.02847869622651 10 | -0.481901054644548,2.03619789071090 11 | -1.7349328700158,-0.469865740031599 12 | -0.901499395554696,1.19700120889061 13 | -0.684515734020765,1.63096853195847 14 | -1.30267391535622,0.394652169287558 15 | 1.72935138692620,6.45870277385239 16 | 0.990665279361403,4.98133055872281 17 | 0.76937759240585,4.5387551848117 18 | -0.730426086039635,1.53914782792073 19 | 0.206956447688634,3.41391289537727 20 | 0.00896670165173385,3.01793340330347 21 | -0.859763400544974,1.28047319891005 22 | 0.201876567922115,3.40375313584423 23 | 1.64237400143539,6.28474800287077 24 | 1.13254086883659,5.26508173767318 25 | -0.309595353686807,2.38080929262639 26 | -0.393091120102992,2.21381775979402 27 | -1.05091462280377,0.898170754392464 28 | 0.512233480949799,4.0244669618996 29 | 1.49632807727881,5.99265615455761 30 | 0.860287402107774,4.72057480421555 31 | 0.967929395273516,4.93585879054703 32 | -------------------------------------------------------------------------------- /src/test/resources/data/dim_reduction-artificial_data/data_3d.csv: -------------------------------------------------------------------------------- 1 | "x1","x2","x3" 2 | 0.349385318367024,3.69877063673405,-0.86024587265319 3 | 0.392176099636105,3.78435219927221,-0.843129560145558 4 | -0.407677792703622,2.18464441459276,-1.16307111708145 5 | 1.60400072206693,6.20800144413386,-0.358399711173228 6 | 1.72603621289585,6.4520724257917,-0.309585514841661 7 | -0.529477283285522,1.94104543342896,-1.21179091331421 8 | -1.36326117390933,0.273477652181332,-1.54530446956373 9 | 0.0142393481132536,3.02847869622651,-0.994304260754699 10 | -0.481901054644548,2.03619789071090,-1.19276042185782 11 | -1.7349328700158,-0.469865740031599,-1.69397314800632 12 | -0.901499395554696,1.19700120889061,-1.36059975822188 13 | -0.684515734020765,1.63096853195847,-1.27380629360831 14 | -1.30267391535622,0.394652169287558,-1.52106956614249 15 | 1.72935138692620,6.45870277385239,-0.308259445229522 16 | 0.990665279361403,4.98133055872281,-0.603733888255439 17 | 0.76937759240585,4.5387551848117,-0.69224896303766 18 | -0.730426086039635,1.53914782792073,-1.29217043441585 19 | 0.206956447688634,3.41391289537727,-0.917217420924547 20 | 0.00896670165173385,3.01793340330347,-0.996413319339306 21 | -0.859763400544974,1.28047319891005,-1.34390536021799 22 | 0.201876567922115,3.40375313584423,-0.919249372831154 23 | 1.64237400143539,6.28474800287077,-0.343050399425845 24 | 1.13254086883659,5.26508173767318,-0.546983652465364 25 | -0.309595353686807,2.38080929262639,-1.12383814147472 26 | -0.393091120102992,2.21381775979402,-1.15723644804120 27 | -1.05091462280377,0.898170754392464,-1.42036584912151 28 | 0.512233480949799,4.0244669618996,-0.79510660762008 29 | 1.49632807727881,5.99265615455761,-0.401468769088477 30 | 0.860287402107774,4.72057480421555,-0.65588503915689 31 | 0.967929395273516,4.93585879054703,-0.612828241890594 32 | -------------------------------------------------------------------------------- /src/test/resources/data/dim_reduction-artificial_data/generate_sample_data.R: -------------------------------------------------------------------------------- 1 | get.coordinates <- function(x1, x4){ 2 | x2 <- 2*x1+3 3 | x3 <- 0.4*x1-1 4 | x5 <- -0.4*x2 5 | x6 <- 2.5*x4-5 6 | return(data.frame(x1=x1, x2=x2, x3=x3, x4=x4, x5=x5, x6=x6)) 7 | } 8 | 9 | outlier1 <- get.coordinates(1, 2) 10 | outlier1$x2 <- outlier1$x2+2 11 | outlier2 <- get.coordinates(2, 1) 12 | outlier2$x2 <- outlier2$x2+3 13 | outlier2$x3 <- outlier2$x3+0.1 14 | outlier2$x5 <- outlier2$x5+1 15 | outlier2$x6 <- outlier2$x6-4 16 | outlier.small <- get.coordinates(0.4, 0.7) 17 | outlier.small$x5 <- outlier.small$x5+0.001 18 | all.outliers <- rbind(outlier1, outlier2, outlier.small) 19 | write.csv(all.outliers, "all-outliers.csv", row.names=FALSE) 20 | 21 | non.outliers <- get.coordinates(c(1, 2), c(2, 1)) 22 | write.csv(non.outliers, "all-non_outliers.csv", row.names=FALSE) 23 | 24 | all <- get.coordinates(rnorm(30), rnorm(30)) 25 | write.csv(all, "all.csv", row.names=FALSE) 26 | data.3d <- subset(all, select=c(x1, x2, x3)) 27 | write.csv(data.3d, "data_3d.csv", row.names=FALSE) 28 | data.2d <- subset(all, select=c(x1, x2)) 29 | write.csv(data.2d, "data_2d.csv", row.names=FALSE) 30 | no.reduction <- subset(all, select=c(x2, x4)) 31 | write.csv(no.reduction, "no_dim_reduction.csv", row.names=FALSE) 32 | -------------------------------------------------------------------------------- /src/test/resources/data/dim_reduction-artificial_data/no_dim_reduction.csv: -------------------------------------------------------------------------------- 1 | "x2","x4" 2 | 3.69877063673405,0.688534356294212 3 | 3.78435219927221,1.78300945789929 4 | 2.18464441459276,1.35295996243974 5 | 6.20800144413386,-0.261833812066837 6 | 6.4520724257917,0.374466582676190 7 | 1.94104543342896,1.32065618213299 8 | 0.273477652181332,-0.377953721895027 9 | 3.02847869622651,-1.18015504918993 10 | 2.03619789071090,-0.272304156239692 11 | -0.469865740031599,0.0924516226274897 12 | 1.19700120889061,0.136398823263255 13 | 1.63096853195847,0.607443181636655 14 | 0.394652169287558,-0.489423180204475 15 | 6.45870277385239,-0.597827058741928 16 | 4.98133055872281,-0.514658870649396 17 | 4.5387551848117,-0.460347454635092 18 | 1.53914782792073,0.499495788973616 19 | 3.41391289537727,2.57878951274916 20 | 3.01793340330347,-0.465648225682434 21 | 1.28047319891005,-0.232343799513405 22 | 3.40375313584423,1.87298830357119 23 | 6.28474800287077,1.52653873612122 24 | 5.26508173767318,1.72535836875372 25 | 2.38080929262639,0.576350332430038 26 | 2.21381775979402,-1.15042490588801 27 | 0.898170754392464,0.456732951985855 28 | 4.0244669618996,0.894748289136269 29 | 5.99265615455761,1.74100265969223 30 | 4.72057480421555,0.157578689133965 31 | 4.93585879054703,-0.458446992457457 32 | -------------------------------------------------------------------------------- /src/test/resources/data/dim_reduction-image_segmentation_data/make_pca.R: -------------------------------------------------------------------------------- 1 | ## Samples belonging to "brickface" class of the "Image segmentation" data. 2 | ## Taken from http://archive.ics.uci.edu/ml/datasets/Statlog+(Image+Segmentation) 3 | data <- read.csv("image-segmentation-class1.csv", check.names=FALSE) 4 | 5 | data.means <- mean(data) 6 | data.centered <- list() 7 | for(c in seq(1:ncol(data))){ 8 | data.centered[[paste("x", c, sep="")]] <- data[[c]] - data.means[[c]] 9 | } 10 | data.centered <- as.data.frame(data.centered) 11 | 12 | ## default implementation of the PCA based on SVD{ 13 | 14 | ## PCA executed with paramter `tol` responsible for omitting dimensions with 15 | ## almost zero standard deviation set to a value proposed in the help 16 | ## page of the `prcomp` function. 17 | pca <- prcomp(data, tol=sqrt(.Machine$double.eps)) 18 | pca.no.reduction <- prcomp(data) 19 | pca.rotation <- t(pca$rotation) 20 | pca.data.rotated <- t(pca.rotation%*%t(data.centered)) 21 | pca.data.whitened <- apply(pca.data.rotated, 2, 22 | function(col){ return(col/sd(col)) }) 23 | write.csv(pca.data.rotated, "built-in_rotated.csv", row.names=FALSE) 24 | write.csv(pca.data.whitened, "built-in_whitened.csv", row.names=FALSE) 25 | 26 | 27 | pca.no.reduction.sd <- pca.no.reduction$sd[pca.no.reduction$sd > pca.no.reduction$sd[1]*sqrt(.Machine$double.eps)] 28 | ## default implementation of the PCA based on SVD} 29 | 30 | 31 | ## my PCA implementation based on eigenvalue decomposition { 32 | data.cov <- cov(data) 33 | eigen.dec <- eigen(data.cov, TRUE) 34 | 35 | ## dimensionality reduction method corresponding to the method used in 36 | ## `prcomp` function 37 | eigen.sd.raw <- sqrt(eigen.dec$values) 38 | threshold <- eigen.sd.raw[1]*sqrt(.Machine$double.eps) 39 | dims.left <- length(eigen.sd.raw[eigen.sd.raw > threshold]) 40 | if(dims.left!=14) stop("This wasn't expected") 41 | 42 | eigen.v.reduced <- eigen.dec$vectors[, 1:dims.left] 43 | eigen.d.reduced <- eigen.dec$values[1:dims.left] 44 | eigen.sd <- sqrt(eigen.d.reduced) 45 | 46 | eigen.rotation <- t(eigen.v.reduced) 47 | eigen.scaling <- diag(1/(sqrt(eigen.d.reduced))) 48 | 49 | #eigen.rotation.raw <- t(eigen.dec$vectors) 50 | #eigen.scaling.raw <- diag(1/(sqrt(eigen.dec$values))) 51 | 52 | 53 | ## my PCA implementation based on eigenvalue decomposition } 54 | 55 | transform.data <- function(means, eigen.rotation, eigen.scaling, data){ 56 | data.centered <- list() 57 | for(c in seq(1:ncol(data))){ 58 | data.centered[[paste("x", c, sep="")]] <- data[[c]] - means[[c]] 59 | } 60 | data.centered <- as.data.frame(data.centered) 61 | rotated <- t(eigen.rotation%*%t(data.centered)) 62 | whitened <- t(eigen.scaling%*%eigen.rotation%*%t(data.centered)) 63 | return(list(rotated=rotated, whitened=whitened)) 64 | } 65 | 66 | data.transformed <- transform.data(data.means, eigen.rotation, eigen.scaling, 67 | data) 68 | 69 | data.rotated <- data.transformed$rotated 70 | write.csv(data.rotated, "eigen_rotated.csv", row.names=FALSE) 71 | data.whitened <- data.transformed$whitened 72 | write.csv(data.whitened, "eigen_whitened.csv", row.names=FALSE) 73 | summary(data.whitened) 74 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set/built-in-iris_rotated.csv: -------------------------------------------------------------------------------- 1 | "PC1","PC2","PC3","PC4" 2 | -2.68412562596953,-0.319397246585102,0.0279148275894137,0.00226243707131613 3 | -2.71414168729432,0.177001225064780,0.210464272378244,0.0990265503235855 4 | -2.88899056905929,0.144949426085557,-0.0179002563208901,0.0199683897090281 5 | -2.74534285564141,0.318298979251916,-0.0315593736056811,-0.0755758166136834 6 | -2.72871653655453,-0.326754512934921,-0.0900792405512013,-0.0612585925856941 7 | -2.28085963284449,-0.741330449062916,-0.168677658209105,-0.0242008575695235 8 | -2.82053775074061,0.0894613845285683,-0.257892158255618,-0.0481431064876537 9 | -2.62614497314663,-0.163384959698329,0.0218793178867195,-0.0452978705519318 10 | -2.88638273178055,0.578311754186703,-0.0207595702647800,-0.0267447357617892 11 | -2.67275579782095,0.113774245874116,0.197632724988146,-0.0562954012688952 12 | -2.50694709065185,-0.645068898648575,0.07531800937912,-0.0150199244901802 13 | -2.61275523090872,-0.0147299391613751,-0.10215025995659,-0.156379207832191 14 | -2.78610926618802,0.235112000201718,0.206844430449644,-0.00788791149321666 15 | -3.22380374386565,0.511394587006382,-0.0612996724570991,-0.021679811846814 16 | -2.64475038994203,-1.17876463643758,0.151627523617809,0.159209717669961 17 | -2.38603903353113,-1.33806233040065,-0.277776902703136,0.0065515458675317 18 | -2.62352787522442,-0.810679514181258,-0.138183227880719,0.167734737228330 19 | -2.64829670625438,-0.311849144593355,-0.0266683156125939,0.0776281795977208 20 | -2.19982032361758,-0.872839038962212,0.120305523394731,0.0270518681418772 21 | -2.58798639987877,-0.513560308749277,-0.213665172224716,-0.066272650201581 22 | -2.31025621524252,-0.391345935653895,0.239444043244953,-0.0150707907892687 23 | -2.54370522875715,-0.432996063279029,-0.208457232416715,0.0410654026914363 24 | -3.21593941564861,-0.133468069538526,-0.292396750745242,0.00448212505056944 25 | -2.30273318222620,-0.0987088548141,-0.0391232587428806,0.148352589285365 26 | -2.35575404912377,0.0372818596773819,-0.125021082702879,-0.300330903930581 27 | -2.50666890692582,0.146016880495267,0.253420042344657,0.0346074722150559 28 | -2.46882007312134,-0.130951489435251,-0.0949105760993919,0.0574497158014139 29 | -2.56231990619601,-0.367718857434201,0.078494205137924,-0.0141727423377496 30 | -2.63953471538454,-0.312039980235284,0.145908895730029,0.0657834667283267 31 | -2.63198938727434,0.196961224924314,-0.0407710790671793,-0.123983306389362 32 | -2.58739847668935,0.204318491274133,0.0772229890734356,-0.060462276732352 33 | -2.40993249700217,-0.410924264229574,0.145524972005131,0.231628491662468 34 | -2.64886233434991,-0.813363820296963,-0.22566914972012,-0.281372347063831 35 | -2.59873674910058,-1.09314575944936,-0.157810812958220,-0.0953488583333836 36 | -2.63692687810580,0.121322347865863,0.143049581786139,0.0190703412575093 37 | -2.86624165211867,-0.0693644715800813,0.164332306653026,0.162598446279684 38 | -2.62523804985037,-0.599370021379425,0.268350375693936,0.176441212932370 39 | -2.80068411544822,-0.268643737797983,-0.0936990824798004,-0.168173054402496 40 | -2.98050204378199,0.487958344428615,-0.0729270456926923,-0.0107331474289386 41 | -2.59000631396809,-0.229043836827013,0.0800823030173258,-0.0137491512615344 42 | -2.7701024260279,-0.263527533744257,-0.0772476931611038,0.0940633590067869 43 | -2.8493687050431,0.940960573641196,0.349230377305967,0.319987486954153 44 | -2.99740654659491,0.341926057471609,-0.192509211712710,-0.0746777681621643 45 | -2.40561448509748,-0.188871428930261,-0.263867945513415,0.176208890487610 46 | -2.20948923778368,-0.436663141639188,-0.298742745755109,-0.182842502473030 47 | -2.71445142675771,0.250208204185211,0.0976781440456296,0.142843573559593 48 | -2.53814825899894,-0.503771144461438,-0.166705636604805,-0.189622291427449 49 | -2.83946216764285,0.227945569493827,-0.0837268490335934,-0.059564228280833 50 | -2.54308574983039,-0.57941002151989,0.0171150242485131,-0.0465686437805779 51 | -2.70335978233516,-0.107706082499412,0.0892940084788246,0.0346583385141445 52 | 1.28482568885835,-0.68516047046731,0.406568025467693,0.0185252879232697 53 | 0.93248853231232,-0.318333638262629,0.0180141866462397,0.000566512106216333 54 | 1.46430232199140,-0.504262815309205,0.338325764980895,-0.00165317587303715 55 | 0.183317719958373,0.827959011820632,0.179591391875355,0.0935668402366621 56 | 1.08810325771167,-0.0745906751977167,0.307757896234784,0.112020574163602 57 | 0.64166908425808,0.418246871568678,-0.0410760908239567,-0.243116766512924 58 | 1.09506066263245,-0.283468270061530,-0.169810239860576,-0.0835565724233163 59 | -0.749122669829655,1.00489096118190,-0.0123029192375955,-0.0179077225553055 60 | 1.04413182605344,-0.228361899788396,0.415336084759397,-0.0391345019654227 61 | -0.00874540408289377,0.723081905004834,-0.28114143117641,-0.00561891787511379 62 | -0.507840883835324,1.26597119052639,0.269817182768852,0.0455624408026163 63 | 0.5116985574476,0.10398123549904,-0.130547750240487,0.0507192324858447 64 | 0.264976508112049,0.550036463680474,0.694146830144418,0.0571855194760486 65 | 0.984934510470892,0.124817854126357,0.0621144083222603,-0.169496254590469 66 | -0.173925371681766,0.254854208702589,-0.0904576907257047,0.125217292125236 67 | 0.92786078094425,-0.467179494441511,0.314620975832172,0.0998031365170802 68 | 0.66028376169694,0.35296966572385,-0.328027528378596,-0.187878621483738 69 | 0.236104993317674,0.333610766824915,0.271161837251066,-0.213757369637274 70 | 0.944733728019815,0.543145550779766,0.499519046485112,0.257192177191550 71 | 0.0452269762987021,0.583834377471864,0.235002104972055,-0.0415766475595119 72 | 1.11628317735005,0.0846168521947877,-0.459620991359104,-0.0750315528649476 73 | 0.357888417997310,0.0689250316560134,0.229853887608951,0.122997604145983 74 | 1.29818387535892,0.327787308333917,0.347854352257307,0.000888370584254616 75 | 0.921728922447039,0.182737793621367,0.231071777736284,-0.288255429276666 76 | 0.714853325911414,-0.149055944369785,0.321800937244473,0.0417197555521726 77 | 0.90017437317217,-0.328504473834324,0.316209073711573,0.100226727593295 78 | 1.33202443672209,-0.244440876016344,0.521702779664418,0.0353331921094627 79 | 1.55780215506607,-0.267495447310255,0.164920983743580,0.0699692822661265 80 | 0.813290649817544,0.163350300687616,-0.0354245048461607,-0.0297114339555352 81 | -0.305583778024307,0.368262189754587,0.318491580623047,0.0745696136357219 82 | -0.0681264920683613,0.705172131799465,0.244213810433554,0.00683084221616703 83 | -0.189622472378500,0.680286763528133,0.306420561217658,-0.0205510016107744 84 | 0.136428711558017,0.314032438249236,0.177242766011244,0.0329419128144620 85 | 1.38002643591551,0.420954287313882,-0.0161671275207295,-0.178304462892685 86 | 0.588006443339866,0.484287419981218,-0.444433498639808,-0.250976060064533 87 | 0.806858312500414,-0.194182314713151,-0.388963063098211,-0.114207243262195 88 | 1.22069088244436,-0.407619593611008,0.237167009883875,0.0312171829450947 89 | 0.815095235766602,0.372037059909501,0.614720842591822,0.154020999761988 90 | 0.245957679886695,0.268524396622014,-0.188366811646195,-0.146674511738694 91 | 0.166413217145459,0.681926724863626,0.0600092258553377,0.0296222195034364 92 | 0.464800288403782,0.67071154451172,0.0243068557189511,-0.269651428187435 93 | 0.890815198469452,0.0344644443682683,0.00994693289434812,-0.153484666257619 94 | 0.230548023559458,0.404385848007325,0.229410241439156,0.0169303244816114 95 | -0.704531759244661,1.01224822753171,0.105691148903020,0.0456133071017048 96 | 0.356981494701049,0.504910093337108,-0.0166171701982660,-0.0987414793383188 97 | 0.331934479945061,0.212654683781169,-0.0832042908956773,-0.238475433674164 98 | 0.376215651066673,0.293218929251419,-0.0779963510876762,-0.131137380781147 99 | 0.64257600755434,-0.0177381901124168,0.20539496698326,-0.0213776830286225 100 | -0.906469864948834,0.756093366599014,0.0125996475578901,0.232534844283671 101 | 0.299000841878146,0.348897806450335,-0.0105816604955711,-0.0511811717150702 102 | 2.53119272780363,0.00984910949880183,-0.760165427245896,-0.0290555727786993 103 | 1.41523587670390,0.574916347546489,-0.296322527387965,-0.0153046738942667 104 | 2.61667601599569,-0.343903151341735,0.110787883219108,0.065772041238164 105 | 1.97153105304344,0.179727904352245,-0.108424662463424,-0.236790934199226 106 | 2.35000592004464,0.0402609471425308,-0.285389563184442,-0.000170633278352539 107 | 3.39703873605326,-0.550836673028056,0.348437555797466,-0.112371653206092 108 | 0.521232243909776,1.19275872700065,-0.545659295646813,-0.0981266196306472 109 | 2.93258706899369,-0.355500002977497,0.420239935767967,-0.257191032191495 110 | 2.32122881657338,0.24383150231069,0.348304394934844,-0.0786746129701119 111 | 2.91675096678607,-0.782791948815279,-0.423335417682559,0.110982071035577 112 | 1.66177415363653,-0.242228407755067,-0.242440189725770,0.121040551831856 113 | 1.80340195296509,0.215637617333555,0.0376481682314818,0.0780198444491916 114 | 2.16559179608015,-0.216275585074025,-0.0333266418443259,0.163061478164825 115 | 1.34616357945845,0.77681834734434,-0.281902882118465,0.140440868774429 116 | 1.58592822387322,0.539640714026719,-0.62902932640801,0.329551728371144 117 | 1.90445637479343,-0.119250692091973,-0.479639819626591,0.219621262721746 118 | 1.94968905939907,-0.0419432596632118,-0.044186167630123,-0.157681907285581 119 | 3.48705536429028,-1.17573932971343,-0.133894873936100,-0.309219573021656 120 | 3.79564542207289,-0.25732297342048,0.513767763817803,0.0538460965051755 121 | 1.30079171263766,0.761149636435063,0.344995038313417,-0.0458247548865627 122 | 2.42781791306605,-0.378196012617051,-0.219119324301944,0.185429264375879 123 | 1.19900110546556,0.606091527757930,-0.511855508697001,0.0609591170836566 124 | 3.49992003892454,-0.460674098911896,0.573182242568001,-0.140227954408337 125 | 1.38876613169147,0.204399327352151,0.0645227566312678,0.163040977430243 126 | 2.27543050387221,-0.334990605821678,-0.286150091169151,-0.0603719696243374 127 | 2.61409047381083,-0.560901355123078,0.205534524353624,-0.240704986483341 128 | 1.25850816051149,0.179704794722746,-0.0458477039272505,0.147503846472696 129 | 1.29113205911502,0.116668651174011,-0.231256462659971,0.00402660774960928 130 | 2.12360872277390,0.209729476677302,-0.154180023928831,0.052827323036998 131 | 2.38800301600347,-0.464639804708737,0.449530191941849,-0.231524053403998 132 | 2.84167277810387,-0.375269167195104,0.498898075870768,-0.0223364626091533 133 | 3.23067366143209,-1.37416508679305,0.114548205475418,-0.25290192339528 134 | 2.15943764248905,0.217277578669049,-0.208763167130838,0.128193065563403 135 | 1.44416124232951,0.14341341045758,0.153233888063089,-0.190996357914510 136 | 1.78129481004511,0.499901681078136,0.172875189113419,-0.505434411785802 137 | 3.07649993168719,-0.688085677571176,0.33559229243454,0.309828044634432 138 | 2.14424331430208,-0.14006420108979,-0.734878936725511,0.055541969126137 139 | 1.90509814881408,-0.0493005260130306,-0.162180235770738,-0.221202936942591 140 | 1.16932633934150,0.164990262023109,-0.281835840208481,0.0204617871586755 141 | 2.10761114325724,-0.372287871960798,-0.0272911321416314,0.210621785788073 142 | 2.3141547052356,-0.183651279169019,-0.322693747173059,0.277653777387566 143 | 1.92226780090260,-0.409203466816062,-0.113586595799357,0.505304966939273 144 | 1.41523587670390,0.574916347546489,-0.296322527387965,-0.0153046738942667 145 | 2.56301337507748,-0.277862602929195,-0.292569524596744,0.057912747686555 146 | 2.41874618273283,-0.304798197854692,-0.50448266397718,0.241091000481281 147 | 1.94410979454697,-0.187532302800605,-0.177825090632658,0.426195940025627 148 | 1.52716661481452,0.375316982580488,0.121898171867181,0.25436744199041 149 | 1.76434571704443,-0.0788588545184761,-0.130481631287849,0.137001273865618 150 | 1.90094161421843,-0.116627958512024,-0.723251563489917,0.0445953047082615 151 | 1.39018886194792,0.282660937990550,-0.362909648085376,-0.155038628230112 152 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set/built-in-iris_whitened.csv: -------------------------------------------------------------------------------- 1 | "V1","V2","V3","V4" 2 | -1.30533786331985,-0.64836931578024,0.0998171567550143,0.0146544014004704 3 | -1.31993520592405,0.359308555144159,0.752572990107817,0.641421074709278 4 | -1.40496731601559,0.294244115184601,-0.0640072981075774,0.129340524793864 5 | -1.33510888707713,0.646139857489741,-0.112849235131331,-0.489524489704802 6 | -1.32702321343288,-0.663304403043036,-0.322103141983288,-0.396788054951918 7 | -1.10922246368193,-1.50488434438621,-0.603153438673292,-0.156755335012743 8 | -1.37167749726127,0.181604623382644,-0.922164462740666,-0.311835593608468 9 | -1.27714084424687,-0.33166783890907,0.0782355289924737,-0.29340625030883 10 | -1.40369907852760,1.17396001493018,-0.074231562872777,-0.173232704755309 11 | -1.29980851438097,0.230959191851262,0.706690257243205,-0.364640156251960 12 | -1.21917280141662,-1.30947553530788,0.269320293116278,-0.0972880109128571 13 | -1.27062917528692,-0.0299014493006932,-0.36526639750837,-1.01290935837052 14 | -1.35493431503895,0.477272137854497,0.739629248003086,-0.0510920823825325 15 | -1.56779289689919,1.03811965198861,-0.219193867312358,-0.140425857195252 16 | -1.2861889881828,-2.39286602800860,0.542185985023718,1.03124331685121 17 | -1.16037307035593,-2.71623680826575,-0.993267844883855,0.0424360898933425 18 | -1.27586810314384,-1.64566140612208,-0.494112201628444,1.08646211614472 19 | -1.28791362465772,-0.633046836403374,-0.0953599097600728,0.502818185856118 20 | -1.06981161132551,-1.77184386067469,0.430185543819729,0.175222082156323 21 | -1.25858365377304,-1.0425160190194,-0.764018689376744,-0.429265428081925 22 | -1.12351854270487,-0.794423556389948,0.856198144949314,-0.0976174853429077 23 | -1.23704893545064,-0.878972390292536,-0.745396265773345,0.265991440089949 24 | -1.56396833470585,-0.270937216430094,-1.04554513941770,0.0290319056608901 25 | -1.11985995841649,-0.200376782647739,-0.139895990336909,0.960918833831773 26 | -1.14564494569049,0.0756813470012126,-0.447047325292007,-1.94532244673861 27 | -1.21903751574033,0.296411023924892,0.906173180205208,0.224161721766711 28 | -1.20063095705713,-0.265828614721369,-0.339378913298912,0.372116955813102 29 | -1.24610158300161,-0.746461112433476,0.28067765611362,-0.0918005887527302 30 | -1.28365251320683,-0.633434228517446,0.521737455493318,0.426096857752861 31 | -1.27998308641915,0.399826911486507,-0.145788225891214,-0.80307256357423 32 | -1.25829773630612,0.414761998749302,0.276132072847089,-0.391630107221841 33 | -1.17199288511156,-0.834167128504153,0.520364630441565,1.50031880914712 34 | -1.28818869962534,-1.65111048791033,-0.806942218082213,-1.82252287550573 35 | -1.26381173913066,-2.21906160957904,-0.564296039595127,-0.617599694068462 36 | -1.28238427571884,0.246281671228129,0.511513190728118,0.123523628203687 37 | -1.39390411452277,-0.140808336510979,0.587615437013082,1.05319300549172 38 | -1.27669979137428,-1.21670782956302,0.959560700495491,1.14285625473449 39 | -1.36202232254778,-0.545340820332698,-0.335046884088017,-1.08930121204373 40 | -1.44947096805334,0.99054460014621,-0.260770743730052,-0.0695214256821703 41 | -1.25956597379411,-0.464953900996273,0.286356337612289,-0.0890568776726681 42 | -1.34714990497596,-0.534955039750139,-0.276220409118676,0.609273176009322 43 | -1.38569850131658,1.91012906288586,1.24876942920408,2.07264331742322 44 | -1.45769192737387,0.694102301446212,-0.688369723967025,-0.483707593114623 45 | -1.16989295939313,-0.383404805317635,-0.943532536447573,1.14135144100817 46 | -1.074513775649,-0.88641647790666,-1.06823699293668,-1.18431909478373 47 | -1.32008583771468,0.507917096608229,0.349275114972913,0.925235486528763 48 | -1.23434648256970,-1.02264423296230,-0.596101932122869,-1.22823357532694 49 | -1.38088077660287,0.462724442705774,-0.299388415988607,-0.385813210631664 50 | -1.23674767186938,-1.17618947322068,0.0611994844964614,-0.301637383549021 51 | -1.31469177445208,-0.21864095499304,0.319295328372173,0.224491196196761 52 | 0.624833503769789,-1.39086053554376,1.45379598708594,0.119993174054982 53 | 0.453485699984389,-0.646210214511608,0.0644146873743796,0.00366944827238402 54 | 0.71211617137038,-1.02364231386175,1.2097769835471,-0.0107080559880357 55 | 0.0891506562002645,1.68073840249964,0.642178500198649,0.606057093028484 56 | 0.529163898943694,-0.151417413764848,1.10047314720693,0.725586792984088 57 | 0.312055048131848,0.849031858745081,-0.146878879460212,-1.57473139422714 58 | 0.532547408264448,-0.575434291529598,-0.607203296401435,-0.541217949203086 59 | -0.364311631221320,2.03990632950448,-0.0439924772649883,-0.115993040346108 60 | 0.507779812411925,-0.463569583955783,1.48514859873843,-0.253484487007271 61 | -0.00425304500243346,1.46784020530415,-1.00529864338862,-0.0363952124998971 62 | -0.246972022396537,2.56989339568521,0.96480567330635,0.295119941576229 63 | 0.248848077444674,0.211079598322503,-0.466809447704091,0.328521840892117 64 | 0.128862772137948,1.11656180328302,2.48211323296148,0.370405686558579 65 | 0.478991108675721,0.253377471291071,0.222107179863053,-1.09787192852180 66 | -0.084582990770479,0.517348382576569,-0.323456394847608,0.811065414524747 67 | 0.451235142475334,-0.948363996234055,1.12501397912861,0.646451228230814 68 | 0.321107695682818,0.71652058088602,-1.17295280134718,-1.21693936538447 69 | 0.114822042796569,0.677222446141402,0.969613855868198,-1.38456284008424 70 | 0.459440755681524,1.10257340316278,1.78616797131961,1.66590154016232 71 | 0.0219946801427526,1.18517081752474,0.840314770872876,-0.269302907889737 72 | 0.542868293303405,0.171770330356916,-1.64350148305360,-0.485999149909578 73 | 0.174047480615512,0.139916283226423,0.821905901325111,0.796687910264328 74 | 0.631329826615399,0.66540095476146,1.24384907253912,0.00575421049234492 75 | 0.448253111011722,0.370953661887337,0.826260803011714,-1.86710641371687 76 | 0.347645841909967,-0.302580256083282,1.15068790928244,0.270229856088498 77 | 0.437770751682837,-0.666856784796852,1.13069266062728,0.649194939310877 78 | 0.647787091370805,-0.496209548535389,1.86549202105904,0.228862400858198 79 | 0.757586797314863,-0.543009816149646,0.589720414134567,0.453209488577797 80 | 0.395517657154136,0.331597481887204,-0.126670076749425,-0.192448791123588 81 | -0.148610807188793,0.747564064974792,1.13885439293414,0.48300704773201 82 | -0.0331311205152218,1.43148376352797,0.87325376163276,0.0442451659796921 83 | -0.0922167690428317,1.38096701871713,1.09569113740906,-0.133114255686593 84 | 0.0663477003898789,0.637478874027197,0.633780341360448,0.213373454405783 85 | 0.671131314329666,0.854527852567878,-0.0578100185948115,-1.15492501597167 86 | 0.285957954777292,0.983092705060427,-1.58919441858681,-1.62563811065679 87 | 0.392389497514938,-0.394185785485922,-1.39084459385694,-0.739750425249071 88 | 0.593643610733899,-0.827458720555283,0.84805598482989,0.202201924318369 89 | 0.396395259284278,0.755226967537882,2.19810373211233,0.997634622960326 90 | 0.119613578896642,0.545098560396414,-0.673557431272154,-0.950049483138302 91 | 0.0809296968797324,1.38429610379964,0.214579519961675,0.191870925596031 92 | 0.226040618019244,1.36152953680865,0.0869158593134272,-1.74660339373330 93 | 0.433219219149977,0.0699620565071039,0.0355679990057788,-0.994160649448664 94 | 0.112119589915623,0.820894288811165,0.820319522217723,0.109662175332644 95 | -0.342626281108291,2.05484141676728,0.377927821473314,0.29544941600628 96 | 0.173606427742918,1.02495627388038,-0.0594192701779073,-0.63957459477899 97 | 0.161425620552751,0.431684284366312,-0.297519865398462,-1.54466825774715 98 | 0.182960338875149,0.595227913093177,-0.278897441795063,-0.849411389575278 99 | 0.312496101004441,-0.036008131908874,0.734446292042806,-0.138468889183828 100 | -0.44083236091036,1.53485273905504,0.0450535111247045,1.50618949403373 101 | 0.145409408669938,0.708254797009206,-0.0378376424153637,-0.331513943069685 102 | 1.23096388447485,0.0199934735037903,-2.71818091543297,-0.188200605363996 103 | 0.688254289410537,1.16706741487288,-1.05958283537970,-0.0991324078770566 104 | 1.27253592256374,-0.698115758085278,0.396152599202573,0.426022851840757 105 | 0.958790493019075,0.364843653529846,-0.387702252308571,-1.53375731053117 106 | 1.14284952864382,0.0817288283808416,-1.02048900977020,-0.00110523673120522 107 | 1.6520401438859,-1.11818621048352,1.24593447747317,-0.72786082450398 108 | 0.253484478139073,2.42127372100017,-1.95115514412363,-0.635591986345176 109 | 1.42616906660505,-0.721657109304412,1.50268366906111,-1.66589412369509 110 | 1.12885471320215,0.494972533448961,1.24545832412222,-0.509596210700340 111 | 1.41846768943439,-1.58905026789707,-1.5137524174713,0.718860134423427 112 | 0.80815022294068,-0.491718287110669,-0.866911692148512,0.7840115664506 113 | 0.87702633185807,0.437739573217598,0.134621397816769,0.50535510236119 114 | 1.05316567174354,-0.439034633559542,-0.119168589612026,1.05619218508973 115 | 0.654663207074962,1.57692398960298,-1.00802142101642,0.909672534164245 116 | 0.771265003060934,1.09545866240722,-2.24926765807363,2.13459343068496 117 | 0.92617088820527,-0.242076256024929,-1.71508431883601,1.42254482160265 118 | 0.948168344398858,-0.0851438854285292,-0.157999815926213,-1.02134728618570 119 | 1.69581682558415,-2.38672472255987,-0.478778010631205,-2.00289669993135 120 | 1.84588963990043,-0.52235992011509,1.83711818575312,0.348775363540286 121 | 0.632598064103386,1.54511685450703,1.23362480777392,-0.296819019056828 122 | 1.18069087993099,-0.767729504725074,-0.78352151278178,1.20107423362600 123 | 0.583095487775923,1.23035233820622,-1.83028039073049,0.394848273168767 124 | 1.70207314486254,-0.935158187813622,2.04957102358383,-0.90829343168038 125 | 0.675381583281265,0.414926094192062,0.230718892756886,1.05605939642684 126 | 1.10658218204094,-0.680023488654396,-1.02320848710972,-0.391045164273842 127 | 1.27127852757505,-1.13861729156911,0.734945317869466,-1.55910965911184 128 | 0.612034823302758,0.364796741495299,-0.163941096720203,0.955421302863815 129 | 0.62790040339494,0.236834770316475,-0.826921194838206,0.0260814000058320 130 | 1.03274855911850,0.425746178923238,-0.551313153115528,0.342176499188168 131 | 1.16132818984037,-0.943208482490783,1.60741904965904,-1.49964233501195 132 | 1.38195583564925,-0.761788073532689,1.78394751980675,-0.144679157308325 133 | 1.57113385956897,-2.78952460178992,0.409598667422238,-1.63811243520222 134 | 1.05017279778063,0.441068658300105,-0.746490219630615,0.830340283643817 135 | 0.702321207365556,0.291126037579402,0.547929983661237,-1.23713376623506 136 | 0.866275236445817,1.01478930824678,0.618162866867605,-3.27383194247741 137 | 1.49615644233554,-1.39679864098683,1.20000269936887,2.0068379309903 138 | 1.04278352669054,-0.284327216958949,-2.62776210199153,0.359759977621589 139 | 0.926482994285829,-0.100078972691324,-0.579920114664515,-1.43278974253809 140 | 0.5686641230767,0.334926566969709,-1.00778169419681,0.132536390159037 141 | 1.02496865267056,-0.755736110430713,-0.0975869618494836,1.36425283679903 142 | 1.12541444748239,-0.37280801725777,-1.1538803971568,1.79843671931492 143 | 0.934832900398396,-0.830673947978887,-0.406160167096021,3.27299349407842 144 | 0.688254289410537,1.16706741487288,-1.05958283537970,-0.0991324078770566 145 | 1.24643882920919,-0.564054911769932,-1.04616293992402,0.37511613541111 146 | 1.17627913668947,-0.618733571146931,-1.80391675317007,1.56160997354875 147 | 0.945455049018613,-0.380686409020512,-0.635862603478379,2.76058346973295 148 | 0.742688191129407,0.761885137702894,0.435880497217561,1.64760498552557 149 | 0.85803259212669,-0.160081722976703,-0.466573021172751,0.887393371093685 150 | 0.92446159784469,-0.236752165116549,-2.58618522557383,0.288855546108507 151 | 0.67607348222037,0.573795425358819,-1.29768343060026,-1.00422607084522 152 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set/built-in-other_rotated.csv: -------------------------------------------------------------------------------- 1 | "PC1","PC2","PC3","PC4" 2 | -1.30685496249706,4.03208300402822,-3.65767848060515,1.28450543847617 3 | -2.23875589861001,0.932339532834423,-0.795769384905853,0.130110624724464 4 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set/built-in-other_whitened.csv: -------------------------------------------------------------------------------- 1 | "V1","V2","V3","V4" 2 | -0.635546729970465,8.1850389333095,-13.0790371206328,8.32008038374598 3 | -1.08874667150899,1.89262854154773,-2.84549267515850,0.842760819892809 4 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set/eigen-iris_rotated.csv: -------------------------------------------------------------------------------- 1 | "V1","V2","V3","V4" 2 | -2.68412562596953,-0.319397246585102,-0.0279148275894132,0.00226243707131624 3 | -2.71414168729432,0.177001225064779,-0.210464272378243,0.0990265503235863 4 | -2.88899056905929,0.144949426085556,0.0179002563208909,0.0199683897090287 5 | -2.74534285564141,0.318298979251915,0.0315593736056818,-0.0755758166136827 6 | -2.72871653655453,-0.326754512934921,0.0900792405512016,-0.0612585925856942 7 | -2.28085963284449,-0.741330449062916,0.168677658209105,-0.0242008575695243 8 | -2.82053775074061,0.0894613845285677,0.257892158255619,-0.0481431064876535 9 | -2.62614497314663,-0.163384959698330,-0.0218793178867192,-0.0452978705519316 10 | -2.88638273178055,0.578311754186702,0.0207595702647809,-0.0267447357617880 11 | -2.67275579782095,0.113774245874116,-0.197632724988146,-0.0562954012688945 12 | -2.50694709065185,-0.645068898648575,-0.0753180093791199,-0.0150199244901806 13 | -2.61275523090872,-0.0147299391613755,0.102150259956590,-0.15637920783219 14 | -2.78610926618801,0.235112000201717,-0.206844430449644,-0.00788791149321577 15 | -3.22380374386565,0.511394587006381,0.0612996724571001,-0.021679811846813 16 | -2.64475038994203,-1.17876463643758,-0.151627523617809,0.159209717669961 17 | -2.38603903353113,-1.33806233040065,0.277776902703135,0.00655154586753004 18 | -2.62352787522442,-0.810679514181259,0.138183227880720,0.167734737228330 19 | -2.64829670625438,-0.311849144593356,0.0266683156125944,0.077628179597721 20 | -2.19982032361758,-0.872839038962212,-0.120305523394731,0.0270518681418765 21 | -2.58798639987877,-0.513560308749278,0.213665172224716,-0.0662726502015814 22 | -2.31025621524251,-0.391345935653895,-0.239444043244953,-0.0150707907892687 23 | -2.54370522875715,-0.432996063279029,0.208457232416715,0.041065402691436 24 | -3.21593941564861,-0.133468069538527,0.292396750745243,0.00448212505056944 25 | -2.30273318222620,-0.0987088548141006,0.0391232587428813,0.148352589285366 26 | -2.35575404912377,0.0372818596773818,0.125021082702879,-0.30033090393058 27 | -2.50666890692582,0.146016880495267,-0.253420042344657,0.0346074722150567 28 | -2.46882007312134,-0.130951489435251,0.0949105760993924,0.057449715801414 29 | -2.56231990619601,-0.367718857434201,-0.0784942051379238,-0.0141727423377496 30 | -2.63953471538454,-0.312039980235284,-0.145908895730029,0.0657834667283268 31 | -2.63198938727434,0.196961224924314,0.0407710790671798,-0.123983306389362 32 | -2.58739847668935,0.204318491274132,-0.077222989073435,-0.0604622767323513 33 | -2.40993249700217,-0.410924264229574,-0.145524972005130,0.231628491662468 34 | -2.64886233434991,-0.813363820296963,0.225669149720120,-0.281372347063832 35 | -2.59873674910058,-1.09314575944936,0.15781081295822,-0.0953488583333847 36 | -2.63692687810580,0.121322347865862,-0.143049581786138,0.0190703412575099 37 | -2.86624165211867,-0.0693644715800818,-0.164332306653025,0.162598446279684 38 | -2.62523804985037,-0.599370021379425,-0.268350375693936,0.176441212932370 39 | -2.80068411544822,-0.268643737797983,0.0936990824798007,-0.168173054402496 40 | -2.98050204378199,0.487958344428614,0.0729270456926934,-0.0107331474289376 41 | -2.59000631396809,-0.229043836827014,-0.0800823030173255,-0.0137491512615342 42 | -2.7701024260279,-0.263527533744258,0.0772476931611045,0.094063359006787 43 | -2.8493687050431,0.940960573641195,-0.349230377305965,0.319987486954155 44 | -2.99740654659490,0.341926057471609,0.192509211712711,-0.0746777681621636 45 | -2.40561448509748,-0.188871428930262,0.263867945513416,0.17620889048761 46 | -2.20948923778368,-0.436663141639189,0.298742745755109,-0.182842502473031 47 | -2.71445142675770,0.25020820418521,-0.0976781440456286,0.142843573559593 48 | -2.53814825899894,-0.503771144461439,0.166705636604805,-0.189622291427450 49 | -2.83946216764285,0.227945569493827,0.083726849033594,-0.0595642282808324 50 | -2.54308574983039,-0.57941002151989,-0.0171150242485130,-0.0465686437805782 51 | -2.70335978233516,-0.107706082499413,-0.089294008478824,0.0346583385141448 52 | 1.28482568885835,-0.685160470467309,-0.406568025467694,0.0185252879232689 53 | 0.93248853231232,-0.318333638262629,-0.0180141866462401,0.000566512106215777 54 | 1.46430232199140,-0.504262815309204,-0.338325764980896,-0.00165317587303776 55 | 0.183317719958373,0.827959011820632,-0.179591391875355,0.0935668402366633 56 | 1.08810325771167,-0.0745906751977165,-0.307757896234784,0.112020574163602 57 | 0.64166908425808,0.418246871568679,0.0410760908239566,-0.243116766512924 58 | 1.09506066263245,-0.283468270061529,0.169810239860575,-0.083556572423317 59 | -0.749122669829655,1.00489096118189,0.0123029192375963,-0.0179077225553042 60 | 1.04413182605344,-0.228361899788396,-0.415336084759397,-0.0391345019654228 61 | -0.0087454040828939,0.723081905004834,0.281141431176411,-0.00561891787511312 62 | -0.507840883835324,1.26597119052639,-0.269817182768851,0.0455624408026181 63 | 0.511698557447599,0.10398123549904,0.130547750240487,0.0507192324858446 64 | 0.264976508112048,0.550036463680474,-0.694146830144418,0.0571855194760497 65 | 0.984934510470892,0.124817854126357,-0.0621144083222606,-0.169496254590469 66 | -0.173925371681766,0.254854208702589,0.090457690725705,0.125217292125236 67 | 0.92786078094425,-0.467179494441511,-0.314620975832172,0.0998031365170798 68 | 0.660283761696939,0.35296966572385,0.328027528378596,-0.187878621483738 69 | 0.236104993317674,0.333610766824915,-0.271161837251066,-0.213757369637273 70 | 0.944733728019815,0.543145550779766,-0.499519046485112,0.257192177191550 71 | 0.0452269762987019,0.583834377471864,-0.235002104972055,-0.041576647559511 72 | 1.11628317735005,0.0846168521947878,0.459620991359104,-0.075031552864948 73 | 0.357888417997309,0.0689250316560134,-0.229853887608951,0.122997604145983 74 | 1.29818387535892,0.327787308333917,-0.347854352257308,0.000888370584255171 75 | 0.921728922447039,0.182737793621368,-0.231071777736284,-0.288255429276666 76 | 0.714853325911414,-0.149055944369785,-0.321800937244474,0.0417197555521726 77 | 0.900174373172169,-0.328504473834324,-0.316209073711574,0.100226727593295 78 | 1.33202443672209,-0.244440876016344,-0.521702779664419,0.0353331921094627 79 | 1.55780215506607,-0.267495447310255,-0.16492098374358,0.0699692822661261 80 | 0.813290649817543,0.163350300687616,0.0354245048461606,-0.0297114339555352 81 | -0.305583778024307,0.368262189754587,-0.318491580623046,0.0745696136357226 82 | -0.0681264920683615,0.705172131799465,-0.244213810433554,0.00683084221616811 83 | -0.189622472378500,0.680286763528133,-0.306420561217658,-0.0205510016107733 84 | 0.136428711558017,0.314032438249236,-0.177242766011244,0.0329419128144625 85 | 1.38002643591551,0.420954287313882,0.0161671275207293,-0.178304462892685 86 | 0.588006443339866,0.484287419981218,0.444433498639808,-0.250976060064533 87 | 0.806858312500414,-0.194182314713151,0.388963063098211,-0.114207243262195 88 | 1.22069088244435,-0.407619593611007,-0.237167009883876,0.0312171829450942 89 | 0.815095235766602,0.372037059909501,-0.614720842591822,0.154020999761989 90 | 0.245957679886695,0.268524396622015,0.188366811646195,-0.146674511738693 91 | 0.166413217145459,0.681926724863626,-0.0600092258553374,0.0296222195034373 92 | 0.464800288403781,0.67071154451172,-0.0243068557189510,-0.269651428187434 93 | 0.890815198469451,0.0344644443682687,-0.00994693289434842,-0.153484666257619 94 | 0.230548023559457,0.404385848007325,-0.229410241439156,0.0169303244816120 95 | -0.704531759244661,1.01224822753171,-0.105691148903019,0.0456133071017062 96 | 0.356981494701049,0.504910093337108,0.0166171701982661,-0.0987414793383183 97 | 0.331934479945060,0.212654683781170,0.0832042908956772,-0.238475433674164 98 | 0.376215651066672,0.293218929251419,0.0779963510876762,-0.131137380781147 99 | 0.64257600755434,-0.0177381901124166,-0.205394966983260,-0.0213776830286224 100 | -0.906469864948834,0.756093366599013,-0.0125996475578894,0.232534844283672 101 | 0.299000841878145,0.348897806450336,0.0105816604955712,-0.0511811717150698 102 | 2.53119272780363,0.00984910949880198,0.760165427245896,-0.0290555727787004 103 | 1.41523587670390,0.574916347546489,0.296322527387965,-0.0153046738942664 104 | 2.61667601599569,-0.343903151341734,-0.110787883219109,0.0657720412381633 105 | 1.97153105304344,0.179727904352246,0.108424662463423,-0.236790934199226 106 | 2.35000592004464,0.0402609471425310,0.285389563184442,-0.000170633278353094 107 | 3.39703873605326,-0.550836673028055,-0.348437555797467,-0.112371653206093 108 | 0.521232243909775,1.19275872700064,0.545659295646814,-0.0981266196306463 109 | 2.93258706899369,-0.355500002977496,-0.420239935767968,-0.257191032191496 110 | 2.32122881657338,0.243831502310691,-0.348304394934844,-0.0786746129701116 111 | 2.91675096678607,-0.782791948815278,0.423335417682558,0.110982071035575 112 | 1.66177415363653,-0.242228407755067,0.242440189725769,0.121040551831856 113 | 1.80340195296509,0.215637617333555,-0.0376481682314821,0.0780198444491917 114 | 2.16559179608015,-0.216275585074025,0.0333266418443255,0.163061478164825 115 | 1.34616357945845,0.776818347344339,0.281902882118465,0.14044086877443 116 | 1.58592822387322,0.539640714026718,0.629029326408011,0.329551728371144 117 | 1.90445637479343,-0.119250692091973,0.479639819626591,0.219621262721745 118 | 1.94968905939907,-0.0419432596632112,0.0441861676301224,-0.157681907285581 119 | 3.48705536429028,-1.17573932971343,0.133894873936098,-0.309219573021658 120 | 3.79564542207288,-0.257322973420479,-0.513767763817804,0.053846096505175 121 | 1.30079171263766,0.761149636435063,-0.344995038313417,-0.0458247548865617 122 | 2.42781791306605,-0.378196012617051,0.219119324301943,0.185429264375878 123 | 1.19900110546556,0.60609152775793,0.511855508697002,0.0609591170836569 124 | 3.49992003892454,-0.460674098911894,-0.573182242568003,-0.140227954408338 125 | 1.38876613169147,0.204399327352151,-0.0645227566312678,0.163040977430243 126 | 2.27543050387221,-0.334990605821677,0.28615009116915,-0.0603719696243384 127 | 2.61409047381083,-0.560901355123077,-0.205534524353625,-0.240704986483342 128 | 1.25850816051149,0.179704794722746,0.0458477039272504,0.147503846472696 129 | 1.29113205911502,0.116668651174011,0.231256462659971,0.00402660774960906 130 | 2.12360872277390,0.209729476677303,0.154180023928830,0.0528273230369978 131 | 2.38800301600347,-0.464639804708736,-0.44953019194185,-0.231524053403998 132 | 2.84167277810387,-0.375269167195103,-0.498898075870769,-0.0223364626091538 133 | 3.23067366143209,-1.37416508679305,-0.114548205475419,-0.252901923395282 134 | 2.15943764248905,0.217277578669049,0.208763167130838,0.128193065563402 135 | 1.44416124232951,0.143413410457581,-0.153233888063089,-0.190996357914510 136 | 1.78129481004511,0.499901681078137,-0.172875189113419,-0.505434411785801 137 | 3.07649993168719,-0.688085677571176,-0.335592292434541,0.309828044634431 138 | 2.14424331430208,-0.140064201089790,0.734878936725511,0.055541969126136 139 | 1.90509814881408,-0.04930052601303,0.162180235770737,-0.221202936942592 140 | 1.16932633934150,0.164990262023109,0.281835840208481,0.0204617871586754 141 | 2.10761114325724,-0.372287871960798,0.0272911321416309,0.210621785788073 142 | 2.3141547052356,-0.183651279169019,0.322693747173059,0.277653777387565 143 | 1.92226780090260,-0.409203466816063,0.113586595799357,0.505304966939272 144 | 1.41523587670390,0.574916347546489,0.296322527387965,-0.0153046738942664 145 | 2.56301337507748,-0.277862602929195,0.292569524596743,0.057912747686554 146 | 2.41874618273283,-0.304798197854692,0.50448266397718,0.24109100048128 147 | 1.94410979454697,-0.187532302800606,0.177825090632658,0.426195940025626 148 | 1.52716661481452,0.375316982580488,-0.121898171867181,0.25436744199041 149 | 1.76434571704443,-0.078858854518476,0.130481631287848,0.137001273865618 150 | 1.90094161421842,-0.116627958512024,0.723251563489917,0.0445953047082603 151 | 1.39018886194792,0.282660937990550,0.362909648085376,-0.155038628230112 152 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set/eigen-iris_whitened.csv: -------------------------------------------------------------------------------- 1 | "V1","V2","V3","V4" 2 | -1.30533786331985,-0.648369315780242,-0.0998171567550128,0.0146544014004713 3 | -1.31993520592405,0.359308555144158,-0.752572990107813,0.641421074709284 4 | -1.40496731601559,0.2942441151846,0.0640072981075797,0.129340524793868 5 | -1.33510888707713,0.646139857489742,0.112849235131334,-0.489524489704799 6 | -1.32702321343288,-0.663304403043038,0.322103141983289,-0.396788054951918 7 | -1.10922246368193,-1.50488434438621,0.603153438673292,-0.156755335012749 8 | -1.37167749726127,0.181604623382643,0.922164462740667,-0.311835593608466 9 | -1.27714084424687,-0.331667838909071,-0.0782355289924721,-0.293406250308829 10 | -1.4036990785276,1.17396001493018,0.0742315628727801,-0.173232704755302 11 | -1.29980851438097,0.230959191851262,-0.706690257243201,-0.364640156251957 12 | -1.21917280141662,-1.30947553530788,-0.269320293116277,-0.0972880109128607 13 | -1.27062917528692,-0.0299014493006935,0.365266397508372,-1.01290935837052 14 | -1.35493431503895,0.477272137854497,-0.739629248003082,-0.0510920823825263 15 | -1.56779289689919,1.03811965198861,0.219193867312362,-0.140425857195247 16 | -1.2861889881828,-2.3928660280086,-0.542185985023717,1.03124331685120 17 | -1.16037307035593,-2.71623680826575,0.993267844883853,0.0424360898933318 18 | -1.27586810314384,-1.64566140612209,0.494112201628445,1.08646211614471 19 | -1.28791362465772,-0.633046836403376,0.0953599097600744,0.50281818585612 20 | -1.06981161132551,-1.77184386067469,-0.430185543819728,0.175222082156319 21 | -1.25858365377304,-1.04251601901940,0.764018689376744,-0.429265428081928 22 | -1.12351854270487,-0.79442355638995,-0.856198144949312,-0.0976174853429086 23 | -1.23704893545064,-0.878972390292539,0.745396265773346,0.265991440089947 24 | -1.56396833470585,-0.270937216430096,1.04554513941771,0.0290319056608892 25 | -1.11985995841649,-0.20037678264774,0.139895990336911,0.960918833831775 26 | -1.14564494569049,0.075681347001213,0.447047325292008,-1.94532244673861 27 | -1.21903751574033,0.296411023924892,-0.906173180205204,0.224161721766715 28 | -1.20063095705713,-0.26582861472137,0.339378913298914,0.372116955813103 29 | -1.24610158300161,-0.746461112433478,-0.280677656113618,-0.0918005887527311 30 | -1.28365251320683,-0.633434228517448,-0.521737455493316,0.426096857752863 31 | -1.27998308641915,0.399826911486507,0.145788225891215,-0.803072563574228 32 | -1.25829773630612,0.414761998749302,-0.276132072847086,-0.391630107221838 33 | -1.17199288511156,-0.834167128504156,-0.520364630441562,1.50031880914712 34 | -1.28818869962534,-1.65111048791034,0.806942218082212,-1.82252287550574 35 | -1.26381173913066,-2.21906160957905,0.564296039595126,-0.61759969406847 36 | -1.28238427571884,0.246281671228128,-0.511513190728115,0.123523628203690 37 | -1.39390411452277,-0.140808336510981,-0.587615437013079,1.05319300549172 38 | -1.27669979137428,-1.21670782956303,-0.959560700495489,1.14285625473449 39 | -1.36202232254778,-0.5453408203327,0.335046884088017,-1.08930121204373 40 | -1.44947096805334,0.99054460014621,0.260770743730055,-0.069521425682165 41 | -1.25956597379411,-0.464953900996275,-0.286356337612287,-0.0890568776726672 42 | -1.34714990497596,-0.534955039750142,0.276220409118678,0.609273176009323 43 | -1.38569850131658,1.91012906288586,-1.24876942920408,2.07264331742324 44 | -1.45769192737387,0.694102301446212,0.688369723967027,-0.48370759311462 45 | -1.16989295939313,-0.383404805317637,0.943532536447574,1.14135144100817 46 | -1.074513775649,-0.886416477906662,1.06823699293668,-1.18431909478374 47 | -1.32008583771468,0.507917096608229,-0.349275114972909,0.92523548652877 48 | -1.23434648256970,-1.0226442329623,0.596101932122869,-1.22823357532694 49 | -1.38088077660287,0.462724442705774,0.299388415988608,-0.38581321063166 50 | -1.23674767186938,-1.17618947322068,-0.0611994844964603,-0.301637383549024 51 | -1.31469177445209,-0.218640954993041,-0.31929532837217,0.224491196196764 52 | 0.62483350376979,-1.39086053554376,-1.45379598708594,0.119993174054978 53 | 0.453485699984390,-0.646210214511609,-0.064414687374381,0.00366944827238092 54 | 0.71211617137038,-1.02364231386175,-1.2097769835471,-0.0107080559880390 55 | 0.0891506562002645,1.68073840249964,-0.642178500198646,0.606057093028493 56 | 0.529163898943694,-0.151417413764848,-1.10047314720693,0.72558679298409 57 | 0.312055048131848,0.849031858745083,0.146878879460211,-1.57473139422714 58 | 0.532547408264448,-0.575434291529598,0.607203296401432,-0.541217949203091 59 | -0.36431163122132,2.03990632950449,0.0439924772649907,-0.115993040346100 60 | 0.507779812411926,-0.463569583955783,-1.48514859873843,-0.253484487007272 61 | -0.00425304500243351,1.46784020530415,1.00529864338862,-0.0363952124998926 62 | -0.246972022396538,2.56989339568521,-0.964805673306344,0.295119941576241 63 | 0.248848077444674,0.211079598322503,0.46680944770409,0.328521840892117 64 | 0.128862772137947,1.11656180328302,-2.48211323296147,0.370405686558588 65 | 0.478991108675721,0.253377471291073,-0.222107179863054,-1.09787192852180 66 | -0.0845829907704791,0.51734838257657,0.323456394847608,0.81106541452475 67 | 0.451235142475334,-0.948363996234057,-1.12501397912861,0.646451228230812 68 | 0.321107695682818,0.716520580886023,1.17295280134717,-1.21693936538447 69 | 0.114822042796569,0.677222446141404,-0.969613855868197,-1.38456284008424 70 | 0.459440755681524,1.10257340316279,-1.78616797131961,1.66590154016233 71 | 0.0219946801427525,1.18517081752474,-0.840314770872874,-0.269302907889732 72 | 0.542868293303405,0.171770330356916,1.64350148305359,-0.485999149909582 73 | 0.174047480615512,0.139916283226423,-0.82190590132511,0.796687910264331 74 | 0.631329826615399,0.665400954761462,-1.24384907253912,0.00575421049234826 75 | 0.448253111011722,0.370953661887339,-0.826260803011714,-1.86710641371687 76 | 0.347645841909967,-0.302580256083282,-1.15068790928244,0.270229856088498 77 | 0.437770751682837,-0.666856784796853,-1.13069266062728,0.649194939310876 78 | 0.647787091370805,-0.496209548535389,-1.86549202105904,0.228862400858198 79 | 0.757586797314863,-0.543009816149647,-0.589720414134568,0.453209488577795 80 | 0.395517657154136,0.331597481887205,0.126670076749424,-0.192448791123588 81 | -0.148610807188793,0.747564064974794,-1.13885439293414,0.483007047732016 82 | -0.0331311205152219,1.43148376352797,-0.873253761632757,0.0442451659796992 83 | -0.0922167690428319,1.38096701871714,-1.09569113740906,-0.133114255686586 84 | 0.0663477003898789,0.637478874027199,-0.633780341360447,0.213373454405786 85 | 0.671131314329666,0.85452785256788,0.0578100185948108,-1.15492501597167 86 | 0.285957954777292,0.98309270506043,1.58919441858680,-1.62563811065679 87 | 0.392389497514938,-0.394185785485923,1.39084459385694,-0.739750425249076 88 | 0.5936436107339,-0.827458720555284,-0.84805598482989,0.202201924318366 89 | 0.396395259284278,0.755226967537884,-2.19810373211233,0.997634622960333 90 | 0.119613578896643,0.545098560396415,0.673557431272154,-0.950049483138302 91 | 0.0809296968797324,1.38429610379964,-0.214579519961673,0.191870925596037 92 | 0.226040618019244,1.36152953680865,-0.0869158593134269,-1.7466033937333 93 | 0.433219219149978,0.0699620565071049,-0.0355679990057799,-0.994160649448666 94 | 0.112119589915623,0.820894288811166,-0.820319522217722,0.109662175332649 95 | -0.342626281108291,2.05484141676728,-0.377927821473311,0.295449416006290 96 | 0.173606427742918,1.02495627388038,0.0594192701779076,-0.639574594778986 97 | 0.161425620552751,0.431684284366313,0.297519865398461,-1.54466825774715 98 | 0.182960338875149,0.595227913093178,0.278897441795062,-0.849411389575277 99 | 0.312496101004441,-0.0360081319088737,-0.734446292042805,-0.138468889183827 100 | -0.44083236091036,1.53485273905504,-0.0450535111247015,1.50618949403374 101 | 0.145409408669938,0.708254797009208,0.037837642415364,-0.331513943069683 102 | 1.23096388447485,0.0199934735037904,2.71818091543297,-0.188200605364002 103 | 0.688254289410537,1.16706741487289,1.05958283537970,-0.0991324078770557 104 | 1.27253592256374,-0.698115758085279,-0.396152599202575,0.426022851840753 105 | 0.958790493019075,0.364843653529848,0.387702252308568,-1.53375731053117 106 | 1.14284952864382,0.0817288283808422,1.02048900977019,-0.00110523673120788 107 | 1.6520401438859,-1.11818621048352,-1.24593447747317,-0.727860824503987 108 | 0.253484478139073,2.42127372100018,1.95115514412363,-0.635591986345171 109 | 1.42616906660505,-0.721657109304411,-1.50268366906111,-1.66589412369510 110 | 1.12885471320215,0.494972533448963,-1.24545832412222,-0.509596210700339 111 | 1.41846768943440,-1.58905026789707,1.51375241747130,0.718860134423417 112 | 0.80815022294068,-0.49171828711067,0.86691169214851,0.784011566450595 113 | 0.87702633185807,0.437739573217599,-0.134621397816769,0.505355102361191 114 | 1.05316567174354,-0.439034633559542,0.119168589612024,1.05619218508973 115 | 0.654663207074962,1.57692398960298,1.00802142101642,0.909672534164251 116 | 0.771265003060934,1.09545866240722,2.24926765807362,2.13459343068496 117 | 0.92617088820527,-0.24207625602493,1.71508431883601,1.42254482160265 118 | 0.948168344398858,-0.0851438854285283,0.157999815926211,-1.02134728618571 119 | 1.69581682558415,-2.38672472255988,0.478778010631198,-2.00289669993136 120 | 1.84588963990043,-0.522359920115089,-1.83711818575312,0.348775363540284 121 | 0.632598064103386,1.54511685450704,-1.23362480777392,-0.296819019056821 122 | 1.18069087993100,-0.767729504725075,0.783521512781777,1.2010742336260 123 | 0.583095487775923,1.23035233820623,1.83028039073048,0.394848273168769 124 | 1.70207314486254,-0.935158187813622,-2.04957102358384,-0.908293431680383 125 | 0.675381583281265,0.414926094192063,-0.230718892756886,1.05605939642684 126 | 1.10658218204094,-0.680023488654397,1.02320848710972,-0.391045164273848 127 | 1.27127852757505,-1.13861729156911,-0.734945317869469,-1.55910965911185 128 | 0.612034823302758,0.364796741495299,0.163941096720202,0.955421302863816 129 | 0.627900403394941,0.236834770316476,0.826921194838204,0.0260814000058303 130 | 1.03274855911850,0.425746178923240,0.551313153115525,0.342176499188168 131 | 1.16132818984037,-0.943208482490783,-1.60741904965904,-1.49964233501196 132 | 1.38195583564925,-0.761788073532689,-1.78394751980675,-0.144679157308328 133 | 1.57113385956897,-2.78952460178992,-0.409598667422244,-1.63811243520224 134 | 1.05017279778063,0.441068658300105,0.746490219630612,0.830340283643817 135 | 0.702321207365556,0.291126037579404,-0.547929983661238,-1.23713376623506 136 | 0.866275236445817,1.01478930824679,-0.618162866867606,-3.27383194247741 137 | 1.49615644233554,-1.39679864098684,-1.20000269936888,2.00683793099030 138 | 1.04278352669054,-0.28432721695895,2.62776210199152,0.359759977621583 139 | 0.926482994285829,-0.100078972691323,0.579920114664512,-1.43278974253810 140 | 0.5686641230767,0.334926566969710,1.00778169419681,0.132536390159035 141 | 1.02496865267056,-0.755736110430715,0.0975869618494816,1.36425283679903 142 | 1.12541444748239,-0.372808017257771,1.15388039715680,1.79843671931492 143 | 0.934832900398396,-0.83067394797889,0.406160167096019,3.27299349407842 144 | 0.688254289410537,1.16706741487289,1.05958283537970,-0.0991324078770557 145 | 1.24643882920919,-0.564054911769932,1.04616293992402,0.375116135411105 146 | 1.17627913668947,-0.618733571146933,1.80391675317007,1.56160997354874 147 | 0.945455049018614,-0.380686409020513,0.635862603478377,2.76058346973295 148 | 0.742688191129407,0.761885137702895,-0.435880497217561,1.64760498552558 149 | 0.85803259212669,-0.160081722976703,0.466573021172749,0.887393371093684 150 | 0.92446159784469,-0.236752165116549,2.58618522557382,0.288855546108500 151 | 0.67607348222037,0.57379542535882,1.29768343060026,-1.00422607084522 152 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set/eigen-other_rotated.csv: -------------------------------------------------------------------------------- 1 | "V1","V2","V3","V4" 2 | -1.30685496249706,4.03208300402822,3.65767848060516,1.28450543847617 3 | -2.23875589861001,0.932339532834422,0.795769384905854,0.130110624724465 4 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set/eigen-other_whitened.csv: -------------------------------------------------------------------------------- 1 | "V1","V2","V3","V4" 2 | -0.635546729970466,8.18503893330951,13.0790371206328,8.320080383746 3 | -1.08874667150899,1.89262854154774,2.84549267515850,0.842760819892815 4 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set/iris-other.csv: -------------------------------------------------------------------------------- 1 | "Sepal.Length","Sepal.Width","Petal.Length","Petal.Width" 2 | 1,2,3,4 3 | 4,3,2,1 4 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set/iris.csv: -------------------------------------------------------------------------------- 1 | "Sepal.Length","Sepal.Width","Petal.Length","Petal.Width" 2 | 5.1,3.5,1.4,0.2 3 | 4.9,3,1.4,0.2 4 | 4.7,3.2,1.3,0.2 5 | 4.6,3.1,1.5,0.2 6 | 5,3.6,1.4,0.2 7 | 5.4,3.9,1.7,0.4 8 | 4.6,3.4,1.4,0.3 9 | 5,3.4,1.5,0.2 10 | 4.4,2.9,1.4,0.2 11 | 4.9,3.1,1.5,0.1 12 | 5.4,3.7,1.5,0.2 13 | 4.8,3.4,1.6,0.2 14 | 4.8,3,1.4,0.1 15 | 4.3,3,1.1,0.1 16 | 5.8,4,1.2,0.2 17 | 5.7,4.4,1.5,0.4 18 | 5.4,3.9,1.3,0.4 19 | 5.1,3.5,1.4,0.3 20 | 5.7,3.8,1.7,0.3 21 | 5.1,3.8,1.5,0.3 22 | 5.4,3.4,1.7,0.2 23 | 5.1,3.7,1.5,0.4 24 | 4.6,3.6,1,0.2 25 | 5.1,3.3,1.7,0.5 26 | 4.8,3.4,1.9,0.2 27 | 5,3,1.6,0.2 28 | 5,3.4,1.6,0.4 29 | 5.2,3.5,1.5,0.2 30 | 5.2,3.4,1.4,0.2 31 | 4.7,3.2,1.6,0.2 32 | 4.8,3.1,1.6,0.2 33 | 5.4,3.4,1.5,0.4 34 | 5.2,4.1,1.5,0.1 35 | 5.5,4.2,1.4,0.2 36 | 4.9,3.1,1.5,0.2 37 | 5,3.2,1.2,0.2 38 | 5.5,3.5,1.3,0.2 39 | 4.9,3.6,1.4,0.1 40 | 4.4,3,1.3,0.2 41 | 5.1,3.4,1.5,0.2 42 | 5,3.5,1.3,0.3 43 | 4.5,2.3,1.3,0.3 44 | 4.4,3.2,1.3,0.2 45 | 5,3.5,1.6,0.6 46 | 5.1,3.8,1.9,0.4 47 | 4.8,3,1.4,0.3 48 | 5.1,3.8,1.6,0.2 49 | 4.6,3.2,1.4,0.2 50 | 5.3,3.7,1.5,0.2 51 | 5,3.3,1.4,0.2 52 | 7,3.2,4.7,1.4 53 | 6.4,3.2,4.5,1.5 54 | 6.9,3.1,4.9,1.5 55 | 5.5,2.3,4,1.3 56 | 6.5,2.8,4.6,1.5 57 | 5.7,2.8,4.5,1.3 58 | 6.3,3.3,4.7,1.6 59 | 4.9,2.4,3.3,1 60 | 6.6,2.9,4.6,1.3 61 | 5.2,2.7,3.9,1.4 62 | 5,2,3.5,1 63 | 5.9,3,4.2,1.5 64 | 6,2.2,4,1 65 | 6.1,2.9,4.7,1.4 66 | 5.6,2.9,3.6,1.3 67 | 6.7,3.1,4.4,1.4 68 | 5.6,3,4.5,1.5 69 | 5.8,2.7,4.1,1 70 | 6.2,2.2,4.5,1.5 71 | 5.6,2.5,3.9,1.1 72 | 5.9,3.2,4.8,1.8 73 | 6.1,2.8,4,1.3 74 | 6.3,2.5,4.9,1.5 75 | 6.1,2.8,4.7,1.2 76 | 6.4,2.9,4.3,1.3 77 | 6.6,3,4.4,1.4 78 | 6.8,2.8,4.8,1.4 79 | 6.7,3,5,1.7 80 | 6,2.9,4.5,1.5 81 | 5.7,2.6,3.5,1 82 | 5.5,2.4,3.8,1.1 83 | 5.5,2.4,3.7,1 84 | 5.8,2.7,3.9,1.2 85 | 6,2.7,5.1,1.6 86 | 5.4,3,4.5,1.5 87 | 6,3.4,4.5,1.6 88 | 6.7,3.1,4.7,1.5 89 | 6.3,2.3,4.4,1.3 90 | 5.6,3,4.1,1.3 91 | 5.5,2.5,4,1.3 92 | 5.5,2.6,4.4,1.2 93 | 6.1,3,4.6,1.4 94 | 5.8,2.6,4,1.2 95 | 5,2.3,3.3,1 96 | 5.6,2.7,4.2,1.3 97 | 5.7,3,4.2,1.2 98 | 5.7,2.9,4.2,1.3 99 | 6.2,2.9,4.3,1.3 100 | 5.1,2.5,3,1.1 101 | 5.7,2.8,4.1,1.3 102 | 6.3,3.3,6,2.5 103 | 5.8,2.7,5.1,1.9 104 | 7.1,3,5.9,2.1 105 | 6.3,2.9,5.6,1.8 106 | 6.5,3,5.8,2.2 107 | 7.6,3,6.6,2.1 108 | 4.9,2.5,4.5,1.7 109 | 7.3,2.9,6.3,1.8 110 | 6.7,2.5,5.8,1.8 111 | 7.2,3.6,6.1,2.5 112 | 6.5,3.2,5.1,2 113 | 6.4,2.7,5.3,1.9 114 | 6.8,3,5.5,2.1 115 | 5.7,2.5,5,2 116 | 5.8,2.8,5.1,2.4 117 | 6.4,3.2,5.3,2.3 118 | 6.5,3,5.5,1.8 119 | 7.7,3.8,6.7,2.2 120 | 7.7,2.6,6.9,2.3 121 | 6,2.2,5,1.5 122 | 6.9,3.2,5.7,2.3 123 | 5.6,2.8,4.9,2 124 | 7.7,2.8,6.7,2 125 | 6.3,2.7,4.9,1.8 126 | 6.7,3.3,5.7,2.1 127 | 7.2,3.2,6,1.8 128 | 6.2,2.8,4.8,1.8 129 | 6.1,3,4.9,1.8 130 | 6.4,2.8,5.6,2.1 131 | 7.2,3,5.8,1.6 132 | 7.4,2.8,6.1,1.9 133 | 7.9,3.8,6.4,2 134 | 6.4,2.8,5.6,2.2 135 | 6.3,2.8,5.1,1.5 136 | 6.1,2.6,5.6,1.4 137 | 7.7,3,6.1,2.3 138 | 6.3,3.4,5.6,2.4 139 | 6.4,3.1,5.5,1.8 140 | 6,3,4.8,1.8 141 | 6.9,3.1,5.4,2.1 142 | 6.7,3.1,5.6,2.4 143 | 6.9,3.1,5.1,2.3 144 | 5.8,2.7,5.1,1.9 145 | 6.8,3.2,5.9,2.3 146 | 6.7,3.3,5.7,2.5 147 | 6.7,3,5.2,2.3 148 | 6.3,2.5,5,1.9 149 | 6.5,3,5.2,2 150 | 6.2,3.4,5.4,2.3 151 | 5.9,3,5.1,1.8 152 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set/make_pca.R: -------------------------------------------------------------------------------- 1 | d <- iris 2 | numeric.d <- subset(d, select=-Species) 3 | write.csv(numeric.d, "iris.csv", row.names=FALSE) 4 | data <- numeric.d 5 | data.means <- colMeans(data) 6 | 7 | ##built-in PCA{ 8 | pca <- prcomp(data) 9 | pca.rotation <- t(pca$rotation) 10 | pca.scaling <- diag(1/pca$sdev) 11 | ##built-in PCA} 12 | 13 | #PCA{ 14 | data.cov <- cov(data) 15 | eigen.dec <- eigen(data.cov, TRUE) 16 | eigen.rotation <- t(eigen.dec$vectors) 17 | eigen.scaling <- diag(1/(sqrt(eigen.dec$values))) 18 | #PCA} 19 | 20 | run.experiment <- function(rotation, scaling, prefix){ 21 | 22 | transform.data <- function(means, rotation, scaling, data){ 23 | data.centered <- list() 24 | for(c in seq(1:ncol(data))){ 25 | data.centered[[paste("x", c, sep="")]] <- data[[c]] - means[[c]] 26 | } 27 | data.centered <- as.data.frame(data.centered) 28 | rotated <- t(rotation%*%t(data.centered)) 29 | whitened <- t(scaling%*%rotation%*%t(data.centered)) 30 | return(list(rotated=rotated, whitened=whitened)) 31 | } 32 | 33 | data.transformed <- transform.data(data.means, rotation, scaling, data) 34 | 35 | data.rotated <- data.transformed$rotated 36 | write.csv(data.rotated, paste(prefix, "-iris_rotated.csv", sep=""), 37 | row.names=FALSE) 38 | data.whitened <-data.transformed$whitened 39 | write.csv(data.whitened, paste(prefix, "-iris_whitened.csv", sep=""), 40 | row.names=FALSE) 41 | 42 | other.data <- read.csv("iris-other.csv") 43 | 44 | other.data.transformed <- transform.data(data.means, 45 | rotation, scaling, other.data) 46 | other.data.rotated <- other.data.transformed$rotated 47 | write.csv(other.data.rotated, paste(prefix, "-other_rotated.csv", sep=""), 48 | row.names=FALSE) 49 | other.data.whitened <- other.data.transformed$whitened 50 | write.csv(other.data.whitened, paste(prefix, "-other_whitened.csv", sep=""), 51 | row.names=FALSE) 52 | } 53 | 54 | run.experiment(eigen.rotation, eigen.scaling, "eigen") 55 | run.experiment(pca.rotation, pca.scaling, "built-in") -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set_normalized/built-in-iris_rotated.csv: -------------------------------------------------------------------------------- 1 | "PC1","PC2","PC3","PC4" 2 | -2.68412562596953,-0.319397246585102,0.0279148275894137,0.00226243707131613 3 | -2.71414168729432,0.17700122506478,0.210464272378244,0.0990265503235855 4 | -2.88899056905929,0.144949426085557,-0.0179002563208901,0.0199683897090281 5 | -2.74534285564141,0.318298979251916,-0.0315593736056811,-0.0755758166136834 6 | -2.72871653655453,-0.326754512934921,-0.0900792405512013,-0.0612585925856941 7 | -2.28085963284449,-0.741330449062916,-0.168677658209105,-0.0242008575695235 8 | -2.82053775074061,0.0894613845285683,-0.257892158255618,-0.0481431064876537 9 | -2.62614497314663,-0.163384959698329,0.0218793178867195,-0.0452978705519318 10 | -2.88638273178055,0.578311754186703,-0.02075957026478,-0.0267447357617892 11 | -2.67275579782095,0.113774245874116,0.197632724988146,-0.0562954012688952 12 | -2.50694709065185,-0.645068898648575,0.07531800937912,-0.0150199244901802 13 | -2.61275523090872,-0.0147299391613751,-0.10215025995659,-0.156379207832191 14 | -2.78610926618802,0.235112000201718,0.206844430449644,-0.00788791149321666 15 | -3.22380374386565,0.511394587006382,-0.0612996724570991,-0.021679811846814 16 | -2.64475038994203,-1.17876463643758,0.151627523617809,0.159209717669961 17 | -2.38603903353113,-1.33806233040065,-0.277776902703136,0.00655154586753171 18 | -2.62352787522442,-0.810679514181258,-0.138183227880719,0.16773473722833 19 | -2.64829670625438,-0.311849144593355,-0.0266683156125939,0.0776281795977208 20 | -2.19982032361758,-0.872839038962212,0.120305523394731,0.0270518681418772 21 | -2.58798639987877,-0.513560308749277,-0.213665172224716,-0.066272650201581 22 | -2.31025621524252,-0.391345935653895,0.239444043244953,-0.0150707907892687 23 | -2.54370522875715,-0.432996063279029,-0.208457232416715,0.0410654026914363 24 | -3.21593941564861,-0.133468069538526,-0.292396750745242,0.00448212505056944 25 | -2.3027331822262,-0.0987088548140999,-0.0391232587428806,0.148352589285365 26 | -2.35575404912377,0.0372818596773819,-0.125021082702879,-0.300330903930581 27 | -2.50666890692582,0.146016880495267,0.253420042344657,0.0346074722150559 28 | -2.46882007312134,-0.130951489435251,-0.0949105760993919,0.0574497158014139 29 | -2.56231990619601,-0.367718857434201,0.078494205137924,-0.0141727423377496 30 | -2.63953471538454,-0.312039980235284,0.145908895730029,0.0657834667283267 31 | -2.63198938727434,0.196961224924314,-0.0407710790671793,-0.123983306389362 32 | -2.58739847668935,0.204318491274133,0.0772229890734356,-0.060462276732352 33 | -2.40993249700217,-0.410924264229574,0.145524972005131,0.231628491662468 34 | -2.64886233434991,-0.813363820296963,-0.22566914972012,-0.281372347063831 35 | -2.59873674910058,-1.09314575944936,-0.15781081295822,-0.0953488583333836 36 | -2.6369268781058,0.121322347865863,0.143049581786139,0.0190703412575093 37 | -2.86624165211867,-0.0693644715800813,0.164332306653026,0.162598446279684 38 | -2.62523804985037,-0.599370021379425,0.268350375693936,0.17644121293237 39 | -2.80068411544822,-0.268643737797983,-0.0936990824798004,-0.168173054402496 40 | -2.98050204378199,0.487958344428615,-0.0729270456926923,-0.0107331474289386 41 | -2.59000631396809,-0.229043836827013,0.0800823030173258,-0.0137491512615344 42 | -2.7701024260279,-0.263527533744257,-0.0772476931611038,0.0940633590067869 43 | -2.8493687050431,0.940960573641196,0.349230377305967,0.319987486954153 44 | -2.99740654659491,0.341926057471609,-0.19250921171271,-0.0746777681621643 45 | -2.40561448509748,-0.188871428930261,-0.263867945513415,0.17620889048761 46 | -2.20948923778368,-0.436663141639188,-0.298742745755109,-0.18284250247303 47 | -2.71445142675771,0.250208204185211,0.0976781440456296,0.142843573559593 48 | -2.53814825899894,-0.503771144461438,-0.166705636604805,-0.189622291427449 49 | -2.83946216764285,0.227945569493827,-0.0837268490335934,-0.059564228280833 50 | -2.54308574983039,-0.57941002151989,0.0171150242485131,-0.0465686437805779 51 | -2.70335978233516,-0.107706082499412,0.0892940084788246,0.0346583385141445 52 | 1.28482568885835,-0.685160470467309,0.406568025467693,0.0185252879232697 53 | 0.932488532312321,-0.318333638262629,0.0180141866462397,0.000566512106216333 54 | 1.4643023219914,-0.504262815309205,0.338325764980895,-0.00165317587303715 55 | 0.183317719958373,0.827959011820632,0.179591391875355,0.0935668402366621 56 | 1.08810325771167,-0.0745906751977167,0.307757896234784,0.112020574163602 57 | 0.64166908425808,0.418246871568678,-0.0410760908239567,-0.243116766512924 58 | 1.09506066263245,-0.28346827006153,-0.169810239860576,-0.0835565724233163 59 | -0.749122669829655,1.0048909611819,-0.0123029192375955,-0.0179077225553055 60 | 1.04413182605344,-0.228361899788396,0.415336084759397,-0.0391345019654227 61 | -0.00874540408289377,0.723081905004834,-0.28114143117641,-0.00561891787511379 62 | -0.507840883835324,1.26597119052639,0.269817182768852,0.0455624408026163 63 | 0.5116985574476,0.10398123549904,-0.130547750240487,0.0507192324858447 64 | 0.264976508112049,0.550036463680474,0.694146830144418,0.0571855194760486 65 | 0.984934510470892,0.124817854126357,0.0621144083222603,-0.169496254590469 66 | -0.173925371681766,0.254854208702589,-0.0904576907257047,0.125217292125236 67 | 0.92786078094425,-0.467179494441511,0.314620975832172,0.0998031365170802 68 | 0.660283761696939,0.35296966572385,-0.328027528378596,-0.187878621483738 69 | 0.236104993317674,0.333610766824915,0.271161837251066,-0.213757369637274 70 | 0.944733728019815,0.543145550779766,0.499519046485112,0.25719217719155 71 | 0.0452269762987021,0.583834377471864,0.235002104972055,-0.0415766475595119 72 | 1.11628317735005,0.0846168521947877,-0.459620991359104,-0.0750315528649476 73 | 0.35788841799731,0.0689250316560134,0.229853887608951,0.122997604145983 74 | 1.29818387535892,0.327787308333917,0.347854352257307,0.000888370584254616 75 | 0.921728922447039,0.182737793621367,0.231071777736284,-0.288255429276666 76 | 0.714853325911414,-0.149055944369785,0.321800937244473,0.0417197555521726 77 | 0.90017437317217,-0.328504473834324,0.316209073711573,0.100226727593295 78 | 1.33202443672209,-0.244440876016344,0.521702779664418,0.0353331921094627 79 | 1.55780215506607,-0.267495447310255,0.16492098374358,0.0699692822661265 80 | 0.813290649817544,0.163350300687616,-0.0354245048461607,-0.0297114339555352 81 | -0.305583778024307,0.368262189754587,0.318491580623047,0.0745696136357219 82 | -0.0681264920683613,0.705172131799465,0.244213810433554,0.00683084221616703 83 | -0.1896224723785,0.680286763528133,0.306420561217658,-0.0205510016107744 84 | 0.136428711558017,0.314032438249236,0.177242766011244,0.032941912814462 85 | 1.38002643591551,0.420954287313882,-0.0161671275207295,-0.178304462892685 86 | 0.588006443339866,0.484287419981218,-0.444433498639808,-0.250976060064533 87 | 0.806858312500414,-0.194182314713151,-0.388963063098211,-0.114207243262195 88 | 1.22069088244436,-0.407619593611008,0.237167009883875,0.0312171829450947 89 | 0.815095235766602,0.372037059909501,0.614720842591822,0.154020999761988 90 | 0.245957679886695,0.268524396622014,-0.188366811646195,-0.146674511738694 91 | 0.166413217145459,0.681926724863626,0.0600092258553377,0.0296222195034364 92 | 0.464800288403782,0.67071154451172,0.0243068557189511,-0.269651428187435 93 | 0.890815198469452,0.0344644443682683,0.00994693289434812,-0.153484666257619 94 | 0.230548023559458,0.404385848007325,0.229410241439156,0.0169303244816114 95 | -0.704531759244661,1.01224822753171,0.10569114890302,0.0456133071017048 96 | 0.356981494701049,0.504910093337108,-0.016617170198266,-0.0987414793383188 97 | 0.331934479945061,0.212654683781169,-0.0832042908956773,-0.238475433674164 98 | 0.376215651066673,0.293218929251419,-0.0779963510876762,-0.131137380781147 99 | 0.64257600755434,-0.0177381901124168,0.20539496698326,-0.0213776830286225 100 | -0.906469864948834,0.756093366599014,0.0125996475578901,0.232534844283671 101 | 0.299000841878146,0.348897806450335,-0.0105816604955711,-0.0511811717150702 102 | 2.53119272780363,0.00984910949880183,-0.760165427245896,-0.0290555727786993 103 | 1.4152358767039,0.574916347546489,-0.296322527387965,-0.0153046738942667 104 | 2.61667601599569,-0.343903151341735,0.110787883219108,0.065772041238164 105 | 1.97153105304344,0.179727904352245,-0.108424662463424,-0.236790934199226 106 | 2.35000592004464,0.0402609471425308,-0.285389563184442,-0.000170633278352539 107 | 3.39703873605326,-0.550836673028056,0.348437555797466,-0.112371653206092 108 | 0.521232243909776,1.19275872700065,-0.545659295646813,-0.0981266196306472 109 | 2.93258706899369,-0.355500002977497,0.420239935767967,-0.257191032191495 110 | 2.32122881657338,0.24383150231069,0.348304394934844,-0.0786746129701119 111 | 2.91675096678607,-0.782791948815279,-0.423335417682559,0.110982071035577 112 | 1.66177415363653,-0.242228407755067,-0.24244018972577,0.121040551831856 113 | 1.80340195296509,0.215637617333555,0.0376481682314818,0.0780198444491916 114 | 2.16559179608015,-0.216275585074025,-0.0333266418443259,0.163061478164825 115 | 1.34616357945845,0.776818347344339,-0.281902882118465,0.140440868774429 116 | 1.58592822387322,0.539640714026719,-0.629029326408011,0.329551728371144 117 | 1.90445637479343,-0.119250692091973,-0.479639819626591,0.219621262721746 118 | 1.94968905939907,-0.0419432596632118,-0.044186167630123,-0.157681907285581 119 | 3.48705536429028,-1.17573932971343,-0.1338948739361,-0.309219573021656 120 | 3.79564542207289,-0.25732297342048,0.513767763817803,0.0538460965051755 121 | 1.30079171263766,0.761149636435063,0.344995038313417,-0.0458247548865627 122 | 2.42781791306605,-0.378196012617051,-0.219119324301944,0.185429264375879 123 | 1.19900110546556,0.60609152775793,-0.511855508697001,0.0609591170836566 124 | 3.49992003892454,-0.460674098911896,0.573182242568001,-0.140227954408337 125 | 1.38876613169147,0.204399327352151,0.0645227566312678,0.163040977430243 126 | 2.27543050387221,-0.334990605821678,-0.286150091169151,-0.0603719696243374 127 | 2.61409047381083,-0.560901355123078,0.205534524353624,-0.240704986483341 128 | 1.25850816051149,0.179704794722746,-0.0458477039272505,0.147503846472696 129 | 1.29113205911502,0.116668651174011,-0.231256462659971,0.00402660774960928 130 | 2.1236087227739,0.209729476677302,-0.154180023928831,0.052827323036998 131 | 2.38800301600347,-0.464639804708737,0.449530191941849,-0.231524053403998 132 | 2.84167277810387,-0.375269167195104,0.498898075870768,-0.0223364626091533 133 | 3.23067366143209,-1.37416508679305,0.114548205475418,-0.25290192339528 134 | 2.15943764248905,0.217277578669049,-0.208763167130838,0.128193065563403 135 | 1.44416124232951,0.14341341045758,0.153233888063089,-0.19099635791451 136 | 1.78129481004511,0.499901681078136,0.172875189113419,-0.505434411785802 137 | 3.07649993168719,-0.688085677571176,0.33559229243454,0.309828044634432 138 | 2.14424331430208,-0.14006420108979,-0.734878936725511,0.055541969126137 139 | 1.90509814881408,-0.0493005260130306,-0.162180235770738,-0.221202936942591 140 | 1.1693263393415,0.164990262023109,-0.281835840208481,0.0204617871586755 141 | 2.10761114325724,-0.372287871960798,-0.0272911321416314,0.210621785788073 142 | 2.3141547052356,-0.183651279169019,-0.322693747173059,0.277653777387566 143 | 1.9222678009026,-0.409203466816062,-0.113586595799357,0.505304966939273 144 | 1.4152358767039,0.574916347546489,-0.296322527387965,-0.0153046738942667 145 | 2.56301337507748,-0.277862602929195,-0.292569524596744,0.057912747686555 146 | 2.41874618273283,-0.304798197854692,-0.50448266397718,0.241091000481281 147 | 1.94410979454697,-0.187532302800605,-0.177825090632658,0.426195940025627 148 | 1.52716661481452,0.375316982580488,0.121898171867181,0.25436744199041 149 | 1.76434571704443,-0.0788588545184761,-0.130481631287849,0.137001273865618 150 | 1.90094161421843,-0.116627958512024,-0.723251563489917,0.0445953047082615 151 | 1.39018886194792,0.28266093799055,-0.362909648085376,-0.155038628230112 152 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set_normalized/built-in-iris_whitened.csv: -------------------------------------------------------------------------------- 1 | "V1","V2","V3","V4" 2 | -1.30533786331985,-0.64836931578024,0.0998171567550143,0.0146544014004704 3 | -1.31993520592405,0.359308555144159,0.752572990107817,0.641421074709278 4 | -1.40496731601559,0.294244115184601,-0.0640072981075774,0.129340524793864 5 | -1.33510888707713,0.646139857489741,-0.112849235131331,-0.489524489704802 6 | -1.32702321343288,-0.663304403043036,-0.322103141983288,-0.396788054951918 7 | -1.10922246368193,-1.50488434438621,-0.603153438673292,-0.156755335012743 8 | -1.37167749726127,0.181604623382644,-0.922164462740666,-0.311835593608468 9 | -1.27714084424687,-0.33166783890907,0.0782355289924737,-0.29340625030883 10 | -1.4036990785276,1.17396001493018,-0.074231562872777,-0.173232704755309 11 | -1.29980851438097,0.230959191851262,0.706690257243205,-0.36464015625196 12 | -1.21917280141662,-1.30947553530788,0.269320293116278,-0.0972880109128571 13 | -1.27062917528692,-0.0299014493006932,-0.36526639750837,-1.01290935837052 14 | -1.35493431503895,0.477272137854497,0.739629248003086,-0.0510920823825325 15 | -1.56779289689919,1.03811965198861,-0.219193867312358,-0.140425857195252 16 | -1.2861889881828,-2.3928660280086,0.542185985023718,1.03124331685121 17 | -1.16037307035593,-2.71623680826575,-0.993267844883855,0.0424360898933425 18 | -1.27586810314384,-1.64566140612208,-0.494112201628444,1.08646211614472 19 | -1.28791362465772,-0.633046836403374,-0.0953599097600728,0.502818185856118 20 | -1.06981161132551,-1.77184386067469,0.430185543819729,0.175222082156323 21 | -1.25858365377304,-1.0425160190194,-0.764018689376744,-0.429265428081925 22 | -1.12351854270487,-0.794423556389948,0.856198144949314,-0.0976174853429077 23 | -1.23704893545064,-0.878972390292536,-0.745396265773345,0.265991440089949 24 | -1.56396833470585,-0.270937216430094,-1.0455451394177,0.0290319056608901 25 | -1.11985995841649,-0.200376782647739,-0.139895990336909,0.960918833831773 26 | -1.14564494569049,0.0756813470012126,-0.447047325292007,-1.94532244673861 27 | -1.21903751574033,0.296411023924892,0.906173180205208,0.224161721766711 28 | -1.20063095705713,-0.265828614721369,-0.339378913298912,0.372116955813102 29 | -1.24610158300161,-0.746461112433476,0.28067765611362,-0.0918005887527302 30 | -1.28365251320683,-0.633434228517446,0.521737455493318,0.426096857752861 31 | -1.27998308641915,0.399826911486507,-0.145788225891214,-0.80307256357423 32 | -1.25829773630612,0.414761998749302,0.276132072847089,-0.391630107221841 33 | -1.17199288511156,-0.834167128504153,0.520364630441565,1.50031880914712 34 | -1.28818869962534,-1.65111048791033,-0.806942218082213,-1.82252287550573 35 | -1.26381173913066,-2.21906160957904,-0.564296039595127,-0.617599694068462 36 | -1.28238427571884,0.246281671228129,0.511513190728118,0.123523628203687 37 | -1.39390411452277,-0.140808336510979,0.587615437013082,1.05319300549172 38 | -1.27669979137428,-1.21670782956302,0.959560700495491,1.14285625473449 39 | -1.36202232254778,-0.545340820332698,-0.335046884088017,-1.08930121204373 40 | -1.44947096805334,0.990544600146209,-0.260770743730052,-0.0695214256821703 41 | -1.25956597379411,-0.464953900996273,0.286356337612289,-0.0890568776726681 42 | -1.34714990497596,-0.534955039750139,-0.276220409118676,0.609273176009322 43 | -1.38569850131658,1.91012906288586,1.24876942920408,2.07264331742322 44 | -1.45769192737387,0.694102301446212,-0.688369723967025,-0.483707593114623 45 | -1.16989295939313,-0.383404805317635,-0.943532536447573,1.14135144100817 46 | -1.074513775649,-0.886416477906659,-1.06823699293668,-1.18431909478373 47 | -1.32008583771468,0.507917096608229,0.349275114972913,0.925235486528763 48 | -1.2343464825697,-1.0226442329623,-0.596101932122869,-1.22823357532694 49 | -1.38088077660287,0.462724442705774,-0.299388415988607,-0.385813210631664 50 | -1.23674767186938,-1.17618947322068,0.0611994844964614,-0.301637383549021 51 | -1.31469177445208,-0.21864095499304,0.319295328372173,0.224491196196761 52 | 0.624833503769789,-1.39086053554376,1.45379598708594,0.119993174054982 53 | 0.453485699984389,-0.646210214511608,0.0644146873743796,0.00366944827238402 54 | 0.71211617137038,-1.02364231386175,1.2097769835471,-0.0107080559880357 55 | 0.0891506562002645,1.68073840249964,0.642178500198649,0.606057093028484 56 | 0.529163898943694,-0.151417413764848,1.10047314720693,0.725586792984088 57 | 0.312055048131848,0.849031858745081,-0.146878879460212,-1.57473139422714 58 | 0.532547408264448,-0.575434291529598,-0.607203296401435,-0.541217949203086 59 | -0.36431163122132,2.03990632950448,-0.0439924772649883,-0.115993040346108 60 | 0.507779812411925,-0.463569583955783,1.48514859873843,-0.253484487007271 61 | -0.00425304500243346,1.46784020530415,-1.00529864338862,-0.0363952124998971 62 | -0.246972022396537,2.56989339568521,0.964805673306349,0.295119941576229 63 | 0.248848077444674,0.211079598322503,-0.466809447704091,0.328521840892117 64 | 0.128862772137948,1.11656180328302,2.48211323296148,0.370405686558579 65 | 0.478991108675721,0.253377471291071,0.222107179863053,-1.0978719285218 66 | -0.0845829907704791,0.517348382576569,-0.323456394847608,0.811065414524747 67 | 0.451235142475334,-0.948363996234055,1.12501397912861,0.646451228230814 68 | 0.321107695682818,0.716520580886021,-1.17295280134718,-1.21693936538447 69 | 0.114822042796569,0.677222446141402,0.969613855868198,-1.38456284008424 70 | 0.459440755681524,1.10257340316278,1.78616797131961,1.66590154016232 71 | 0.0219946801427526,1.18517081752474,0.840314770872876,-0.269302907889737 72 | 0.542868293303405,0.171770330356916,-1.6435014830536,-0.485999149909578 73 | 0.174047480615512,0.139916283226423,0.821905901325111,0.796687910264328 74 | 0.631329826615399,0.66540095476146,1.24384907253912,0.00575421049234492 75 | 0.448253111011722,0.370953661887337,0.826260803011714,-1.86710641371687 76 | 0.347645841909967,-0.302580256083282,1.15068790928244,0.270229856088498 77 | 0.437770751682837,-0.666856784796852,1.13069266062728,0.649194939310877 78 | 0.647787091370805,-0.496209548535389,1.86549202105904,0.228862400858198 79 | 0.757586797314863,-0.543009816149646,0.589720414134567,0.453209488577797 80 | 0.395517657154136,0.331597481887204,-0.126670076749425,-0.192448791123588 81 | -0.148610807188793,0.747564064974792,1.13885439293414,0.48300704773201 82 | -0.0331311205152218,1.43148376352797,0.87325376163276,0.0442451659796921 83 | -0.0922167690428317,1.38096701871713,1.09569113740906,-0.133114255686593 84 | 0.0663477003898789,0.637478874027197,0.633780341360448,0.213373454405783 85 | 0.671131314329666,0.854527852567878,-0.0578100185948115,-1.15492501597167 86 | 0.285957954777292,0.983092705060427,-1.58919441858681,-1.62563811065679 87 | 0.392389497514938,-0.394185785485922,-1.39084459385694,-0.739750425249071 88 | 0.593643610733899,-0.827458720555283,0.84805598482989,0.202201924318369 89 | 0.396395259284278,0.755226967537882,2.19810373211233,0.997634622960326 90 | 0.119613578896642,0.545098560396414,-0.673557431272154,-0.950049483138302 91 | 0.0809296968797324,1.38429610379964,0.214579519961675,0.191870925596031 92 | 0.226040618019244,1.36152953680865,0.0869158593134272,-1.7466033937333 93 | 0.433219219149977,0.0699620565071039,0.0355679990057788,-0.994160649448664 94 | 0.112119589915623,0.820894288811165,0.820319522217723,0.109662175332644 95 | -0.342626281108291,2.05484141676728,0.377927821473314,0.29544941600628 96 | 0.173606427742918,1.02495627388038,-0.0594192701779073,-0.639574594778989 97 | 0.161425620552751,0.431684284366312,-0.297519865398462,-1.54466825774715 98 | 0.182960338875149,0.595227913093177,-0.278897441795063,-0.849411389575278 99 | 0.312496101004441,-0.036008131908874,0.734446292042806,-0.138468889183828 100 | -0.44083236091036,1.53485273905504,0.0450535111247045,1.50618949403373 101 | 0.145409408669938,0.708254797009206,-0.0378376424153637,-0.331513943069685 102 | 1.23096388447485,0.0199934735037903,-2.71818091543297,-0.188200605363996 103 | 0.688254289410537,1.16706741487288,-1.0595828353797,-0.0991324078770566 104 | 1.27253592256374,-0.698115758085278,0.396152599202573,0.426022851840757 105 | 0.958790493019075,0.364843653529846,-0.387702252308571,-1.53375731053117 106 | 1.14284952864382,0.0817288283808416,-1.0204890097702,-0.00110523673120522 107 | 1.6520401438859,-1.11818621048352,1.24593447747317,-0.727860824503979 108 | 0.253484478139073,2.42127372100017,-1.95115514412363,-0.635591986345176 109 | 1.42616906660505,-0.721657109304412,1.50268366906111,-1.66589412369509 110 | 1.12885471320215,0.494972533448961,1.24545832412222,-0.50959621070034 111 | 1.41846768943439,-1.58905026789707,-1.5137524174713,0.718860134423427 112 | 0.80815022294068,-0.491718287110669,-0.866911692148512,0.784011566450599 113 | 0.87702633185807,0.437739573217598,0.134621397816769,0.50535510236119 114 | 1.05316567174354,-0.439034633559542,-0.119168589612026,1.05619218508973 115 | 0.654663207074962,1.57692398960298,-1.00802142101642,0.909672534164245 116 | 0.771265003060934,1.09545866240722,-2.24926765807363,2.13459343068496 117 | 0.92617088820527,-0.242076256024929,-1.71508431883601,1.42254482160265 118 | 0.948168344398858,-0.0851438854285292,-0.157999815926213,-1.0213472861857 119 | 1.69581682558415,-2.38672472255987,-0.478778010631205,-2.00289669993135 120 | 1.84588963990043,-0.52235992011509,1.83711818575312,0.348775363540286 121 | 0.632598064103386,1.54511685450703,1.23362480777392,-0.296819019056828 122 | 1.18069087993099,-0.767729504725074,-0.783521512781781,1.201074233626 123 | 0.583095487775923,1.23035233820622,-1.83028039073049,0.394848273168767 124 | 1.70207314486254,-0.935158187813622,2.04957102358383,-0.908293431680379 125 | 0.675381583281265,0.414926094192062,0.230718892756886,1.05605939642684 126 | 1.10658218204094,-0.680023488654396,-1.02320848710972,-0.391045164273842 127 | 1.27127852757505,-1.13861729156911,0.734945317869466,-1.55910965911184 128 | 0.612034823302758,0.364796741495299,-0.163941096720203,0.955421302863815 129 | 0.62790040339494,0.236834770316475,-0.826921194838206,0.026081400005832 130 | 1.0327485591185,0.425746178923238,-0.551313153115528,0.342176499188168 131 | 1.16132818984037,-0.943208482490783,1.60741904965904,-1.49964233501195 132 | 1.38195583564925,-0.761788073532689,1.78394751980675,-0.144679157308325 133 | 1.57113385956897,-2.78952460178992,0.409598667422238,-1.63811243520222 134 | 1.05017279778063,0.441068658300105,-0.746490219630615,0.830340283643817 135 | 0.702321207365556,0.291126037579402,0.547929983661237,-1.23713376623506 136 | 0.866275236445817,1.01478930824678,0.618162866867605,-3.27383194247741 137 | 1.49615644233554,-1.39679864098683,1.20000269936887,2.0068379309903 138 | 1.04278352669054,-0.284327216958949,-2.62776210199153,0.359759977621589 139 | 0.926482994285829,-0.100078972691324,-0.579920114664515,-1.43278974253809 140 | 0.5686641230767,0.334926566969709,-1.00778169419681,0.132536390159037 141 | 1.02496865267056,-0.755736110430713,-0.0975869618494836,1.36425283679903 142 | 1.12541444748239,-0.37280801725777,-1.1538803971568,1.79843671931492 143 | 0.934832900398396,-0.830673947978887,-0.406160167096021,3.27299349407842 144 | 0.688254289410537,1.16706741487288,-1.0595828353797,-0.0991324078770566 145 | 1.24643882920919,-0.564054911769932,-1.04616293992402,0.37511613541111 146 | 1.17627913668947,-0.618733571146931,-1.80391675317007,1.56160997354875 147 | 0.945455049018613,-0.380686409020512,-0.635862603478379,2.76058346973295 148 | 0.742688191129407,0.761885137702894,0.435880497217561,1.64760498552557 149 | 0.85803259212669,-0.160081722976703,-0.466573021172751,0.887393371093685 150 | 0.92446159784469,-0.236752165116549,-2.58618522557383,0.288855546108507 151 | 0.67607348222037,0.573795425358819,-1.29768343060026,-1.00422607084522 152 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set_normalized/eigen-iris_rotated.csv: -------------------------------------------------------------------------------- 1 | "V1","V2","V3","V4" 2 | -2.68412562596953,-0.319397246585102,-0.0279148275894132,0.00226243707131624 3 | -2.71414168729432,0.177001225064779,-0.210464272378243,0.0990265503235863 4 | -2.88899056905929,0.144949426085556,0.0179002563208909,0.0199683897090287 5 | -2.74534285564141,0.318298979251915,0.0315593736056818,-0.0755758166136827 6 | -2.72871653655453,-0.326754512934921,0.0900792405512016,-0.0612585925856942 7 | -2.28085963284449,-0.741330449062916,0.168677658209105,-0.0242008575695243 8 | -2.82053775074061,0.0894613845285677,0.257892158255619,-0.0481431064876535 9 | -2.62614497314663,-0.16338495969833,-0.0218793178867192,-0.0452978705519316 10 | -2.88638273178055,0.578311754186702,0.0207595702647809,-0.026744735761788 11 | -2.67275579782095,0.113774245874116,-0.197632724988146,-0.0562954012688945 12 | -2.50694709065185,-0.645068898648575,-0.0753180093791199,-0.0150199244901806 13 | -2.61275523090872,-0.0147299391613755,0.10215025995659,-0.15637920783219 14 | -2.78610926618801,0.235112000201717,-0.206844430449644,-0.00788791149321577 15 | -3.22380374386565,0.511394587006381,0.0612996724571001,-0.021679811846813 16 | -2.64475038994203,-1.17876463643758,-0.151627523617809,0.159209717669961 17 | -2.38603903353113,-1.33806233040065,0.277776902703135,0.00655154586753004 18 | -2.62352787522442,-0.810679514181259,0.13818322788072,0.16773473722833 19 | -2.64829670625438,-0.311849144593356,0.0266683156125944,0.0776281795977209 20 | -2.19982032361758,-0.872839038962212,-0.120305523394731,0.0270518681418765 21 | -2.58798639987877,-0.513560308749278,0.213665172224716,-0.0662726502015814 22 | -2.31025621524251,-0.391345935653895,-0.239444043244953,-0.0150707907892687 23 | -2.54370522875715,-0.432996063279029,0.208457232416715,0.041065402691436 24 | -3.21593941564861,-0.133468069538527,0.292396750745243,0.00448212505056944 25 | -2.3027331822262,-0.0987088548141006,0.0391232587428813,0.148352589285366 26 | -2.35575404912377,0.0372818596773818,0.125021082702879,-0.30033090393058 27 | -2.50666890692582,0.146016880495267,-0.253420042344657,0.0346074722150567 28 | -2.46882007312134,-0.130951489435251,0.0949105760993924,0.057449715801414 29 | -2.56231990619601,-0.367718857434201,-0.0784942051379238,-0.0141727423377496 30 | -2.63953471538454,-0.312039980235284,-0.145908895730029,0.0657834667283268 31 | -2.63198938727434,0.196961224924314,0.0407710790671798,-0.123983306389362 32 | -2.58739847668935,0.204318491274132,-0.077222989073435,-0.0604622767323513 33 | -2.40993249700217,-0.410924264229574,-0.14552497200513,0.231628491662468 34 | -2.64886233434991,-0.813363820296963,0.22566914972012,-0.281372347063832 35 | -2.59873674910058,-1.09314575944936,0.15781081295822,-0.0953488583333847 36 | -2.6369268781058,0.121322347865862,-0.143049581786138,0.0190703412575099 37 | -2.86624165211867,-0.0693644715800818,-0.164332306653025,0.162598446279684 38 | -2.62523804985037,-0.599370021379425,-0.268350375693936,0.17644121293237 39 | -2.80068411544822,-0.268643737797983,0.0936990824798007,-0.168173054402496 40 | -2.98050204378199,0.487958344428614,0.0729270456926934,-0.0107331474289376 41 | -2.59000631396809,-0.229043836827014,-0.0800823030173255,-0.0137491512615342 42 | -2.7701024260279,-0.263527533744258,0.0772476931611045,0.094063359006787 43 | -2.8493687050431,0.940960573641195,-0.349230377305965,0.319987486954155 44 | -2.9974065465949,0.341926057471609,0.192509211712711,-0.0746777681621636 45 | -2.40561448509748,-0.188871428930262,0.263867945513416,0.17620889048761 46 | -2.20948923778368,-0.436663141639189,0.298742745755109,-0.182842502473031 47 | -2.7144514267577,0.25020820418521,-0.0976781440456286,0.142843573559593 48 | -2.53814825899894,-0.503771144461439,0.166705636604805,-0.18962229142745 49 | -2.83946216764285,0.227945569493827,0.0837268490335941,-0.0595642282808324 50 | -2.54308574983039,-0.57941002151989,-0.017115024248513,-0.0465686437805782 51 | -2.70335978233516,-0.107706082499413,-0.089294008478824,0.0346583385141448 52 | 1.28482568885835,-0.685160470467309,-0.406568025467694,0.0185252879232689 53 | 0.93248853231232,-0.318333638262629,-0.0180141866462401,0.000566512106215777 54 | 1.4643023219914,-0.504262815309204,-0.338325764980896,-0.00165317587303776 55 | 0.183317719958373,0.827959011820632,-0.179591391875355,0.0935668402366633 56 | 1.08810325771167,-0.0745906751977165,-0.307757896234784,0.112020574163602 57 | 0.64166908425808,0.418246871568679,0.0410760908239566,-0.243116766512924 58 | 1.09506066263245,-0.283468270061529,0.169810239860575,-0.0835565724233169 59 | -0.749122669829655,1.00489096118189,0.0123029192375963,-0.0179077225553042 60 | 1.04413182605344,-0.228361899788396,-0.415336084759397,-0.0391345019654228 61 | -0.00874540408289391,0.723081905004834,0.281141431176411,-0.00561891787511312 62 | -0.507840883835324,1.26597119052639,-0.269817182768851,0.0455624408026181 63 | 0.511698557447599,0.10398123549904,0.130547750240487,0.0507192324858446 64 | 0.264976508112048,0.550036463680474,-0.694146830144418,0.0571855194760497 65 | 0.984934510470892,0.124817854126357,-0.0621144083222606,-0.169496254590469 66 | -0.173925371681766,0.254854208702589,0.090457690725705,0.125217292125236 67 | 0.927860780944249,-0.467179494441511,-0.314620975832172,0.0998031365170798 68 | 0.660283761696939,0.35296966572385,0.328027528378596,-0.187878621483738 69 | 0.236104993317674,0.333610766824915,-0.271161837251066,-0.213757369637273 70 | 0.944733728019815,0.543145550779766,-0.499519046485112,0.25719217719155 71 | 0.0452269762987019,0.583834377471864,-0.235002104972055,-0.041576647559511 72 | 1.11628317735005,0.0846168521947878,0.459620991359104,-0.075031552864948 73 | 0.357888417997309,0.0689250316560134,-0.229853887608951,0.122997604145983 74 | 1.29818387535892,0.327787308333917,-0.347854352257308,0.000888370584255171 75 | 0.921728922447039,0.182737793621368,-0.231071777736284,-0.288255429276666 76 | 0.714853325911414,-0.149055944369785,-0.321800937244474,0.0417197555521726 77 | 0.900174373172169,-0.328504473834324,-0.316209073711574,0.100226727593295 78 | 1.33202443672209,-0.244440876016344,-0.521702779664419,0.0353331921094627 79 | 1.55780215506607,-0.267495447310255,-0.16492098374358,0.0699692822661261 80 | 0.813290649817543,0.163350300687616,0.0354245048461606,-0.0297114339555352 81 | -0.305583778024307,0.368262189754587,-0.318491580623046,0.0745696136357226 82 | -0.0681264920683615,0.705172131799465,-0.244213810433554,0.00683084221616811 83 | -0.1896224723785,0.680286763528133,-0.306420561217658,-0.0205510016107733 84 | 0.136428711558017,0.314032438249236,-0.177242766011244,0.0329419128144625 85 | 1.38002643591551,0.420954287313882,0.0161671275207293,-0.178304462892685 86 | 0.588006443339866,0.484287419981218,0.444433498639808,-0.250976060064533 87 | 0.806858312500414,-0.194182314713151,0.388963063098211,-0.114207243262195 88 | 1.22069088244435,-0.407619593611007,-0.237167009883876,0.0312171829450942 89 | 0.815095235766602,0.372037059909501,-0.614720842591822,0.154020999761989 90 | 0.245957679886695,0.268524396622015,0.188366811646195,-0.146674511738693 91 | 0.166413217145459,0.681926724863626,-0.0600092258553374,0.0296222195034373 92 | 0.464800288403781,0.67071154451172,-0.024306855718951,-0.269651428187434 93 | 0.890815198469451,0.0344644443682687,-0.00994693289434842,-0.153484666257619 94 | 0.230548023559457,0.404385848007325,-0.229410241439156,0.016930324481612 95 | -0.704531759244661,1.01224822753171,-0.105691148903019,0.0456133071017062 96 | 0.356981494701049,0.504910093337108,0.0166171701982661,-0.0987414793383183 97 | 0.33193447994506,0.21265468378117,0.0832042908956772,-0.238475433674164 98 | 0.376215651066672,0.293218929251419,0.0779963510876762,-0.131137380781147 99 | 0.64257600755434,-0.0177381901124166,-0.20539496698326,-0.0213776830286224 100 | -0.906469864948834,0.756093366599013,-0.0125996475578894,0.232534844283672 101 | 0.299000841878145,0.348897806450336,0.0105816604955712,-0.0511811717150698 102 | 2.53119272780363,0.00984910949880198,0.760165427245896,-0.0290555727787004 103 | 1.4152358767039,0.574916347546489,0.296322527387965,-0.0153046738942664 104 | 2.61667601599569,-0.343903151341734,-0.110787883219109,0.0657720412381633 105 | 1.97153105304344,0.179727904352246,0.108424662463423,-0.236790934199226 106 | 2.35000592004464,0.040260947142531,0.285389563184442,-0.000170633278353094 107 | 3.39703873605326,-0.550836673028055,-0.348437555797467,-0.112371653206093 108 | 0.521232243909775,1.19275872700064,0.545659295646814,-0.0981266196306463 109 | 2.93258706899369,-0.355500002977496,-0.420239935767968,-0.257191032191496 110 | 2.32122881657338,0.243831502310691,-0.348304394934844,-0.0786746129701116 111 | 2.91675096678607,-0.782791948815278,0.423335417682558,0.110982071035575 112 | 1.66177415363653,-0.242228407755067,0.242440189725769,0.121040551831856 113 | 1.80340195296509,0.215637617333555,-0.0376481682314821,0.0780198444491917 114 | 2.16559179608015,-0.216275585074025,0.0333266418443255,0.163061478164825 115 | 1.34616357945845,0.776818347344339,0.281902882118465,0.14044086877443 116 | 1.58592822387322,0.539640714026718,0.629029326408011,0.329551728371144 117 | 1.90445637479343,-0.119250692091973,0.479639819626591,0.219621262721745 118 | 1.94968905939907,-0.0419432596632112,0.0441861676301224,-0.157681907285581 119 | 3.48705536429028,-1.17573932971343,0.133894873936098,-0.309219573021658 120 | 3.79564542207288,-0.257322973420479,-0.513767763817804,0.053846096505175 121 | 1.30079171263766,0.761149636435063,-0.344995038313417,-0.0458247548865617 122 | 2.42781791306605,-0.378196012617051,0.219119324301943,0.185429264375878 123 | 1.19900110546556,0.60609152775793,0.511855508697002,0.0609591170836569 124 | 3.49992003892454,-0.460674098911894,-0.573182242568003,-0.140227954408338 125 | 1.38876613169147,0.204399327352151,-0.0645227566312678,0.163040977430243 126 | 2.27543050387221,-0.334990605821677,0.28615009116915,-0.0603719696243384 127 | 2.61409047381083,-0.560901355123077,-0.205534524353625,-0.240704986483342 128 | 1.25850816051149,0.179704794722746,0.0458477039272504,0.147503846472696 129 | 1.29113205911502,0.116668651174011,0.231256462659971,0.00402660774960906 130 | 2.1236087227739,0.209729476677303,0.15418002392883,0.0528273230369978 131 | 2.38800301600347,-0.464639804708736,-0.44953019194185,-0.231524053403998 132 | 2.84167277810387,-0.375269167195103,-0.498898075870769,-0.0223364626091538 133 | 3.23067366143209,-1.37416508679305,-0.114548205475419,-0.252901923395282 134 | 2.15943764248905,0.217277578669049,0.208763167130838,0.128193065563402 135 | 1.44416124232951,0.143413410457581,-0.153233888063089,-0.19099635791451 136 | 1.78129481004511,0.499901681078137,-0.172875189113419,-0.505434411785801 137 | 3.07649993168719,-0.688085677571176,-0.335592292434541,0.309828044634431 138 | 2.14424331430208,-0.14006420108979,0.734878936725511,0.0555419691261361 139 | 1.90509814881408,-0.04930052601303,0.162180235770737,-0.221202936942592 140 | 1.1693263393415,0.164990262023109,0.281835840208481,0.0204617871586754 141 | 2.10761114325724,-0.372287871960798,0.0272911321416309,0.210621785788073 142 | 2.3141547052356,-0.183651279169019,0.322693747173059,0.277653777387565 143 | 1.9222678009026,-0.409203466816063,0.113586595799357,0.505304966939272 144 | 1.4152358767039,0.574916347546489,0.296322527387965,-0.0153046738942664 145 | 2.56301337507748,-0.277862602929195,0.292569524596743,0.057912747686554 146 | 2.41874618273283,-0.304798197854692,0.50448266397718,0.24109100048128 147 | 1.94410979454697,-0.187532302800606,0.177825090632658,0.426195940025626 148 | 1.52716661481452,0.375316982580488,-0.121898171867181,0.25436744199041 149 | 1.76434571704443,-0.0788588545184759,0.130481631287848,0.137001273865618 150 | 1.90094161421842,-0.116627958512024,0.723251563489917,0.0445953047082603 151 | 1.39018886194792,0.28266093799055,0.362909648085376,-0.155038628230112 152 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set_normalized/eigen-iris_whitened.csv: -------------------------------------------------------------------------------- 1 | "V1","V2","V3","V4" 2 | -1.30533786331985,-0.648369315780242,-0.0998171567550128,0.0146544014004713 3 | -1.31993520592405,0.359308555144158,-0.752572990107813,0.641421074709284 4 | -1.40496731601559,0.2942441151846,0.0640072981075797,0.129340524793868 5 | -1.33510888707713,0.646139857489742,0.112849235131334,-0.489524489704799 6 | -1.32702321343288,-0.663304403043038,0.322103141983289,-0.396788054951918 7 | -1.10922246368193,-1.50488434438621,0.603153438673292,-0.156755335012749 8 | -1.37167749726127,0.181604623382643,0.922164462740667,-0.311835593608466 9 | -1.27714084424687,-0.331667838909071,-0.0782355289924721,-0.293406250308829 10 | -1.4036990785276,1.17396001493018,0.0742315628727801,-0.173232704755302 11 | -1.29980851438097,0.230959191851262,-0.706690257243201,-0.364640156251957 12 | -1.21917280141662,-1.30947553530788,-0.269320293116277,-0.0972880109128607 13 | -1.27062917528692,-0.0299014493006935,0.365266397508372,-1.01290935837052 14 | -1.35493431503895,0.477272137854497,-0.739629248003082,-0.0510920823825263 15 | -1.56779289689919,1.03811965198861,0.219193867312362,-0.140425857195247 16 | -1.2861889881828,-2.3928660280086,-0.542185985023717,1.0312433168512 17 | -1.16037307035593,-2.71623680826575,0.993267844883853,0.0424360898933318 18 | -1.27586810314384,-1.64566140612209,0.494112201628445,1.08646211614471 19 | -1.28791362465772,-0.633046836403376,0.0953599097600744,0.50281818585612 20 | -1.06981161132551,-1.77184386067469,-0.430185543819728,0.175222082156319 21 | -1.25858365377304,-1.0425160190194,0.764018689376744,-0.429265428081928 22 | -1.12351854270487,-0.79442355638995,-0.856198144949312,-0.0976174853429086 23 | -1.23704893545064,-0.878972390292539,0.745396265773346,0.265991440089947 24 | -1.56396833470585,-0.270937216430096,1.04554513941771,0.0290319056608892 25 | -1.11985995841649,-0.20037678264774,0.139895990336911,0.960918833831775 26 | -1.14564494569049,0.075681347001213,0.447047325292008,-1.94532244673861 27 | -1.21903751574033,0.296411023924892,-0.906173180205204,0.224161721766715 28 | -1.20063095705713,-0.26582861472137,0.339378913298914,0.372116955813103 29 | -1.24610158300161,-0.746461112433478,-0.280677656113618,-0.0918005887527311 30 | -1.28365251320683,-0.633434228517448,-0.521737455493316,0.426096857752863 31 | -1.27998308641915,0.399826911486507,0.145788225891215,-0.803072563574228 32 | -1.25829773630612,0.414761998749302,-0.276132072847086,-0.391630107221838 33 | -1.17199288511156,-0.834167128504156,-0.520364630441562,1.50031880914712 34 | -1.28818869962534,-1.65111048791034,0.806942218082212,-1.82252287550574 35 | -1.26381173913066,-2.21906160957905,0.564296039595126,-0.61759969406847 36 | -1.28238427571884,0.246281671228128,-0.511513190728115,0.12352362820369 37 | -1.39390411452277,-0.140808336510981,-0.587615437013079,1.05319300549172 38 | -1.27669979137428,-1.21670782956303,-0.959560700495489,1.14285625473449 39 | -1.36202232254778,-0.5453408203327,0.335046884088017,-1.08930121204373 40 | -1.44947096805334,0.99054460014621,0.260770743730055,-0.069521425682165 41 | -1.25956597379411,-0.464953900996275,-0.286356337612287,-0.0890568776726672 42 | -1.34714990497596,-0.534955039750142,0.276220409118678,0.609273176009323 43 | -1.38569850131658,1.91012906288586,-1.24876942920408,2.07264331742324 44 | -1.45769192737387,0.694102301446212,0.688369723967027,-0.48370759311462 45 | -1.16989295939313,-0.383404805317637,0.943532536447574,1.14135144100817 46 | -1.074513775649,-0.886416477906662,1.06823699293668,-1.18431909478374 47 | -1.32008583771468,0.507917096608229,-0.349275114972909,0.92523548652877 48 | -1.2343464825697,-1.0226442329623,0.596101932122869,-1.22823357532694 49 | -1.38088077660287,0.462724442705774,0.299388415988608,-0.38581321063166 50 | -1.23674767186938,-1.17618947322068,-0.0611994844964603,-0.301637383549024 51 | -1.31469177445209,-0.218640954993041,-0.31929532837217,0.224491196196764 52 | 0.62483350376979,-1.39086053554376,-1.45379598708594,0.119993174054978 53 | 0.45348569998439,-0.646210214511609,-0.0644146873743811,0.00366944827238092 54 | 0.712116171370381,-1.02364231386175,-1.2097769835471,-0.010708055988039 55 | 0.0891506562002645,1.68073840249964,-0.642178500198646,0.606057093028493 56 | 0.529163898943694,-0.151417413764848,-1.10047314720693,0.72558679298409 57 | 0.312055048131848,0.849031858745083,0.146878879460211,-1.57473139422714 58 | 0.532547408264448,-0.575434291529598,0.607203296401432,-0.541217949203091 59 | -0.36431163122132,2.03990632950449,0.0439924772649907,-0.1159930403461 60 | 0.507779812411926,-0.463569583955783,-1.48514859873843,-0.253484487007272 61 | -0.00425304500243351,1.46784020530415,1.00529864338862,-0.0363952124998926 62 | -0.246972022396538,2.56989339568521,-0.964805673306344,0.295119941576241 63 | 0.248848077444674,0.211079598322503,0.46680944770409,0.328521840892117 64 | 0.128862772137947,1.11656180328302,-2.48211323296147,0.370405686558588 65 | 0.478991108675721,0.253377471291073,-0.222107179863054,-1.0978719285218 66 | -0.0845829907704791,0.51734838257657,0.323456394847608,0.81106541452475 67 | 0.451235142475334,-0.948363996234057,-1.12501397912861,0.646451228230812 68 | 0.321107695682818,0.716520580886023,1.17295280134717,-1.21693936538447 69 | 0.114822042796569,0.677222446141404,-0.969613855868197,-1.38456284008424 70 | 0.459440755681524,1.10257340316279,-1.78616797131961,1.66590154016233 71 | 0.0219946801427525,1.18517081752474,-0.840314770872874,-0.269302907889732 72 | 0.542868293303405,0.171770330356916,1.64350148305359,-0.485999149909582 73 | 0.174047480615512,0.139916283226423,-0.82190590132511,0.796687910264331 74 | 0.631329826615399,0.665400954761462,-1.24384907253912,0.00575421049234826 75 | 0.448253111011722,0.370953661887339,-0.826260803011714,-1.86710641371687 76 | 0.347645841909967,-0.302580256083282,-1.15068790928244,0.270229856088498 77 | 0.437770751682837,-0.666856784796853,-1.13069266062728,0.649194939310876 78 | 0.647787091370805,-0.496209548535389,-1.86549202105904,0.228862400858198 79 | 0.757586797314863,-0.543009816149647,-0.589720414134568,0.453209488577795 80 | 0.395517657154136,0.331597481887205,0.126670076749424,-0.192448791123588 81 | -0.148610807188793,0.747564064974794,-1.13885439293414,0.483007047732016 82 | -0.0331311205152219,1.43148376352797,-0.873253761632757,0.0442451659796992 83 | -0.0922167690428319,1.38096701871714,-1.09569113740906,-0.133114255686586 84 | 0.0663477003898789,0.637478874027199,-0.633780341360447,0.213373454405786 85 | 0.671131314329666,0.85452785256788,0.0578100185948108,-1.15492501597167 86 | 0.285957954777292,0.98309270506043,1.5891944185868,-1.62563811065679 87 | 0.392389497514938,-0.394185785485923,1.39084459385694,-0.739750425249076 88 | 0.5936436107339,-0.827458720555284,-0.848055984829891,0.202201924318366 89 | 0.396395259284278,0.755226967537884,-2.19810373211233,0.997634622960333 90 | 0.119613578896643,0.545098560396415,0.673557431272154,-0.950049483138302 91 | 0.0809296968797324,1.38429610379964,-0.214579519961673,0.191870925596037 92 | 0.226040618019244,1.36152953680865,-0.0869158593134269,-1.7466033937333 93 | 0.433219219149978,0.0699620565071049,-0.0355679990057799,-0.994160649448666 94 | 0.112119589915623,0.820894288811166,-0.820319522217722,0.109662175332649 95 | -0.342626281108291,2.05484141676728,-0.377927821473311,0.29544941600629 96 | 0.173606427742918,1.02495627388038,0.0594192701779076,-0.639574594778986 97 | 0.161425620552751,0.431684284366313,0.297519865398461,-1.54466825774715 98 | 0.182960338875149,0.595227913093178,0.278897441795062,-0.849411389575277 99 | 0.312496101004441,-0.0360081319088737,-0.734446292042805,-0.138468889183827 100 | -0.44083236091036,1.53485273905504,-0.0450535111247015,1.50618949403374 101 | 0.145409408669938,0.708254797009208,0.037837642415364,-0.331513943069683 102 | 1.23096388447485,0.0199934735037904,2.71818091543297,-0.188200605364002 103 | 0.688254289410537,1.16706741487289,1.0595828353797,-0.0991324078770557 104 | 1.27253592256374,-0.698115758085279,-0.396152599202575,0.426022851840753 105 | 0.958790493019075,0.364843653529848,0.387702252308568,-1.53375731053117 106 | 1.14284952864382,0.0817288283808422,1.02048900977019,-0.00110523673120788 107 | 1.6520401438859,-1.11818621048352,-1.24593447747317,-0.727860824503987 108 | 0.253484478139073,2.42127372100018,1.95115514412363,-0.635591986345171 109 | 1.42616906660505,-0.721657109304411,-1.50268366906111,-1.6658941236951 110 | 1.12885471320215,0.494972533448963,-1.24545832412222,-0.509596210700339 111 | 1.4184676894344,-1.58905026789707,1.5137524174713,0.718860134423417 112 | 0.808150222940681,-0.491718287110669,0.866911692148509,0.784011566450595 113 | 0.87702633185807,0.437739573217599,-0.134621397816769,0.505355102361191 114 | 1.05316567174354,-0.439034633559542,0.119168589612024,1.05619218508973 115 | 0.654663207074962,1.57692398960298,1.00802142101642,0.909672534164251 116 | 0.771265003060934,1.09545866240722,2.24926765807362,2.13459343068496 117 | 0.92617088820527,-0.24207625602493,1.71508431883601,1.42254482160265 118 | 0.948168344398858,-0.0851438854285283,0.157999815926211,-1.02134728618571 119 | 1.69581682558415,-2.38672472255988,0.478778010631198,-2.00289669993136 120 | 1.84588963990043,-0.522359920115089,-1.83711818575312,0.348775363540284 121 | 0.632598064103386,1.54511685450704,-1.23362480777392,-0.296819019056821 122 | 1.180690879931,-0.767729504725075,0.783521512781777,1.201074233626 123 | 0.583095487775923,1.23035233820623,1.83028039073048,0.394848273168769 124 | 1.70207314486254,-0.935158187813622,-2.04957102358384,-0.908293431680383 125 | 0.675381583281265,0.414926094192063,-0.230718892756886,1.05605939642684 126 | 1.10658218204094,-0.680023488654397,1.02320848710972,-0.391045164273848 127 | 1.27127852757505,-1.13861729156911,-0.734945317869469,-1.55910965911185 128 | 0.612034823302758,0.364796741495299,0.163941096720202,0.955421302863816 129 | 0.627900403394941,0.236834770316476,0.826921194838204,0.0260814000058303 130 | 1.0327485591185,0.42574617892324,0.551313153115525,0.342176499188168 131 | 1.16132818984037,-0.943208482490783,-1.60741904965904,-1.49964233501196 132 | 1.38195583564925,-0.761788073532689,-1.78394751980675,-0.144679157308328 133 | 1.57113385956897,-2.78952460178992,-0.409598667422244,-1.63811243520224 134 | 1.05017279778063,0.441068658300105,0.746490219630612,0.830340283643817 135 | 0.702321207365556,0.291126037579404,-0.547929983661238,-1.23713376623506 136 | 0.866275236445817,1.01478930824679,-0.618162866867606,-3.27383194247741 137 | 1.49615644233554,-1.39679864098684,-1.20000269936888,2.0068379309903 138 | 1.04278352669054,-0.28432721695895,2.62776210199152,0.359759977621583 139 | 0.926482994285829,-0.100078972691323,0.579920114664512,-1.4327897425381 140 | 0.5686641230767,0.33492656696971,1.00778169419681,0.132536390159035 141 | 1.02496865267056,-0.755736110430715,0.0975869618494816,1.36425283679903 142 | 1.12541444748239,-0.372808017257771,1.1538803971568,1.79843671931492 143 | 0.934832900398396,-0.83067394797889,0.406160167096019,3.27299349407842 144 | 0.688254289410537,1.16706741487289,1.0595828353797,-0.0991324078770557 145 | 1.24643882920919,-0.564054911769932,1.04616293992402,0.375116135411105 146 | 1.17627913668947,-0.618733571146933,1.80391675317007,1.56160997354874 147 | 0.945455049018614,-0.380686409020513,0.635862603478377,2.76058346973295 148 | 0.742688191129407,0.761885137702895,-0.435880497217561,1.64760498552558 149 | 0.85803259212669,-0.160081722976703,0.466573021172749,0.887393371093684 150 | 0.92446159784469,-0.236752165116549,2.58618522557382,0.2888555461085 151 | 0.67607348222037,0.57379542535882,1.29768343060026,-1.00422607084522 152 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set_normalized/iris-normalized.csv: -------------------------------------------------------------------------------- 1 | "x1","x2","x3","x4" 2 | -0.743333333333334,0.442666666666667,-2.358,-0.999333333333333 3 | -0.943333333333333,-0.0573333333333332,-2.358,-0.999333333333333 4 | -1.14333333333333,0.142666666666667,-2.458,-0.999333333333333 5 | -1.24333333333333,0.0426666666666669,-2.258,-0.999333333333333 6 | -0.843333333333334,0.542666666666667,-2.358,-0.999333333333333 7 | -0.443333333333333,0.842666666666667,-2.058,-0.799333333333333 8 | -1.24333333333333,0.342666666666667,-2.358,-0.899333333333333 9 | -0.843333333333334,0.342666666666667,-2.258,-0.999333333333333 10 | -1.44333333333333,-0.157333333333333,-2.358,-0.999333333333333 11 | -0.943333333333333,0.0426666666666669,-2.258,-1.09933333333333 12 | -0.443333333333333,0.642666666666667,-2.258,-0.999333333333333 13 | -1.04333333333333,0.342666666666667,-2.158,-0.999333333333333 14 | -1.04333333333333,-0.0573333333333332,-2.358,-1.09933333333333 15 | -1.54333333333333,-0.0573333333333332,-2.658,-1.09933333333333 16 | -0.0433333333333339,0.942666666666667,-2.558,-0.999333333333333 17 | -0.143333333333334,1.34266666666667,-2.258,-0.799333333333333 18 | -0.443333333333333,0.842666666666667,-2.458,-0.799333333333333 19 | -0.743333333333334,0.442666666666667,-2.358,-0.899333333333333 20 | -0.143333333333334,0.742666666666667,-2.058,-0.899333333333333 21 | -0.743333333333334,0.742666666666667,-2.258,-0.899333333333333 22 | -0.443333333333333,0.342666666666667,-2.058,-0.999333333333333 23 | -0.743333333333334,0.642666666666667,-2.258,-0.799333333333333 24 | -1.24333333333333,0.542666666666667,-2.758,-0.999333333333333 25 | -0.743333333333334,0.242666666666667,-2.058,-0.699333333333333 26 | -1.04333333333333,0.342666666666667,-1.858,-0.999333333333333 27 | -0.843333333333334,-0.0573333333333332,-2.158,-0.999333333333333 28 | -0.843333333333334,0.342666666666667,-2.158,-0.799333333333333 29 | -0.643333333333334,0.442666666666667,-2.258,-0.999333333333333 30 | -0.643333333333334,0.342666666666667,-2.358,-0.999333333333333 31 | -1.14333333333333,0.142666666666667,-2.158,-0.999333333333333 32 | -1.04333333333333,0.0426666666666669,-2.158,-0.999333333333333 33 | -0.443333333333333,0.342666666666667,-2.258,-0.799333333333333 34 | -0.643333333333334,1.04266666666667,-2.258,-1.09933333333333 35 | -0.343333333333334,1.14266666666667,-2.358,-0.999333333333333 36 | -0.943333333333333,0.0426666666666669,-2.258,-0.999333333333333 37 | -0.843333333333334,0.142666666666667,-2.558,-0.999333333333333 38 | -0.343333333333334,0.442666666666667,-2.458,-0.999333333333333 39 | -0.943333333333333,0.542666666666667,-2.358,-1.09933333333333 40 | -1.44333333333333,-0.0573333333333332,-2.458,-0.999333333333333 41 | -0.743333333333334,0.342666666666667,-2.258,-0.999333333333333 42 | -0.843333333333334,0.442666666666667,-2.458,-0.899333333333333 43 | -1.34333333333333,-0.757333333333333,-2.458,-0.899333333333333 44 | -1.44333333333333,0.142666666666667,-2.458,-0.999333333333333 45 | -0.843333333333334,0.442666666666667,-2.158,-0.599333333333333 46 | -0.743333333333334,0.742666666666667,-1.858,-0.799333333333333 47 | -1.04333333333333,-0.0573333333333332,-2.358,-0.899333333333333 48 | -0.743333333333334,0.742666666666667,-2.158,-0.999333333333333 49 | -1.24333333333333,0.142666666666667,-2.358,-0.999333333333333 50 | -0.543333333333334,0.642666666666667,-2.258,-0.999333333333333 51 | -0.843333333333334,0.242666666666667,-2.358,-0.999333333333333 52 | 1.15666666666667,0.142666666666667,0.942,0.200666666666667 53 | 0.556666666666667,0.142666666666667,0.742,0.300666666666667 54 | 1.05666666666667,0.0426666666666669,1.142,0.300666666666667 55 | -0.343333333333334,-0.757333333333333,0.242,0.100666666666667 56 | 0.656666666666666,-0.257333333333333,0.842,0.300666666666667 57 | -0.143333333333334,-0.257333333333333,0.742,0.100666666666667 58 | 0.456666666666666,0.242666666666667,0.942,0.400666666666667 59 | -0.943333333333333,-0.657333333333333,-0.458,-0.199333333333333 60 | 0.756666666666666,-0.157333333333333,0.842,0.100666666666667 61 | -0.643333333333334,-0.357333333333333,0.142,0.200666666666667 62 | -0.843333333333334,-1.05733333333333,-0.258,-0.199333333333333 63 | 0.0566666666666666,-0.0573333333333332,0.442,0.300666666666667 64 | 0.156666666666666,-0.857333333333333,0.242,-0.199333333333333 65 | 0.256666666666666,-0.157333333333333,0.942,0.200666666666667 66 | -0.243333333333334,-0.157333333333333,-0.158,0.100666666666667 67 | 0.856666666666666,0.0426666666666669,0.642,0.200666666666667 68 | -0.243333333333334,-0.0573333333333332,0.742,0.300666666666667 69 | -0.0433333333333339,-0.357333333333333,0.342,-0.199333333333333 70 | 0.356666666666666,-0.857333333333333,0.742,0.300666666666667 71 | -0.243333333333334,-0.557333333333333,0.142,-0.0993333333333333 72 | 0.0566666666666666,0.142666666666667,1.042,0.600666666666667 73 | 0.256666666666666,-0.257333333333333,0.242,0.100666666666667 74 | 0.456666666666666,-0.557333333333333,1.142,0.300666666666667 75 | 0.256666666666666,-0.257333333333333,0.942,0.000666666666666593 76 | 0.556666666666667,-0.157333333333333,0.542,0.100666666666667 77 | 0.756666666666666,-0.0573333333333332,0.642,0.200666666666667 78 | 0.956666666666666,-0.257333333333333,1.042,0.200666666666667 79 | 0.856666666666666,-0.0573333333333332,1.242,0.500666666666667 80 | 0.156666666666666,-0.157333333333333,0.742,0.300666666666667 81 | -0.143333333333334,-0.457333333333333,-0.258,-0.199333333333333 82 | -0.343333333333334,-0.657333333333333,0.0419999999999998,-0.0993333333333333 83 | -0.343333333333334,-0.657333333333333,-0.0579999999999998,-0.199333333333333 84 | -0.0433333333333339,-0.357333333333333,0.142,0.000666666666666593 85 | 0.156666666666666,-0.357333333333333,1.342,0.400666666666667 86 | -0.443333333333333,-0.0573333333333332,0.742,0.300666666666667 87 | 0.156666666666666,0.342666666666667,0.742,0.400666666666667 88 | 0.856666666666666,0.0426666666666669,0.942,0.300666666666667 89 | 0.456666666666666,-0.757333333333333,0.642,0.100666666666667 90 | -0.243333333333334,-0.0573333333333332,0.342,0.100666666666667 91 | -0.343333333333334,-0.557333333333333,0.242,0.100666666666667 92 | -0.343333333333334,-0.457333333333333,0.642,0.000666666666666593 93 | 0.256666666666666,-0.0573333333333332,0.842,0.200666666666667 94 | -0.0433333333333339,-0.457333333333333,0.242,0.000666666666666593 95 | -0.843333333333334,-0.757333333333333,-0.458,-0.199333333333333 96 | -0.243333333333334,-0.357333333333333,0.442,0.100666666666667 97 | -0.143333333333334,-0.0573333333333332,0.442,0.000666666666666593 98 | -0.143333333333334,-0.157333333333333,0.442,0.100666666666667 99 | 0.356666666666666,-0.157333333333333,0.542,0.100666666666667 100 | -0.743333333333334,-0.557333333333333,-0.758,-0.0993333333333333 101 | -0.143333333333334,-0.257333333333333,0.342,0.100666666666667 102 | 0.456666666666666,0.242666666666667,2.242,1.30066666666667 103 | -0.0433333333333339,-0.357333333333333,1.342,0.700666666666667 104 | 1.25666666666667,-0.0573333333333332,2.142,0.900666666666667 105 | 0.456666666666666,-0.157333333333333,1.842,0.600666666666667 106 | 0.656666666666666,-0.0573333333333332,2.042,1.00066666666667 107 | 1.75666666666667,-0.0573333333333332,2.842,0.900666666666667 108 | -0.943333333333333,-0.557333333333333,0.742,0.500666666666667 109 | 1.45666666666667,-0.157333333333333,2.542,0.600666666666667 110 | 0.856666666666666,-0.557333333333333,2.042,0.600666666666667 111 | 1.35666666666667,0.542666666666667,2.342,1.30066666666667 112 | 0.656666666666666,0.142666666666667,1.342,0.800666666666667 113 | 0.556666666666667,-0.357333333333333,1.542,0.700666666666667 114 | 0.956666666666666,-0.0573333333333332,1.742,0.900666666666667 115 | -0.143333333333334,-0.557333333333333,1.242,0.800666666666667 116 | -0.0433333333333339,-0.257333333333333,1.342,1.20066666666667 117 | 0.556666666666667,0.142666666666667,1.542,1.10066666666667 118 | 0.656666666666666,-0.0573333333333332,1.742,0.600666666666667 119 | 1.85666666666667,0.742666666666667,2.942,1.00066666666667 120 | 1.85666666666667,-0.457333333333333,3.142,1.10066666666667 121 | 0.156666666666666,-0.857333333333333,1.242,0.300666666666667 122 | 1.05666666666667,0.142666666666667,1.942,1.10066666666667 123 | -0.243333333333334,-0.257333333333333,1.142,0.800666666666667 124 | 1.85666666666667,-0.257333333333333,2.942,0.800666666666667 125 | 0.456666666666666,-0.357333333333333,1.142,0.600666666666667 126 | 0.856666666666666,0.242666666666667,1.942,0.900666666666667 127 | 1.35666666666667,0.142666666666667,2.242,0.600666666666667 128 | 0.356666666666666,-0.257333333333333,1.042,0.600666666666667 129 | 0.256666666666666,-0.0573333333333332,1.142,0.600666666666667 130 | 0.556666666666667,-0.257333333333333,1.842,0.900666666666667 131 | 1.35666666666667,-0.0573333333333332,2.042,0.400666666666667 132 | 1.55666666666667,-0.257333333333333,2.342,0.700666666666667 133 | 2.05666666666667,0.742666666666667,2.642,0.800666666666667 134 | 0.556666666666667,-0.257333333333333,1.842,1.00066666666667 135 | 0.456666666666666,-0.257333333333333,1.342,0.300666666666667 136 | 0.256666666666666,-0.457333333333333,1.842,0.200666666666667 137 | 1.85666666666667,-0.0573333333333332,2.342,1.10066666666667 138 | 0.456666666666666,0.342666666666667,1.842,1.20066666666667 139 | 0.556666666666667,0.0426666666666669,1.742,0.600666666666667 140 | 0.156666666666666,-0.0573333333333332,1.042,0.600666666666667 141 | 1.05666666666667,0.0426666666666669,1.642,0.900666666666667 142 | 0.856666666666666,0.0426666666666669,1.842,1.20066666666667 143 | 1.05666666666667,0.0426666666666669,1.342,1.10066666666667 144 | -0.0433333333333339,-0.357333333333333,1.342,0.700666666666667 145 | 0.956666666666666,0.142666666666667,2.142,1.10066666666667 146 | 0.856666666666666,0.242666666666667,1.942,1.30066666666667 147 | 0.856666666666666,-0.0573333333333332,1.442,1.10066666666667 148 | 0.456666666666666,-0.557333333333333,1.242,0.700666666666667 149 | 0.656666666666666,-0.0573333333333332,1.442,0.800666666666667 150 | 0.356666666666666,0.342666666666667,1.642,1.10066666666667 151 | 0.0566666666666666,-0.0573333333333332,1.342,0.600666666666667 152 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set_normalized/iris.csv: -------------------------------------------------------------------------------- 1 | "Sepal.Length","Sepal.Width","Petal.Length","Petal.Width" 2 | 5.1,3.5,1.4,0.2 3 | 4.9,3,1.4,0.2 4 | 4.7,3.2,1.3,0.2 5 | 4.6,3.1,1.5,0.2 6 | 5,3.6,1.4,0.2 7 | 5.4,3.9,1.7,0.4 8 | 4.6,3.4,1.4,0.3 9 | 5,3.4,1.5,0.2 10 | 4.4,2.9,1.4,0.2 11 | 4.9,3.1,1.5,0.1 12 | 5.4,3.7,1.5,0.2 13 | 4.8,3.4,1.6,0.2 14 | 4.8,3,1.4,0.1 15 | 4.3,3,1.1,0.1 16 | 5.8,4,1.2,0.2 17 | 5.7,4.4,1.5,0.4 18 | 5.4,3.9,1.3,0.4 19 | 5.1,3.5,1.4,0.3 20 | 5.7,3.8,1.7,0.3 21 | 5.1,3.8,1.5,0.3 22 | 5.4,3.4,1.7,0.2 23 | 5.1,3.7,1.5,0.4 24 | 4.6,3.6,1,0.2 25 | 5.1,3.3,1.7,0.5 26 | 4.8,3.4,1.9,0.2 27 | 5,3,1.6,0.2 28 | 5,3.4,1.6,0.4 29 | 5.2,3.5,1.5,0.2 30 | 5.2,3.4,1.4,0.2 31 | 4.7,3.2,1.6,0.2 32 | 4.8,3.1,1.6,0.2 33 | 5.4,3.4,1.5,0.4 34 | 5.2,4.1,1.5,0.1 35 | 5.5,4.2,1.4,0.2 36 | 4.9,3.1,1.5,0.2 37 | 5,3.2,1.2,0.2 38 | 5.5,3.5,1.3,0.2 39 | 4.9,3.6,1.4,0.1 40 | 4.4,3,1.3,0.2 41 | 5.1,3.4,1.5,0.2 42 | 5,3.5,1.3,0.3 43 | 4.5,2.3,1.3,0.3 44 | 4.4,3.2,1.3,0.2 45 | 5,3.5,1.6,0.6 46 | 5.1,3.8,1.9,0.4 47 | 4.8,3,1.4,0.3 48 | 5.1,3.8,1.6,0.2 49 | 4.6,3.2,1.4,0.2 50 | 5.3,3.7,1.5,0.2 51 | 5,3.3,1.4,0.2 52 | 7,3.2,4.7,1.4 53 | 6.4,3.2,4.5,1.5 54 | 6.9,3.1,4.9,1.5 55 | 5.5,2.3,4,1.3 56 | 6.5,2.8,4.6,1.5 57 | 5.7,2.8,4.5,1.3 58 | 6.3,3.3,4.7,1.6 59 | 4.9,2.4,3.3,1 60 | 6.6,2.9,4.6,1.3 61 | 5.2,2.7,3.9,1.4 62 | 5,2,3.5,1 63 | 5.9,3,4.2,1.5 64 | 6,2.2,4,1 65 | 6.1,2.9,4.7,1.4 66 | 5.6,2.9,3.6,1.3 67 | 6.7,3.1,4.4,1.4 68 | 5.6,3,4.5,1.5 69 | 5.8,2.7,4.1,1 70 | 6.2,2.2,4.5,1.5 71 | 5.6,2.5,3.9,1.1 72 | 5.9,3.2,4.8,1.8 73 | 6.1,2.8,4,1.3 74 | 6.3,2.5,4.9,1.5 75 | 6.1,2.8,4.7,1.2 76 | 6.4,2.9,4.3,1.3 77 | 6.6,3,4.4,1.4 78 | 6.8,2.8,4.8,1.4 79 | 6.7,3,5,1.7 80 | 6,2.9,4.5,1.5 81 | 5.7,2.6,3.5,1 82 | 5.5,2.4,3.8,1.1 83 | 5.5,2.4,3.7,1 84 | 5.8,2.7,3.9,1.2 85 | 6,2.7,5.1,1.6 86 | 5.4,3,4.5,1.5 87 | 6,3.4,4.5,1.6 88 | 6.7,3.1,4.7,1.5 89 | 6.3,2.3,4.4,1.3 90 | 5.6,3,4.1,1.3 91 | 5.5,2.5,4,1.3 92 | 5.5,2.6,4.4,1.2 93 | 6.1,3,4.6,1.4 94 | 5.8,2.6,4,1.2 95 | 5,2.3,3.3,1 96 | 5.6,2.7,4.2,1.3 97 | 5.7,3,4.2,1.2 98 | 5.7,2.9,4.2,1.3 99 | 6.2,2.9,4.3,1.3 100 | 5.1,2.5,3,1.1 101 | 5.7,2.8,4.1,1.3 102 | 6.3,3.3,6,2.5 103 | 5.8,2.7,5.1,1.9 104 | 7.1,3,5.9,2.1 105 | 6.3,2.9,5.6,1.8 106 | 6.5,3,5.8,2.2 107 | 7.6,3,6.6,2.1 108 | 4.9,2.5,4.5,1.7 109 | 7.3,2.9,6.3,1.8 110 | 6.7,2.5,5.8,1.8 111 | 7.2,3.6,6.1,2.5 112 | 6.5,3.2,5.1,2 113 | 6.4,2.7,5.3,1.9 114 | 6.8,3,5.5,2.1 115 | 5.7,2.5,5,2 116 | 5.8,2.8,5.1,2.4 117 | 6.4,3.2,5.3,2.3 118 | 6.5,3,5.5,1.8 119 | 7.7,3.8,6.7,2.2 120 | 7.7,2.6,6.9,2.3 121 | 6,2.2,5,1.5 122 | 6.9,3.2,5.7,2.3 123 | 5.6,2.8,4.9,2 124 | 7.7,2.8,6.7,2 125 | 6.3,2.7,4.9,1.8 126 | 6.7,3.3,5.7,2.1 127 | 7.2,3.2,6,1.8 128 | 6.2,2.8,4.8,1.8 129 | 6.1,3,4.9,1.8 130 | 6.4,2.8,5.6,2.1 131 | 7.2,3,5.8,1.6 132 | 7.4,2.8,6.1,1.9 133 | 7.9,3.8,6.4,2 134 | 6.4,2.8,5.6,2.2 135 | 6.3,2.8,5.1,1.5 136 | 6.1,2.6,5.6,1.4 137 | 7.7,3,6.1,2.3 138 | 6.3,3.4,5.6,2.4 139 | 6.4,3.1,5.5,1.8 140 | 6,3,4.8,1.8 141 | 6.9,3.1,5.4,2.1 142 | 6.7,3.1,5.6,2.4 143 | 6.9,3.1,5.1,2.3 144 | 5.8,2.7,5.1,1.9 145 | 6.8,3.2,5.9,2.3 146 | 6.7,3.3,5.7,2.5 147 | 6.7,3,5.2,2.3 148 | 6.3,2.5,5,1.9 149 | 6.5,3,5.2,2 150 | 6.2,3.4,5.4,2.3 151 | 5.9,3,5.1,1.8 152 | -------------------------------------------------------------------------------- /src/test/resources/data/iris_data_set_normalized/make_pca.R: -------------------------------------------------------------------------------- 1 | d <- iris 2 | numeric.d <- subset(d, select=-Species) 3 | write.csv(numeric.d, "iris.csv", row.names=FALSE) 4 | preNormalized <- numeric.d 5 | means <- colMeans(preNormalized) 6 | 7 | # normalize the iris dataset 8 | data <- list() 9 | for(c in seq(1:ncol(preNormalized))){ 10 | data[[paste("x", c, sep="")]] <- preNormalized[[c]] - means[[c]] 11 | } 12 | data <- as.data.frame(data) 13 | write.csv(data, "iris-normalized.csv", row.names=FALSE) 14 | 15 | ##built-in PCA{ 16 | pca <- prcomp(data, center=FALSE) 17 | pca.rotation <- t(pca$rotation) 18 | pca.scaling <- diag(1/pca$sdev) 19 | ##built-in PCA} 20 | 21 | #PCA{ 22 | data.cov <- cov(data) 23 | eigen.dec <- eigen(data.cov, TRUE) 24 | eigen.rotation <- t(eigen.dec$vectors) 25 | eigen.scaling <- diag(1/(sqrt(eigen.dec$values))) 26 | #PCA} 27 | 28 | run.experiment <- function(rotation, scaling, prefix){ 29 | 30 | transform.data <- function(rotation, scaling, data){ 31 | rotated <- t(rotation%*%t(data)) 32 | whitened <- t(scaling%*%rotation%*%t(data)) 33 | return(list(rotated=rotated, whitened=whitened)) 34 | } 35 | 36 | data.transformed <- transform.data(rotation, scaling, data) 37 | 38 | data.rotated <- data.transformed$rotated 39 | write.csv(data.rotated, paste(prefix, "-iris_rotated.csv", sep=""), 40 | row.names=FALSE) 41 | data.whitened <-data.transformed$whitened 42 | write.csv(data.whitened, paste(prefix, "-iris_whitened.csv", sep=""), 43 | row.names=FALSE) 44 | } 45 | 46 | run.experiment(eigen.rotation, eigen.scaling, "eigen") 47 | run.experiment(pca.rotation, pca.scaling, "built-in") 48 | -------------------------------------------------------------------------------- /src/test/resources/data/no_of_samples_smaller_than_no_of_dims/built-in-rotated.csv: -------------------------------------------------------------------------------- 1 | "PC1","PC2" 2 | -4.18330013267038,-1.22474487139159 3 | 4.18330013267038,-1.22474487139159 4 | 3.33066907387547e-16,2.44948974278318 5 | -------------------------------------------------------------------------------- /src/test/resources/data/no_of_samples_smaller_than_no_of_dims/built-in-whitened.csv: -------------------------------------------------------------------------------- 1 | "V1","V2" 2 | -1,-0.577350269189626 3 | 1,-0.577350269189626 4 | 8.32667268468867e-17,1.15470053837925 5 | -------------------------------------------------------------------------------- /src/test/resources/data/no_of_samples_smaller_than_no_of_dims/data.csv: -------------------------------------------------------------------------------- 1 | "x1","x2","x3","x4","x5","x6" 2 | 1,2,3,4,5,6 3 | 6,5,4,3,2,1 4 | 2,2,2,2,2,2 5 | -------------------------------------------------------------------------------- /src/test/resources/data/no_of_samples_smaller_than_no_of_dims/eigen-rotated.csv: -------------------------------------------------------------------------------- 1 | "V1","V2","V3","V4","V5","V6" 2 | 4.18330013267038,-1.22474487139159,3.33066907387547e-15,-6.66133814775094e-16,-9.71445146547012e-17,0 3 | -4.18330013267038,-1.22474487139159,2.33146835171283e-15,1.11022302462516e-16,-1.38777878078145e-16,3.33066907387547e-16 4 | 3.33066907387547e-16,2.44948974278318,-5.77315972805081e-15,3.33066907387547e-16,1.80411241501588e-16,-3.88578058618805e-16 5 | -------------------------------------------------------------------------------- /src/test/resources/data/no_of_samples_smaller_than_no_of_dims/eigen-whitened.csv: -------------------------------------------------------------------------------- 1 | "V1","V2","V3","V4","V5","V6" 2 | 1,-0.577350269189625,5.5413693189621e-08,-1.67638063430786e-08,-7.6834112405777e-09,NA 3 | -1,-0.577350269189624,3.91155481338501e-08,3.72529029846191e-09,-8.55652615427971e-09,NA 4 | 6.93889390390723e-17,1.15470053837925,-9.6391886472702e-08,2.04890966415405e-08,1.62108335644007e-08,NA 5 | -------------------------------------------------------------------------------- /src/test/resources/data/no_of_samples_smaller_than_no_of_dims/make_pca.R: -------------------------------------------------------------------------------- 1 | d <- data.frame(x1=c(1, 6, 2), x2=c(2, 5, 2), x3=c(3, 4, 2), 2 | x4=c(4, 3, 2), x5=c(5, 2, 2), x6=c(6, 1, 2)) 3 | write.csv(d, "data.csv", row.names=FALSE) 4 | d.means <- mean(d) 5 | 6 | ##built-in PCA{ 7 | pca <- prcomp(d, tol=sqrt(.Machine$double.eps)) 8 | pca.rotation <- t(pca$rotation) 9 | pca.scaling <- diag(1/pca$sdev) 10 | ##built-in PCA} 11 | 12 | #PCA{ 13 | d.cov <- cov(d) 14 | eigen.dec <- eigen(d.cov, TRUE) 15 | eigen.rotation <- t(eigen.dec$vectors) 16 | eigen.scaling <- diag(1/(sqrt(eigen.dec$values))) 17 | #PCA} 18 | 19 | transform.data <- function(means, rotation, scaling, data){ 20 | data.centered <- list() 21 | for(c in 1:ncol(data)){ 22 | data.centered[[paste("x", c, sep="")]] <- data[[c]] - means[[c]] 23 | } 24 | data.centered <- as.data.frame(data.centered) 25 | rotated <- t(rotation%*%t(data.centered)) 26 | whitened <- t(scaling%*%rotation%*%t(data.centered)) 27 | return(list(rotated=rotated, whitened=whitened)) 28 | } 29 | 30 | run.experiment <- function(data.means, rotation, scaling, data, prefix){ 31 | data.transformed <- transform.data(data.means, rotation, scaling, data) 32 | 33 | data.rotated <- data.transformed$rotated 34 | write.csv(data.rotated, paste(prefix, "-rotated.csv", sep=""), 35 | row.names=FALSE) 36 | data.whitened <- data.transformed$whitened 37 | write.csv(data.whitened, paste(prefix, "-whitened.csv", sep=""), 38 | row.names=FALSE) 39 | #summary(data.whitened) 40 | #var(data.whitened) 41 | } 42 | 43 | run.experiment(d.means, eigen.rotation, eigen.scaling, d, "eigen") 44 | run.experiment(d.means, pca.rotation, pca.scaling, d, "built-in") --------------------------------------------------------------------------------