JuliaDynamics / Attractors.jl

Find attractors (and their basins) of dynamical systems. Perform global continuation. Study global stability (a.k.a. non-local, or resilience). Also tipping points functionality.
MIT License
32 stars 6 forks source link

Cite arxiv paper #66

Closed Datseris closed 1 year ago

codecov-commenter commented 1 year ago

Codecov Report

Merging #66 (a383e7f) into main (0d09c82) will decrease coverage by 0.31%. The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main      #66      +/-   ##
==========================================
- Coverage   69.32%   69.01%   -0.31%     
==========================================
  Files          20       20              
  Lines        1118     1123       +5     
==========================================
  Hits          775      775              
- Misses        343      348       +5     
Impacted Files Coverage Δ
src/continuation/continuation_recurrences.jl 81.53% <ø> (ø)
src/plotting.jl 0.00% <0.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

Datseris commented 1 year ago

cc @awage I just tried to run the example you have coded as part of the extensive tests:

 # Notice special parameter values:
        b, a = -0.9, 1.1 # notice the non-default parameters
        henon_rule(x, p, n) = SVector{2}(1.0 - p[1]*x[1]^2 + x[2], p[2]*x[1])
        ds = DeterministicIteratedMap(henon_rule, ones(2), [a,b])
        ps = range(0.6, 1.1; length = 11)
        pidx = 1
        sampler, = statespace_sampler(Random.MersenneTwister(1234);
            min_bounds = [-2,-2], max_bounds = [2,2]
        )

        # Feature based on period.
        function featurizer(a, t) # feature based on period!
            tol = 1e-5
            L = length(a)
            if abs(a[L-1,1] - a[L,1]) < tol
                # period 1
                return [1]
            elseif abs(a[L-3,1] - a[L,1]) < tol
                # period 3
                return [3]
            else
                return [100]
            end
        end
        clusterspecs = Attractors.GroupViaClustering(optimal_radius_method = 1.0)
        mapper = Attractors.AttractorsViaFeaturizing(ds, featurizer, clusterspecs;
            T = 10, Ttr = 100, threaded = true
        )
        gap = GroupAcrossParameter(mapper; par_weight = 1.0)
        fractions_curves, attractors_info = continuation(
            gap, ps, pidx, sampler;
            samples_per_parameter = 100, show_progress = false
        )

        for (i, p) in enumerate(ps)
            fs = fractions_curves[i]
            if p < 0.9
                k = sort!(collect(keys(fs)))
                @test length(k) == 2
            elseif p > 1.0 # (coexistence of period 1 and 3)
                k = sort!(collect(keys(fs)))
                @test length(k) == 3
            end
            @test sum(values(fs)) ≈ 1
            infos = attractors_info[i]
            @test all(v -> v ∈ ([1.0], [3.0], [100.0]), values(infos))
        end

it doesn't work. only a sngle attractor is found at all parameter values.

awage commented 1 year ago

cc @awage I just tried to run the example you have coded as part of the extensive tests:

Ok, I'll check what is going on.

awage commented 1 year ago

The system is OK, it comes from this paper: Captura de pantalla_2023-04-26_17-13-09

There is a problem with the clustering parameters.

awage commented 1 year ago

It was a problem with the parameters of the mapper and the featurizer due to the changes in rescaling of the features.