Lesson 1 - Meet Lantern & Vine

Welcome to Meet Lantern & Vine

Every module in this course, from decomposition through backtesting, was built and tested on Cyclepath, a single monthly bike-share series. That consistency made each new idea easier to isolate, but it also means you have never had to apply this course’s tools to a series you were not already familiar with. This capstone fixes that. Meet Lantern & Vine, a fictional home-goods shop, and its weekly unit sales over four years, a new series with its own structure, explored here for the very first time.

By the end of this lesson, you will be able to:

  • Generate and explore a new seeded series the same way Module 1 explored Cyclepath
  • Read summary statistics, yearly totals, and a rolling mean for a series you have not seen before
  • Identify three structural differences from Cyclepath that this capstone will need to handle
  • State the seven-stage pipeline this module will run from scratch

Let’s meet the series.


Generating Lantern & Vine

import numpy as np
import pandas as pd

def lantern_vine():
    idx = pd.date_range("2020-01-06", periods=208, freq="W-MON")
    t = np.arange(208)
    rng = np.random.default_rng(7)
    growth_rate = np.where(t < 104, 0.008, 0.003)
    log_level = np.cumsum(growth_rate)
    level = 500 * np.exp(log_level)
    seasonal_factor = 1 + 0.35 * np.sin(2 * np.pi * (t - 35) / 52)
    noise_factor = rng.normal(1, 0.04, 208)
    y = level * seasonal_factor * noise_factor
    return pd.Series(np.round(y).astype(int), index=idx, name="units_sold")

y = lantern_vine()
print(len(y), y.index[0].date(), y.index[-1].date())
print(y.iloc[:5].tolist())
print(y.iloc[-5:].tolist())
208 2020-01-06 2023-12-25
[660, 662, 639, 613, 613]
[2163, 2258, 2227, 2001, 1943]

208 weeks, exactly four years, from the first Monday of January 2020 through the last Monday of December 2023. The series is built from a level that grows over time, multiplied by a seasonal factor that swings around 1.0, multiplied by a small amount of random noise also centered near 1.0. That multiplication, rather than addition, is deliberate, and Lesson 2 will confirm exactly what it implies. For now, treat this the way Module 1 treated Cyclepath on first contact: a series to explore, not yet to theorize about.


A First Look

print(y.describe())
count     208.000000
mean     1070.826923
std       453.250577
min       362.000000
25%       714.250000
50%       992.000000
75%      1381.250000
max      2258.000000
Name: units_sold, dtype: float64

Weekly unit sales range from 362 to 2,258, averaging 1,070.8 across the full four years, with a standard deviation (453.3) that is unusually large relative to the mean, over 40%, a first hint that this series’ swings are large relative to its level, exactly the kind of relationship Module 2 taught you to check for directly rather than assume.

yearly = y.resample("YE").sum()
print(yearly.values.tolist())
[32464, 49558, 64549, 76161]

Yearly totals climb every year, 32,464 in 2020 up to 76,161 in 2023, more than doubling over four years. But look at the year-over-year growth rate, not just the totals: 2020 to 2021 grew by 52.6%, 2021 to 2022 by 30.3%, and 2022 to 2023 by only 18.0%. Cyclepath’s yearly growth was remarkably steady across all eight of its years. Here, growth is clearly slowing down, a second hint this lesson will not yet resolve, and Lesson 2 will chase down directly.

ma = y.rolling(52).mean()
print(round(ma.dropna().iloc[0], 1), ma.dropna().index[0].date())
print(round(ma.dropna().iloc[-1], 1), ma.dropna().index[-1].date())
624.3 2020-12-28
1464.6 2023-12-25

A 52-week rolling mean, the weekly equivalent of Cyclepath’s 12-month rolling mean, smooths away the seasonal swing and confirms the same rising trend the yearly totals already showed, climbing from about 624 to about 1,465 units a week.

A line chart of Lantern & Vine's weekly unit sales from January 2020 to December 2023. The series rises overall with a visible yearly wiggle, peaking each year around late November or December and dipping each June, but the steepness of the year-to-year climb is visibly greater in the first half of the chart than the second half, where the line rises more gradually. A smooth rolling-mean line overlaid on top rises from about 624 to about 1,465 and visibly bends flatter in its second half.
Lantern & Vine's weekly unit sales: rising overall, with a clear yearly wiggle, but climbing noticeably faster in the first two years than the last two, a shape Cyclepath's constant, steady trend never showed.

Three Differences From Cyclepath, Already Visible

Before running a single formal test, three structural differences are already showing:

  • Weekly, not monthly. Cyclepath’s seasonal period was 12 (months in a year). Lantern & Vine’s is 52 (weeks in a year), a much longer cycle relative to the data available, only four repeats of it across the whole series instead of Cyclepath’s eight.
  • A standard deviation unusually large relative to the mean, an early hint (not yet a confirmed diagnosis) that the seasonal swing might scale with the level rather than stay fixed, the multiplicative structure Module 2’s swing-to-level test was built to check.
  • Decelerating year-over-year growth (52.6%, then 30.3%, then 18.0%), unlike Cyclepath’s steady climb. Something about this series’ trend is not constant, and finding out exactly what changed, and when, is Lesson 2’s first job.

