Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
lmcinnes committed Jan 29, 2020
1 parent e8e6a4f commit cf5bb38
Showing 1 changed file with 45 additions and 3 deletions.
48 changes: 45 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,45 @@ Euclidean distance representation.
How to use PerVect
------------------

The pervect library inheritis from sklearn classes and can be used as an sklearn
transformer.
The pervect library inherits from sklearn classes and can be used as an sklearn
transformer. Assuming that you have a list persistence diagrams where each
diagram is a numpy array of points in 2D then you can vectorize by simply applying:

.. code:: python
import pervect
vects = pervect.PersistenceVectorizer().fit_transform(diagrams)
It can also be used in standard sklearn pipelines along with other machine learning
tools including clustering and classifiers.
tools including clustering and classifiers. For example, given a set of training
diagrams, and a separate test set of diagrams we could do:

.. code:: python
import pervect
vectorizer = pervect.PersistenceVectorizer().fit(train)
train_vectors = vectorizer.transform(train)
test_vectors = vectorizer.transform(test)
The vectorizer is also effective at efficiently approximating Wasserstein distance
between diagrams. A trained model can compute pairwise Wasserstein distance between
a list of diagrams as follows:

.. code:: python
import pervect
vectorizer = pervect.PersistenceVectorizer().fit(train)
test_diagram_distances = vectorizer.pairwise_p_wasserstein_distance(test, p=1)
The vectorizer can also automatically produce UMAP representations of the diagrams,
either using "hellinger" distance or Wasserstein distance (note that transforming
new data using Wassersteing trained UMAP is currently unavailable).

.. code:: python
import pervect
diagram_map = pervect.PersistenceVectorizer(apply_umap=True).fit(diagrams)
------------
Installation
Expand Down Expand Up @@ -81,6 +110,19 @@ Install the package
pip install .
----------
References
----------

This package was inspired by and builds upon the work of Elizabeth Munch, Jose Perea,
Firas Khasawneh and Sarah Tymochko. You can refer the the papers:

Jose A. Perea, Elizabeth Munch, Firas A. Khasawneh, *Approximating Continuous
Functions on Persistence Diagrams Using Template Functions*, arXiv:1902.07190

Sarah Tymochko, Elizabeth Munch, Firas A. Khasawneh, *Adaptive Partitioning for
Template Functions on Persistence Diagrams*, arXiv:1910.08506v1

-------
License
-------
Expand Down

0 comments on commit cf5bb38

Please sign in to comment.