https://github.com/scikit-learn-contrib/scikit-dimension
A Python package for intrinsic dimension estimation
https://github.com/scikit-learn-contrib/scikit-dimension
Last synced: 8 months ago
JSON representation
A Python package for intrinsic dimension estimation
- Host: GitHub
- URL: https://github.com/scikit-learn-contrib/scikit-dimension
- Owner: scikit-learn-contrib
- License: bsd-3-clause
- Created: 2019-12-28T10:01:51.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-02-10T14:32:25.000Z (10 months ago)
- Last Synced: 2025-04-03T11:16:21.243Z (9 months ago)
- Language: Python
- Homepage: https://scikit-dimension.readthedocs.io
- Size: 18 MB
- Stars: 85
- Watchers: 5
- Forks: 18
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://ci.appveyor.com/project/j-bac/scikit-dimension/branch/master)
[](https://app.circleci.com/pipelines/github/scikit-learn-contrib/scikit-dimension)
[](https://scikit-dimension.readthedocs.io/en/latest/?badge=latest)
[](https://codecov.io/gh/j-bac/scikit-dimension)
[](https://github.com/j-bac/scikit-dimension/blob/master/LICENSE)
[](https://pepy.tech/project/scikit-dimension)
# scikit-dimension
scikit-dimension is a Python module for intrinsic dimension estimation built according to the [scikit-learn](https://github.com/scikit-learn/scikit-learn) API and distributed under the 3-Clause BSD license.
Please refer to the [documentation](https://scikit-dimension.readthedocs.io) and the [paper](https://www.mdpi.com/1099-4300/23/10/1368) for detailed API, examples and references
### Installation
Using pip:
```bash
pip install scikit-dimension
```
From source:
```bash
git clone https://github.com/j-bac/scikit-dimension
cd scikit-dimension
pip install .
```
### Quick start
Local and global estimators can be used in this way:
```python
import skdim
import numpy as np
#generate data : np.array (n_points x n_dim). Here a uniformly sampled 5-ball embedded in 10 dimensions
data = np.zeros((1000,10))
data[:,:5] = skdim.datasets.hyperBall(n = 1000, d = 5, radius = 1, random_state = 0)
#estimate global intrinsic dimension
danco = skdim.id.DANCo().fit(data)
#estimate local intrinsic dimension (dimension in k-nearest-neighborhoods around each point):
lpca = skdim.id.lPCA().fit_pw(data,
n_neighbors = 100,
n_jobs = 1)
#get estimated intrinsic dimension
print(danco.dimension_, np.mean(lpca.dimension_pw_))
```