Icon

3. Time Series Analysis with Flow Variables

<p><strong>Time Series Analysis with Machine Learning and Flow Variables</strong></p><p>This workflow is similar to the workflow shown in Chapter 4 "3. Time Series Analysis with Machine Learning". It shows an example of a time series analysis using the verified components <em>Inspect Seasonality</em> and <em>Remove Seasonality</em>.</p><p>The data for this example is website traffic data, reflecting the daily number of website visitors, and we want to predict the next day's number of visitors given the number of visitors in the past <em>n</em> days.</p><p>To detect and deal with the seasonality in the data we first use the <em>Inspect Seasonality</em> component to find a sign of dominant seasonality. Then, to remove seasonality trends in the data, we use the <em>Remove Seasonality</em> components. Instead of adjusting the value manually in the configuration window of the component, this time we use a flow variable to overwrite the setting. </p><p>Lastly, we train and apply a Linear Regression, however, any other numerical prediction algorithm would have worked as well.</p>

Accessing and preprocessing data

Read website.txt file to get daily numbers of website visitors. Note: "Support short data rows" must be enabled.

Rebuilding the signal

Workflow: Time Series Analysis with Machine Learning and Flow Variables


This workflow is similar to the workflow shown in Chapter 4 "3. Time Series Analysis with Machine Learning". It shows an example of a time series analysis using the verified components Inspect Seasonality and Remove Seasonality. However, instead of finding the lag value manually and adjusting the configuration of the Remove Seasonality components, we use the flow variable created by the Inspect Seasonaility component to overwrite the setting in the component. The rest of the example workflow remained unchanged.

Create lag intervals

Copy and shift "no visitors" column n times: from x(t) to x(t), x(t-1), x(t-2), ..., x(t-n).

n = 7 (lag value)

Training Linear Regression & applying trained model on test set

Evaluate prediction

Detect & deal with seasonality

On predictions
Return Seasonality
Lag value forhighest maximum: 7
Inspect Seasonality
Remove missing values;sort by date ascending
Clean and sort data
Reshape data
Table Manipulator
Reshape data
Table Manipulator
Regression Predictor
Lag value: 7
Remove Seasonality
Lag Column
website.txt
CSV Reader
Lag Column
Lag value: 7
Remove Seasonality
Plot no visitors vs. Prediction (no visitors)
Line Plot
90/10 split;Take from the top
Table Partitioner
Calculate statistics
Numeric Scorer
On no visitors
Return Seasonality
no visitors (original) vs. Prediction (no visitors) (original)
Line Plot
Linear Regression Learner

Nodes

Extensions

Links