Skip to main content

Principal curve for spherical data using splines.

Project description

binder

ProCurve

What is ProCurve?

It is a robust principal curve package focused on fitting data that lies in a sphere. Splines are the estimators used for the principal curves.

How to install

The package can be installed via pip using:

pip install procurve

Example:

Run the load base case as:

from src.procurve.principal_curve import PrincipalCurve
from src.procurve.utils import create_dataset
from src.procurve.plotting import plot_3d, segments
import numpy as np
from mpl_toolkits.mplot3d.art3d import Line3DCollection

X = create_dataset(source="snake")
spline_params = {"degree": 4,
                 "low_angle_deg": -40,
                 "high_angle_deg": 180,
                 "radius": 1.0}
pc = PrincipalCurve()
X, s, f_spline = pc.fit(X, init_fn="curve", param_fun=spline_params)
s_high_res = np.linspace(0, 1, 1000)
f_s = f_spline(s_high_res)

#%% Plot data
ax = plot_3d(X, plot_wireframe=True)
ax.plot(f_s[:,0], f_s[:,1],  f_s[:,2], color="C3", linewidth=0.5, label="Principal curve")
line_collections_fit = segments(pc.last_iteration_log["data_sorted"],
                                pc.last_iteration_log["p_orthogonal"])
lc_fit = Line3DCollection(line_collections_fit, colors="C1", linewidths=0.4, label="Orthogonal projection")
ax.add_collection(lc_fit)
ax.legend(fontsize="small")

Reading and citations:

The pseudo-algorithm and mathematical formulation can be found here.

How to contact us

Any questions, suggestions or collaborations contact Mauricio Salazar at <e.m.salazar.duque@tue.nl>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

procurve-0.0.2.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

procurve-0.0.2-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file procurve-0.0.2.tar.gz.

File metadata

  • Download URL: procurve-0.0.2.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for procurve-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d096a0b6ab34142dcafd1f3cbf302867f039d2873d5db65f6a2e031d5c69d174
MD5 96664c5b741d32a550ca38a10e2f014b
BLAKE2b-256 e9525204e003cf2e69b96643ccb5c21f5fda7da0797a8a921814f0ebd3937c9e

See more details on using hashes here.

File details

Details for the file procurve-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: procurve-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for procurve-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2cd1ba594ca0aeda5a82c9faa680a2d99e4f674e4f851150aa5f98c4c5304f2c
MD5 6e6e06dec6b420bf63b21b1a8230b53c
BLAKE2b-256 1532f6c6ad2c25678f6da57aa879566bd76c675d5c9d490c423af77ba54d1325

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page