No project description provided
Project description
pcurvepy
Principal Curves
This is an implementation of the Principal Curves (Hastie '89) algorithm in Python.
It is a fork of the zsteve/pcurvepy
package where
the projection indices are selected according to our
translation of the R/C++ princurve
package.
Installation:
pip install git+https://github.com/mossjacob/pcurvepy
Example:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import pcurve
data = pd.read_csv('test_data.csv')
x = data.loc[:, ('X1', 'X2')].to_numpy()
# transform data to have zero mean
x = x - np.mean(x, 0)
index = np.arange(0, len(x))
curve = pcurve.PrincipalCurve(k=5)
curve.fit(x)
plt.scatter(x[:, 0], x[:, 1], alpha=0.25, c=index)
plt.plot(curve.points[:, 0], curve.points[:, 1], c='k')
# get interpolation indices
pseudotime_interp, point_interp, order = curve.unpack_params()
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
pcurvepy2-0.1.1.tar.gz
(16.2 kB
view hashes)
Built Distribution
pcurvepy2-0.1.1-py3-none-any.whl
(16.8 kB
view hashes)
Close
Hashes for pcurvepy2-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a53695d00d8c283f177d8c059f9d53387eb6da7ead4da11e00d10c263fbe2fea |
|
MD5 | a6ff47ee9854e17a2e88d6ca7d53c029 |
|
BLAKE2b-256 | f54d08c1d1193fbbb4b22fb8f955a54a106d076eff0031533f031f543ed03edc |