The pipeline this module runs

This capstone follows the same seven stages every real forecasting project follows, and that this course has built one piece at a time: explore (this lesson), decompose and diagnose structure (Lesson 2), make stationary and identify candidate orders (Lesson 3), fit and backtest models (Lesson 4), and finally report a genuine forecast against an honest baseline (Lesson 5). Nothing new is being invented; every tool already exists from Modules 1 through 8. What is new is applying all of them, in order, to a series that does not behave exactly like the one you learned them on.


Practice Exercises

Exercise 1: Why check standard deviation relative to the mean?

Lantern & Vine’s standard deviation (453.3) is about 42% of its mean (1,070.8). Why is that ratio worth noticing before running any formal test?

Hint

A standard deviation that is a large fraction of the mean is a rough, informal early signal that the series’ spread might be tied to its level, exactly the multiplicative signature Module 2 taught you to check for formally. It is not proof of anything on its own, since a series with a large but constant seasonal swing on top of a small mean could produce the same ratio, but it is exactly the kind of observation that should make you reach for Module 2’s swing-to-level test rather than assume the series behaves like Cyclepath by default.

Exercise 2: Why does four cycles matter for period 52?

Cyclepath had eight full yearly cycles (96 months, period 12). Lantern & Vine has four full yearly cycles (208 weeks, period 52). Why might having fewer cycles make some of this course’s later tools harder to apply?

Hint

Several tools from this course need to average or difference across full seasonal cycles, seasonal differencing, seasonal decomposition, and seasonal ACF all lose more relative data, and become noisier estimates, with only four cycles to work with than with eight. A single seasonal difference on a 52-period series discards a full year, a quarter of the entire dataset, versus an eighth of Cyclepath’s. Fewer repeats of the seasonal pattern also means less averaging-out of noise when estimating what that pattern actually looks like, something Lesson 2 and Lesson 3 will both have to work around.

Exercise 3: Predict what caused the growth deceleration

Without running any more code, and using only the yearly growth rates already computed (52.6%, 30.3%, 18.0%), does this look more like a single smooth slowdown or a sudden change at one specific point?

Hint

With only three year-over-year numbers, either explanation is still plausible from this evidence alone, a gradually decaying growth rate would produce a similar-looking sequence to a single abrupt change roughly in the middle of the series. Telling the two apart needs a finer-grained look at the trend within each year, not just year-to-year totals, exactly the kind of investigation Lesson 2 takes on next by working with the trend at the resolution of individual weeks rather than whole years.


Summary

Lantern & Vine is a new, seeded, 208-week series, four years of a fictional home-goods shop’s weekly unit sales, ranging from 362 to 2,258 and averaging 1,070.8. Yearly totals climb from 32,464 to 76,161, but the year-over-year growth rate itself decelerates, 52.6%, then 30.3%, then 18.0%, unlike Cyclepath’s steady pace. A first exploration already surfaces three structural differences from Cyclepath that this capstone will have to handle: a weekly frequency with a 52-week seasonal period instead of 12, an unusually large standard deviation relative to the mean hinting at multiplicative structure, and a decelerating trend rather than a constant one.

Key Concepts

  • A new series, the same first steps — describe, resample, and a rolling mean, exactly Module 1’s approach, applied fresh.
  • Three real differences from Cyclepath — weekly frequency (period 52), a possible multiplicative structure, and a decelerating rather than constant trend.
  • Fewer seasonal cycles — four repeats of the yearly pattern instead of eight, which will make some later diagnostics noisier.
  • The seven-stage pipeline — explore, decompose, stationarize, identify, fit, backtest, report, the structure this entire module follows.

Why This Matters

Every technique this course has built was learned on a series designed to teach that technique cleanly. A real forecasting project rarely offers that convenience, and the true test of whether you have learned a method is whether you can apply it to a series that does not match the one you learned it on. Lantern & Vine’s three visible differences, weekly data, a possibly multiplicative structure, and a changing growth rate, are exactly the kind of complications a real dataset introduces, and this module will confront each one directly rather than assume Cyclepath’s answers still apply. Next, Lesson 2 chases down the growth-rate deceleration precisely, and settles the additive-versus-multiplicative question with real evidence.


Next Steps

Continue to Lesson 2 - A Trend That Changes Pace

Pin down exactly when this series' growth rate changed, and confirm its multiplicative structure with real evidence.

Back to Module Overview

Return to the Capstone module overview


Continue Building Your Skills

You have met Lantern & Vine and already spotted three ways it differs from Cyclepath: a weekly cadence, a hint of multiplicative structure, and a decelerating trend. Next, you will pin down exactly when that deceleration happened and confirm, with the same real-evidence discipline Module 2 taught, whether this series is genuinely multiplicative rather than additive.

Sponsor

Keep DATATWEETS free. Help fund practical data, AI, and engineering lessons for learners worldwide.

Buy Me a Coffee at ko-fi.com