Skip to content

Commit b6c6c76

Browse files
authored
Update README.md
1 parent 8572170 commit b6c6c76

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@
33
TS2G<sup>2</sup> stands for "timeseries to graphs and back". The library implements a variety of strategies to convert timeseries into graphs, and convert graphs into sequences. Below, we provide a code snippet to generate a graph from timeseries:
44

55
# load time series from a file
6-
timegraph = model.Timeseries(CsvStock(some_file_path, "ColumnOfInterest").from_csv())\
6+
timegraph = Timeseries(CsvFile(amazon_path, "Close").from_csv())\
77

88
# and preprocess the timeseries with multiple preprocessing strategies
9-
.with_preprocessing(model.TimeseriesPreprocessingComposite()\
10-
.add_strategy(model.TimeseriesPreprocessingSegmentation(60, 120))\
11-
.add_strategy(model.TimeseriesPreprocessingSlidingWindow(5)))\
9+
.with_preprocessing(TimeseriesPreprocessingComposite()\
10+
.add(TimeseriesPreprocessingSegmentation(60, 120))\
11+
.add(TimeseriesPreprocessingSlidingWindow(5)))\
1212

1313
# then create a graph from the timeseries, following a particular strategy
14-
.to_graph(tgs.BuildTimeseriesToGraphNaturalVisibilityStrategy().get_strategy())\
14+
.to_graph(BuildTimeseriesToGraphNaturalVisibilityStrategy().get_strategy())\
1515

1616
# link graphs that result from the same timeseries, but at different sliding window frames
17-
.link(mgl.LinkGraphs().sliding_window())\
17+
.link(LinkGraphs().sliding_window())\
1818

1919
# and combine identical graphs that result from the abovementioned time windows into single nodes
20-
.combine_identical_nodes_slid_win()\
20+
.combine_identical_subgraphs()\
2121

2222
# finally, draw the graph
23-
.draw("red")
23+
.draw("blue")
2424

2525
For a more detailed example, look at the [Amazon stocks demo](https://github.com/graph-massivizer/ts2g2/blob/main/tutorials/demo-ts2g2.ipynb).
2626

@@ -240,9 +240,9 @@ The package is a joint effort between the [Jožef Stefan Institute](https://www.
240240

241241
Graphs are converted back to timeseries by sampling node values from the graph following different strategies. Below, we provide a short snippet of code, to illustrate how this can be done.
242242

243-
timegraph.to_sequence(model.ToSequenceVisitorSlidingWindow()\
244-
.next_node_strategy(tts.StrategySelectNextNodeRandomlyFromFirstGraph())\
245-
.next_value_strategy(tts.StrategyNextValueInNodeRandomForSlidingWindow().skip_every_x_steps(1))\
243+
timegraph.to_sequence(ToSequenceVisitorSlidingWindow()\
244+
.next_node_strategy(StrategySelectNextNodeRandomlyFromFirstGraph())\
245+
.next_value_strategy(StrategyNextValueInNodeRandomForSlidingWindow().skip_every_x_steps(1))\
246246
.ts_length(50))\
247247
.draw_sequence()
248248

0 commit comments

Comments
 (0)