本文介绍了C ++ - 计算PCA的框架(除了armadillo)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大小为 200000 数据点的数据集,其中每个数据点包含 132 个功能。所以基本上我的数据集是 200000 x 132



我已经通过使用。然而,我试图做PCA分析,但我收到一个内存错误,我不知道,这是因为我的RAM内存(8 GB的RAM)或其由于框架本身的限制。



我收到以下错误:请求的大小太大



你可以推荐一个没有大小/内存限制的PCA计算的另一个框架?



或者如果你以前使用armadillo进行PCA计算,遇到这个问题,你能告诉我你是如何解决的?

解决方案

您可能需要启用,用于存储元素的总数等。 p>

具体来说,请编辑文件
include / armadillo_bits / config.hpp
,并取消注释行: // #define ARMA_64BIT_WORD

或者,您可以在程序中包含Armadillo标题之前定义ARMA_64BIT_WORD,例如:

  #define ARMA_64BIT_WORD 
#include< armadillo>
#include< iostream>
...

请注意,C ++编译器必须能够处理64位整数。大多数编译器这些天有它。


I have a large dataset of around 200000 data points where each data point contains 132 features. So basically my dataset is 200000 x 132.

I have done all the computations by using the armadillo framework. However, I have tried to do PCA analysis but I received a memory error which I don't know that it's because of my RAM memory( 8 GB of Ram ) or its a limitation due to the framework itself.

I receive the following error : requested size is too large.

Can you recommend me another framework for PCA computation which doesn't have size/memory limtations?

Or if you have previously used armadillo for PCA computation and encountered this issue, can you tell me how you managed to solve it?

解决方案

You probably need to enable the use of 64 bit integers within Armadillo, which are used for storing the total number of elements, etc.

Specifically, edit the file include/armadillo_bits/config.hppand uncomment the line with: // #define ARMA_64BIT_WORD.In version 3.4 this should be near line 59.

Alternatively, you can define ARMA_64BIT_WORD before including the Armadillo header in your program, eg:

#define ARMA_64BIT_WORD
#include <armadillo>
#include <iostream>
...

Note that your C++ compiler must be able to handle 64 bit integers. Most compilers these days have it.

这篇关于C ++ - 计算PCA的框架(除了armadillo)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 07:25