Skip to main content

URI-ABD: Clustered Learning of Approximate Manifolds

Installation

python3 -m pip install pyclam

Usage

from pyclam import Manifold
from pyclam import Search
from pyclam import criterion
from pyclam import datasets

# Get the data.
data, _ = datasets.bullseye()
# data is a numpy.ndarray in this case but it could just as easily be a numpy.memmap if your data does fit in RAM.
# We used numpy memmaps for the research, though they impose file-IO costs.

search = Search(data, 'euclidean')
# The Search class provides the functionality described in our CHESS paper.
# TODO: Provide link to CHESS paper

search.build(max_depth=10)
# Build the search tree to depth of 10.
# This method can be called again with a higher depth, if needed.

query, radius = data[0], 0.5
rnn_results = search.rnn(query, radius)
# This is how we perform rho-nearest neighbors search with radius 0.5 around the query.

knn_results = search.knn(query, 10)
# This is how to perform k-nearest neighbors search for the 10 nearest neighbors of query.

# TODO: Provide snippets for using CHAODA

# You can also directly use the Manifold functionality provided by CLAM.

manifold = Manifold(data, 'euclidean')
# Any metric allowed by scipy's cdist function is allowed in Manifold.
# You can also define your own distance function. It will work so long as scipy allows it.

manifold.build(
    criterion.MaxDepth(20),  # build the tree to a maximum depth of 20
    criterion.MinRadius(0.25),  # clusters with radius less than 0.25 cannot be partitioned.
    criterion.Layer(6),  # use the clusters ad depth 6 to build a Graph.
    criterion.Leaves(),  # use the leaves of the tree to build another Graph.
)
# Manifold.build can optionally take any number of criteria.
# pyclam.criterion defines some criteria that we have used in research.
# You are free to define your own.
# Take a look at pyclam/criterion.py for hints of how to define custom criteria.

The Manifold class relies on the Graph and Cluster classes. You can import these and work with them directly if you so choose. The classes and methods are all very well documented. Go crazy.

Contributing

Pull requests and bug reports are welcome. For major changes, please open an issue to discuss what you would like to change.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyclam-0.3.0.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyclam-0.3.0-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file pyclam-0.3.0.tar.gz.

File metadata

  • Download URL: pyclam-0.3.0.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for pyclam-0.3.0.tar.gz
Algorithm Hash digest
SHA256 5477bc567bd5c647e96510dc2f8b7b3ea4d8ac4a712c654969edc668ddbe7b78
MD5 6bee115135b4daa2e705435fd2fc883d
BLAKE2b-256 c8c4e1284f6c6d05f91fedfbb9d3e5dcc3d5c09bd7a6da65c83aebe9ce954b1e

See more details on using hashes here.

File details

Details for the file pyclam-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pyclam-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 24.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for pyclam-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b5b970e782b200f73b93f62cb6731a2452578344f174f29d83a1265fc6c3df2
MD5 77511fddf6927b14af0f585160260859
BLAKE2b-256 3a384f2be7f09b9e7dbb1508a0ab275d8053b10c0ffa8c07964bb1cd7a333c85

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page