Closed Datseris closed 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.
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.
The system is OK, it comes from this paper:
There is a problem with the clustering parameters.
It was a problem with the parameters of the mapper and the featurizer due to the changes in rescaling of the features.
Codecov Report
81.53% <ø> (ø)
0.00% <0.00%> (ø)
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more