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.1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: procurve-0.0.1.tar.gz
  • Upload date:
  • Size: 10.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.1.tar.gz
Algorithm Hash digest
SHA256 dc5443b7612627732367263db665ea69bb939c62bfb72c3cea4c1600f5cfa762
MD5 11a536db3f97b80e6e084d8152968046
BLAKE2b-256 0cecfccada1b0ce0bbcd00cb922a384a778df97435b6080184bb13a35f5c5154

See more details on using hashes here.

File details

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

File metadata

  • Download URL: procurve-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d1e576d21d715409280fdafaf5fba82d3bc12da7ecd8386cdf5bdbe19d8a0a88
MD5 fa9db612a7ccb0a2e839feb2ac2861ce
BLAKE2b-256 fa871d5892456db6aedee5629d13d7965da0ea4533044d54d73cc0def870702d

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