# Random Projection

More computationally efficient than PCA. You would use this over PCA if your system has limited, or if there are too many dimensions for PCA.&#x20;

![](/files/-Ln427k9sp7Qrjp6gSPP)

Pick a random line and project onto it

![](/files/-Ln42q93iH4EYhSn2Jdn)

This doesn't really make sens in 2d, but in high dimensions it really works well.&#x20;

Random projection is just multiplying by a random matrix.

![](/files/-Ln43Z4SZbeB8QnilcGu)

![](/files/-Ln44MhicYA1UbjRA3Tx)

The distance between 2 rows (or 2 points) in the transformed space will be larger than (1-eps)||u-v||^2 and smaller than 1+eps||u-v||^2.&#x20;

Epsilon is a value between 0 and 1. It goes into the calculation of how many columns are produced and It's the level of error we are allowing distortion to have in the reduction of dimensionality. This guarantees that distance are preserved between every pair of points in the dataset.&#x20;

&#x20;It is NOT mandatory for us to specify the number of components/dimensions that we want [Random Projection](http://scikit-learn.org/stable/modules/generated/sklearn.random_projection.SparseRandomProjection.html#sklearn.random_projection.SparseRandomProjection) to reduce our dataset down into. It can be computed by the algorithm.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://julienbeaulieu.gitbook.io/wiki/sciences/machine-learning/unsupervised-learning/dimensionality-reduction/random-projection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
