GithubHelp home page GithubHelp logo

Performance advice about ripserer.jl HOT 1 CLOSED

mtsch avatar mtsch commented on August 15, 2024
Performance advice

from ripserer.jl.

Comments (1)

mtsch avatar mtsch commented on August 15, 2024

Hey, I didn't get the notification for this issue, sorry about that.

If you don't need it to be a Rips complex, you can try Alpha, which should work OK in the 5d case. For higher dimensions, it might take forever to build the filtration, but things should be pretty quick once that's done.

Another option is EdgeCollapsedRips, which may or might not work well. How long it takes to build depends a lot on the shape of the data. The situation there is similar - once the complex is built, things should be pretty fast, but it may take forever.

There is also a very cool algorithm for handling large data sets, but I haven't implemented it because I don't understand it. It can be found here. Maybe you can find a way to use it, it's a pretty old and unmaintained library.

On the downsampling: I have done something similar before. Below is a function that downsamples data such that each point's nearest neighbour is at least r away. This works well if your sample is uneven or if you don't care about very small structures in your data.

using NearestNeighbors
using Distances
using StaticArrays

function downsample(points::Vector{<:Union{NTuple{D,T},SVector{D,T}}}, r) where {D,T}
    points = shuffle(points)
    points_matrix = reshape(reinterpret(T, points), (D,length(points))) # KDTree wants points in a matrix

    keep = fill(true, length(points))
    tree = KDTree(points_matrix, Euclidean()) # for other metrics, you may want to use a BallTree instead

    for i in 1:length(points)
        k = keep[i]
        p = points[i]
        if k
            keep[inrange(tree, SVector(p), r, false)] .= false
            keep[i] = true # i-th point was removed, so we have to add it back
        end
    end
    return points[keep]
end

Hope this helps and let me know if you have any other questions!

from ripserer.jl.

Related Issues (15)

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.