(1) I have n points in 3D space
(2) I have a random vector
(3) I project all n points into the vector
Then I find the average distance between all points
How could I find the vector in which after projecting the points into it, the average distance between points is the greatest?
Can this be done in O(n)?
Asked
Active
Viewed 65 times
1

porente
- 371
- 2
- 14
-
1I think you meant "project the points into a line" instead of "collapse the points into the vector". Remember, a vector has fixed length. Another thing to take into account is that the position of the line does not matter, it just matters the **direction** of it because parallel projection doesn't differentiate between far and near, so you need to calculate the **angle** of the line. Hope it helps. – Garmekain Jul 08 '17 at 00:53
-
Maybe I misunderstood something here, but isn't this *exactly* what the [Principle Component Analysis](https://en.wikipedia.org/wiki/Principal_component_analysis) is doing? – Marco13 Jul 08 '17 at 01:34
1 Answers
0
There is one method which you can use from machine learning, specifically dimensionality reduction. (This is based on PCA which was mentioned in one of the comments.)
- Compute the covariance matrix.
- Find the eigenvalues and the eigenvectors.
- The eigenvector with the largest eigenvalue will correspond to the direction of the most variance, so the direction in which the points are most spread out.
- Map the points onto the line defined by the vector.
Centring the points around 0 before the projection, and then moving them back afterwards may be needed as well. The issue with this, is that it is quite expensive in terms of time. For more details looks at this question: How is the complexity of PCA O(min(p^3,n^3))?

Ed Jaras
- 81
- 4