Cayley transform ellipsoid fitting
Project description
Cayley tranform ellispoid fitting (CTEF)
Python implementation of Cayley tranform ellipsoid fitting (CTEF).
The main algorithm is in the ctef.py file.
The main function is ctef in the ctef.py file.
Basic usage
Given an n-by-p data matrix X with n the number of samples and p the dimension, the ellipsoid fitting is
fit = ctef(X)
Expanding ctef with all default arguments explicitly expressed,
fit = ctef(X, k=None, w=0.5, w_axis=10, ellipsoid_dimensions=None, trr_params=None)
The ctef function returns the following dictionary.
{'center': avg + V @ c, 'Lambda': V @ R.T @ np.diag(1/a), 'Lambda_inv': np.diag(a) @ R @ V.T, 'result': result}
For details see the ctef.py file and/or our paper.
Simple example
This example is from the ellipsoid_gaussian.py file in the examples folder. See that file for parameter details.
p, tau, axis_ratio, noise_level, n_samples = 2, 2, 3, .01, 50
# generate data from Ellipsoid-Gaussian model
truth = generate_truth(p, tau, axis_ratio)
X = simulate_data(n_samples, noise_level, truth)
# fit ellipsoid to data X
fit = ctef(X)
Lambda = fit['Lambda']
center = fit['center']
Lambda and center yield the ellipsoid $\{\Lambda\eta+c : \lVert\eta\rVert=1\}$ fitted to X pictured below. Note simulate_data is random, so rerunning this code will produce different data and hence a different ellipsoid of best fit.
Clustering
ctef_clustering.py in the clustering folder implements our ellipsoid clustering algorithm. This algorithm is tested against other clustering algorithms on two toy examples in the compare.py file. Here is its output.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ctef-0.0.3.tar.gz
.
File metadata
- Download URL: ctef-0.0.3.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c22ac799b52ede8e9a1f47c13d1df5392c1779acf4fcc1c37b09a2580a4e5f9 |
|
MD5 | f346e96ec93fb95bda1113eb3fff8d9e |
|
BLAKE2b-256 | 021c511677d9b59290a19714a520de11fefd08fb4422284dbb84fc51a425431a |
File details
Details for the file ctef-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: ctef-0.0.3-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb7861289357fd5e1d156fcfdb9537a8cdd132dfbc0e9c88b807d673857cfa4d |
|
MD5 | db1508c9d81707a2eb27792d62673136 |
|
BLAKE2b-256 | b1a935cc4edd617f75cd1890bfad186576c2b3cb3566894b0327815669b7ca63 |