Skip to content

Principal curves implementation (Hastie '89) in Python

License

Notifications You must be signed in to change notification settings

zsteve/pcurvepy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pcurvepy

Principal curves implementation (Hastie '89) in Python

Installation:

pip install pcurvepy

Example:

import pandas as pd
import matplotlib as mp
import matplotlib.pyplot as plt
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))

p = pcurve.PrincipalCurve(k = 5)
p.fit(x)

plt.scatter(x[:, 0], x[:, 1], alpha = 0.25, c = index)
plt.plot(p.p[:, 0], p.p[:, 1], c = 'k')

example

About

Principal curves implementation (Hastie '89) in Python

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages