Code Monkey home page Code Monkey logo

tda.jl's Introduction

Topological Data Analysis

This package provides various tools for topological data analysis.

Installation

pkg> add https://github.com/wildart/SmithNormalForm.jl.git#0.2.1
pkg> add https://github.com/wildart/ComputationalHomology.jl.git#master
pkg> add https://github.com/wildart/TDA.jl.git#master

For Julia 1.1+, add BoffinStuff registry in package manager, and proceed installation:

pkg> registry add https://github.com/wildart/BoffinStuff.git
pkg> add TDA

Examples

Persistance Diagram & Barcode

using TDA, ComputationalHomology, Plots
# crate some intervals of various dimensions
ints = Dict(0=>diagram(2.0=>6.0, 5.0=>10.0, 1.0=>Inf), 1=>diagram(9.0=>12.0))

# plot persistance diagram
plot(ints)
# plot barcode
plot(ints, seriestype=:barcode)

Nerve

using TDA, ComputationalHomology, Plots
# generate simplicial complex
cplx = ComputationalHomology.sphere(2)
# generate some points on circle
D = mapslices(p->p./sqrt(sum(p.^2)), randn(30,2), dims=2)
# plot points
plot(D[:,1], D[:,2], seriestype = :scatter, markersize = 2)
# plot nerve
plot!(cplx, D, linewidth = 2) # or plot(cplx)

Mapper

Mapper algorithm was described in "Topological Methods for the Analysis of High Dimensional Data Sets and 3D Object Recognition" by Gurjeet Singh, Facundo Mémoli and Gunnar Carlsson. Here is an example based on the description from the Figure 1 of the above paper.

using TDA, Plots

# generate and plot some dataset
X = hcat(TDA.circlepoints(500, 0.5, noise=0.05)...)'
plot(X[1,:], X[2,:], seriestype=:scatter)

# define Mapper filter function for dataset: f(x) = ||x.x - p.x||
fltfn = (data)->vec(mapslices(p->p[1]-minimum(data[1,:]), data, dims=1))
# plot data colored by filter function values
plot(X[1,:], X[2,:], label="", zcolor=fltfn(X), seriestype=:scatter, ms=2)

# call Mapper algorithm with the particular filter function.
mpr = TDA.mapper(X, filter=fltfn, seed=0, intervals=5, overlap=0.2)

# plot topological layout - mapper graph (by default circular layout is used)
plot(mpr, c=:viridis)
# use `constant_layout` for positioning Mapper graph vertices
# at centers of cover patches
plot(mpr, c=:viridis, complex_layout=TDA.constant_layout)

TODO

  • Plots
    • Persistance Diagram
    • Barcode
    • 1D Simplicial Subcomplex (Graph)
    • Landscape
  • Mapper
    • Clustering
      • K-means
      • Hierarchical
    • Mode filter functions
    • Plots

tda.jl's People

Contributors

wildart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tda.jl's Issues

Add a better installation framework.

I believe the toml is fine but following the instructions in the readme produces some errors. The git syntax uses # when I think it should be @ for the SmithNormalForm package. Could we streamline this a bit? It's likely those aren't even needed since it's specified in the project deps.

Length 1 covering causes error in mapper

The following line will fail if the covering c contains a single index only, since kmeans does not allow you to cluster one-dimensional data

lbls = clusterselectionfn(clusterfn, view(X, :, c); kwargs...)

Actually, the length of the covering must be grater than k.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.