r - Negative length vectors are not allowed in distance function
问题描述
I have a large data frame (375,000 row and 5 columns), all variables are numerical. I would like to spatio-temporal cluster this data frame using hierarchical clustering in R. However, when I try to calculate the distance matrix, I get the following error: "Negative length vectors are not allowed in distance function". Is it because of exceeding the maximum memory my computer has (16 GB RAM)? or is it due to exceeding the maximum length of any vector in R which is 2^31 - 1 (around 2 billions) elements? By the way, how to calculate the length of this distance matrix that I am trying to compute? is it 375,000^2 which equals nearly 100 billion? In any case, what can I do regarding this problem? Can I somehow still use hierarchical clustering in this case?
Clustering using kmeans works perfectly but my supervisor prefers hierarchical clustering.
Any hints/suggestions will be greatly appreciated
P.S. Rows represent vehicle trips IDs, and columns represent: longitude of starting point, latitude of starting point, longitude of end point, latitude of end point and time of trip on specific day (all values are scaled for all variables).
解决方案
是的,375000^2 超过了向量的长度。
矩阵的大小大致是行*列*数据类型的大小。
计算您需要的内存量,然后将结果返回给您的主管。
推荐阅读
- android - 科尔多瓦 android vue avd 资源公共图像
- hyperledger - 在 Ubuntu 上安装 Indy-node 失败
- react-native - 如何使用 React Native / Expo CLI 可靠地检测网络状态
- html - 如何使样式为 inline-block 的链接的背景不会出现在其后续链接兄弟姐妹的后面?
- java - How to call postgresql function with more than one input and output parameter from Java?
- flutter - 当子部件更改 Flutter 时更改父变量并重建父部件
- yocto - 覆盖 `DEFAULTTUNE` 和其他机器配置参数
- java - Spring boot RestHighLevelClient 弹性搜索组合查询
- java - Java:trustAnchors 参数必须为非空(openjdk)
- javascript - 在 JavaScript 按钮上应用某些 .class 并避免文本错位