In [1]:
# Import the class
import km

# Some sample data
from sklearn import datasets
from sklearn.decomposition import PCA

data, labels = datasets.make_circles(n_samples=5000, noise=0.03, factor=0.3)

In [2]:
# Initialize
mapper = km.KeplerMapper(verbose=1)

In [3]:
# Fit to and transform the data
projected_data = mapper.fit_transform(data, projection=PCA())


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-3-72eb0cdf89e0> in <module>()
      1 # Fit to and transform the data
----> 2 projected_data = mapper.fit_transform(data, projection=PCA())

NameError: name 'PCA' is not defined

In [ ]:
# Create dictionary called 'complex' with nodes, edges and meta-information
complex = mapper.map(projected_data, data, nr_cubes=10)

# Visualize it
mapper.visualize(complex, path_html="make_circles_keplermapper_output.html", 
                 title="make_circles(n_samples=5000, noise=0.03, factor=0.5)")

In [ ]: