Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symbolic time series with generating partitions #11

Open
sbulcsu opened this issue Feb 12, 2024 · 2 comments
Open

Symbolic time series with generating partitions #11

sbulcsu opened this issue Feb 12, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@sbulcsu
Copy link
Collaborator

sbulcsu commented Feb 12, 2024

The timeseries_to_grid function should be able to generate a symbolic time series for predefined cell edges as well (e.g. generating partitions or Voronoi cells).

cell_edges = [0, 0.99, 1]
sts = timeseries_to_grid(timeseries, grid_size; grid_edges = cell_edges);

We could do something like this (assuming an ordered cell_edges list):

for (i,edge) in enumerate(cell_edges)
            if timeseries[i][1]>edge
                x = i
                continue
            end
end
symbolic_timeseries[i] =x

This is extremely slow, but we need to find the right cell for the actual state of the system.

@sbulcsu sbulcsu added the enhancement New feature or request label Feb 12, 2024
@rusandris
Copy link
Owner

Maybe we should resort to something simple like this:

function timeseries_to_grid(timeseries::TimeSeries{T,1}, partition::Function)  where T <: Real    
  L = length(timeseries)
  
  symbolic_timeseries = Vector{Int64}(undef, L)
  
  for i in 1:L
  symbolic_timeseries[i] = partition(timeseries[i][1])
  end
  
  return symbolic_timeseries
end

allowing the total control over the partitioning scheme.

And then one can go

using StateTransitionNetworks,DynamicalSystems

function f(u, p, n)
  r = p[1]
  x = u[1]
  if x<=r
     return SVector(x/r)
  else
     return SVector((1-x)/(1-r))
  end
end

r = 0.99
ds = DeterministicIteratedMap(f, [0.4], [r])
orbit,t = trajectory(ds,10^4;Ttr=1000)

tent_generating_partition(x::Float64,r::Float64) = x <= r ? 1 : 2

sts = timeseries_to_grid(orbit,x -> tent_generating_partition(x,r))

@rusandris
Copy link
Owner

timeseries_to_grid methods that dispatch to partition::Function were pushed. We should think about implementing all previous gridding through this kind of method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants