我需要在Java中實現PCA。我有興趣找到有據可查,實用且易於使用的東西。任何建議?Java中的PCA實現
8
A
回答
8
這裏是一個:PCA Class。
該類包含具有varimax旋轉的基本主分量分析所必需的方法。選項可用於使用協方差或相關性矩陣進行分析。使用蒙特卡洛模擬進行平行分析。基於大於1的特徵值的提取標準,大於蒙特卡羅特徵值百分點或大於蒙特卡羅特徵值均值是可用的。
3
檢查http://weka.sourceforge.net/doc.stable/weka/attributeSelection/PrincipalComponents.html 秧雞其實有可能與PCA一起使用許多其它的算法,也WEKA增加了更多的算法,不時。所以我的事情,如果你正在處理java然後切換到weka api。
8
現在有一些Java的主成分分析實現。
-
SparkConf conf = new SparkConf().setAppName("PCAExample").setMaster("local"); try (JavaSparkContext sc = new JavaSparkContext(conf)) { //Create points as Spark Vectors List<Vector> vectors = Arrays.asList( Vectors.dense(-1.0, -1.0), Vectors.dense(-1.0, 1.0), Vectors.dense(1.0, 1.0)); //Create Spark MLLib RDD JavaRDD<Vector> distData = sc.parallelize(vectors); RDD<Vector> vectorRDD = distData.rdd(); //Execute PCA Projection to 2 dimensions PCA pca = new PCA(2); PCAModel pcaModel = pca.fit(vectorRDD); Matrix matrix = pcaModel.pc(); }
ND4J:http://nd4j.org/doc/org/nd4j/linalg/dimensionalityreduction/PCA.html
//Create points as NDArray instances List<INDArray> ndArrays = Arrays.asList( new NDArray(new float [] {-1.0F, -1.0F}), new NDArray(new float [] {-1.0F, 1.0F}), new NDArray(new float [] {1.0F, 1.0F})); //Create matrix of points (rows are observations; columns are features) INDArray matrix = new NDArray(ndArrays, new int [] {3,2}); //Execute PCA - again to 2 dimensions INDArray factors = PCA.pca_factor(matrix, 2, false);
Apache的百科全書數學(單線程;無框架)
//create points in a double array double[][] pointsArray = new double[][] { new double[] { -1.0, -1.0 }, new double[] { -1.0, 1.0 }, new double[] { 1.0, 1.0 } }; //create real matrix RealMatrix realMatrix = MatrixUtils.createRealMatrix(pointsArray); //create covariance matrix of points, then find eigen vectors //see https://stats.stackexchange.com/questions/2691/making-sense-of-principal-component-analysis-eigenvectors-eigenvalues Covariance covariance = new Covariance(realMatrix); RealMatrix covarianceMatrix = covariance.getCovarianceMatrix(); EigenDecomposition ed = new EigenDecomposition(covarianceMatrix);
注意,奇異值分解也可用於查找主元件,具有等效的實現。
0
Smile是一個功能齊全的Java庫。你可以嘗試一下它的PCA實現。請參閱:https://haifengl.github.io/smile/api/java/smile/projection/PCA.html
還有帶笑臉的PCA tutorial,但本教程使用了Scala。
相關問題
- 1. Java中的PCA-SIFT
- 2. PCA面部識別,實現技術
- 3. Java中的Java實現
- 4. Java中的Iterable的實現
- 5. 實現在Java中
- 6. PCA如何在攝像頭拍攝的圖像上實現?
- 7. java中的圖實現
- 8. java中的SMTP實現
- 9. 在Java中的diff實現
- 10. curl Java中的HTTPS實現
- 11. Java 7中的Files.size()實現
- 12. java中的RNTN實現
- 13. Java中的A星實現
- 14. Java中eval()的實現
- 15. Java中的KDTree實現
- 16. Java中的RSA實現
- 17. Kademlia在Java中的實現
- 18. Java中的NTLM SSO實現
- 19. java中的Arrays.asList()實現
- 20. java中的PBEWithSHAAnd128BitRC4實現
- 21. java中的DOM實現
- 22. Java中的MD5實現
- 23. java中的隊列實現
- 24. Java中的BDD實現
- 25. java中的pagerank實現
- 26. ZipCrypto的實現在java中
- 27. Java中接口的實現
- 28. Java中的Active Directory實現
- 29. HashMap中的Java 8實現
- 30. Java中Kraken API的實現
鏈接無效,請儘量避免只回答問題,因爲它們可能會過期並且在將來不可靠。 – Iancovici