pik-copan / pyunicorn

Unified Complex Network and Recurrence Analysis Toolbox
http://pik-potsdam.de/~donges/pyunicorn/
Other
195 stars 86 forks source link

How to use pyunicorn.timeseries.visibility_graph.VisibilityGraph to transform a two-dimensional time series to a visibality-graph? #136

Open p577665228 opened 4 years ago

p577665228 commented 4 years ago

I use pyunicorn.timeseries.visibility_graph.VisibilityGraph to transform a two-dimensional time series to a visibality-graph, but I got an error as follow. ValueError: Buffer has wrong number of dimensions (expected 1, got 2)

The support document says, time_series (2D array (time, dimension)) – The time series to be analyzed, can be scalar or multi-dimensional.

Here is the code to test.

import numpy as np from pyunicorn.timeseries.visibility_graph import VisibilityGraph

timeSeries1 = np.random.rand(10) timeSeries2 = np.random.rand(10) timeSeries = np.zeros(shape=(10,2)) for i in range(10): timeSeries[i] = [timeSeries1[i], timeSeries2[i]] graph = VisibilityGraph(timeSeries, timings=None, missing_values=False, horizontal=False, silence_level=0)

fkuehlein commented 2 months ago

Hi @p577665228,

thank you for reporting this, and please excuse the very late reply.

Although stated otherwise in the documentation, the construction of Visibility Graphs is currently only implemented for 1-dimensional timeseries.

The implementation of VGs for multivariate timeseries should definitely be discussed. A quick search lead me to the method of Vector Visibility Graphs proposed by Ren & Jin (2019), does anyone know more about such algorithms for multivariate timeseries?

I will correct the respective docstring in the meantime.