Time series — trend ও seasonality
এই পাঠে যা শিখবেন
- Time series কী, IID data থেকে কেন আলাদা
- Trend, seasonality, cyclicity, noise — চার component
- Additive vs multiplicative decomposition
- Stationarity ও ADF test
- Bangladesh-এ Eid, Ramadan, harvest — কীভাবে seasonality model
১ · Time series কী
Time seriesTime Seriesসময়ের সাথে indexed observations-এর sequence — যেমন প্রতিদিনের stock price, প্রতি ঘণ্টার temperature। প্রতিটি observation আগেরটির উপর নির্ভরশীল হতে পারে। = সময়-অনুযায়ী indexed observations। Daily bKash transaction count, monthly Daraz revenue, hourly Pathao ride — সবই time series।
Standard ML-এর সাথে পার্থক্য:
- IID assumption violated: প্রতিটি row independent না — গতকাল আজকের prediction-এ matter।
- Order matters: shuffle করা যাবে না।
- Train-test split: random না — time-based।
- Special tools: ARIMA, Prophet, SARIMA, deep methods (LSTM, Transformer)।
২ · চার component
১) Trend (T): long-term direction — উপরে, নিচে, flat।
২) Seasonality (S): regular periodic — daily, weekly, yearly।
৩) Cyclicity (C): non-fixed period oscillation — যেমন business cycle।
৪) Residual (R) / Noise: বাকি unexplained — random।
Trend: Bangladesh GDP যেমন গত ১০ বছরে স্থিরভাবে বৃদ্ধি — upward trend। Land-line subscription downward trend।
Seasonality: Daraz-এর Eid-এ বিক্রি প্রতি বছর spike — yearly seasonality (period = ১২ মাস)। Ride-share app-এ daily peak সকাল ৮-১০ ও বিকাল ৫-৭ — daily seasonality (period = ২৪ ঘণ্টা)।
Cyclicity: stock market-এ multi-year boom-bust — fixed period না (varies ৩-১০ years)।
Noise: বাকি random fluctuation।
৩ · Additive vs Multiplicative decomposition
Additive:
$$Y_t = T_t + S_t + R_t$$
Seasonal amplitude time-এ constant। Daraz daily orders — যদি Eid spike ৫,০০০-এ constant হয় (regardless of base level)।
Multiplicative:
$$Y_t = T_t \times S_t \times R_t$$
Seasonal amplitude trend-এর সাথে scale করে। Daraz revenue — Eid-এ ১.৫× হয় (whatever the base)। Bangladesh-এর growing economy-তে এটাই বেশি common।
কীভাবে decide:
- Plot করে দেখুন seasonal swing time-এ বাড়ছে কি না।
- Bangladesh growing market-এ multiplicative usually।
- Statsmodels:
seasonal_decompose(model='additive')বা'multiplicative'। - Multiplicative-এ value > 0 দরকার।
৪ · Stationarity
StationarityStationaritytime series-এর statistical property সময়ের সাথে অপরিবর্তিত — mean constant, variance constant, autocovariance শুধু lag-এর উপর নির্ভর। ARIMA-র মতো model-এর precondition। — time series-এর statistical property time-এ অপরিবর্তিত:
- Mean constant।
- Variance constant।
- Autocovariance শুধু lag-এর উপর — absolute time-এ না।
Stationary ≠ flat। Stationary series fluctuate করে, কিন্তু statistical property unchanging।
Stationary নয় কেন important — examples:
- Bangladesh GDP — upward trend → mean changing → non-stationary।
- BSEC stock price — drift → non-stationary।
- Daily temperature — seasonal → non-stationary (mean depends on month)।
Stationary বানানো:
- Differencing: $Y_t - Y_{t-1}$ — trend remove।
- Log transform: variance stabilize।
- Seasonal differencing: $Y_t - Y_{t-12}$ — yearly seasonality remove।
৫ · ADF test (Augmented Dickey-Fuller)
Stationarity-র formal hypothesis test।
- $H_0$: series non-stationary (unit root আছে)।
- $H_1$: stationary।
- p-value < 0.05 → reject $H_0$ → stationary।
Statsmodels: from statsmodels.tsa.stattools import adfuller।
KPSS test — opposite: $H_0$ stationary। Both run করলে confidence বাড়ে।
৬ · Autocorrelation (ACF) ও Partial (PACF)
Time series-এ এক observation আগেরটির সাথে কতটা correlated। ARIMA-র parameter (p, q) চয়নে অপরিহার্য।
$$\rho_k = \frac{\text{Cov}(Y_t, Y_{t-k})}{\text{Var}(Y_t)}$$
- ACF — k-lag-এ correlation।
- PACF — k-lag-এর effect (intermediate lag-এর effect remove করে)।
৭ · Bangladesh-এ time series patterns
- Eid (২ বার/বছর): Daraz, Bata, Aarong-এ massive spike।
- Ramadan: daytime e-commerce slow, iftar-পর spike।
- Pohela Boishakh: April 14 — fashion industry peak।
- Monsoon (June-Sep): Pathao bike demand কমে, food delivery বাড়ে।
- Cricket match: Bangladesh vs India — internet usage spike।
- Salary day (last day of month): bKash transaction spike।
- Year-end (Dec): Bangladesh budget-related spending।
- February: book industry spike (Boi Mela)।
৮ · Statsmodels দিয়ে decomposition
import pandas as pd
import numpy as np
from statsmodels.tsa.seasonal import seasonal_decompose
# নকল Daraz daily revenue, ২ বছর
np.random.seed(0)
days = pd.date_range('2023-01-01', periods=730, freq='D')
trend = np.linspace(1000, 2000, 730) # upward
seasonal = 200 * np.sin(2 * np.pi * np.arange(730) / 365) # yearly
weekly = 50 * np.sin(2 * np.pi * np.arange(730) / 7) # weekly
noise = np.random.normal(0, 80, 730)
revenue = trend + seasonal + weekly + noise
ts = pd.Series(revenue, index=days)
# Decomposition
result = seasonal_decompose(ts, model='additive', period=365)
print("Trend (last 5):\n", result.trend.tail().round(0))
print("\nSeasonal (Jan-1, Apr-1, Jul-1, Oct-1):")
for d in ['2023-01-01','2023-04-01','2023-07-01','2023-10-01']:
print(f" {d}: {result.seasonal[d]:.0f}")
print("\nResidual std:", result.resid.std().round(1))
seasonal_decompose — moving-average-based। সরল কিন্তু effective। STL — robust alternative।
৯ · ADF test কোডে
import numpy as np
import pandas as pd
from statsmodels.tsa.stattools import adfuller
np.random.seed(0)
# Series 1: random walk (non-stationary)
rw = np.cumsum(np.random.normal(0, 1, 500))
# Series 2: white noise (stationary)
wn = np.random.normal(0, 1, 500)
for name, series in [('Random walk', rw), ('White noise', wn)]:
result = adfuller(series)
print(f"\n{name}:")
print(f" ADF statistic: {result[0]:.3f}")
print(f" p-value: {result[1]:.4f}")
if result[1] < 0.05:
print(" → Stationary (reject H0)")
else:
print(" → Non-stationary (fail to reject H0)")
# Difference random walk
rw_diff = np.diff(rw)
result = adfuller(rw_diff)
print(f"\nDifferenced random walk:")
print(f" p-value: {result[1]:.4f}")
print(" → Stationary after differencing" if result[1] < 0.05 else " → Still non-stationary")
১০ · Practical workflow
- Plot — visual inspection (trend, seasonality identify)।
- Decomposition (statsmodels)।
- ACF/PACF plot।
- ADF test — stationarity check।
- Differencing/log transform if needed।
- Model fit (ARIMA, Prophet — পাঠ ২৩-এ)।
- Walk-forward validation।
ভাবনার প্রশ্ন
প্রতিটি প্রশ্ন নিজে কিছুক্ষণ ভাবুন — তারপর "→ উত্তর" চাপুন।
প্র ০১ "Stationarity" কেন এত গুরুত্বপূর্ণ? Non-stationary series-এ ARIMA-র মতো model কেন কাজ করে না?
এটি classical time series statistics-এর foundation। Stationarity-র necessity বুঝলে — অনেক method-এর behavior intuitive।
Stationarity-র সংজ্ঞা (strict):
- Joint distribution of any subset $(Y_{t_1}, ..., Y_{t_k})$ time-shift invariant।
- $P(Y_{t_1} \le y_1, ..., Y_{t_k} \le y_k) = P(Y_{t_1+\tau} \le y_1, ..., Y_{t_k+\tau} \le y_k)$।
- Practically too strict; weak (covariance) stationarity used।
Weak stationarity:
- Mean constant: $E[Y_t] = \mu$ — সব $t$-তে same।
- Variance constant: $\text{Var}(Y_t) = \sigma^2$ — সব $t$-তে same।
- Covariance lag-only: $\text{Cov}(Y_t, Y_{t+k}) = \gamma_k$ — depends on $k$, not $t$।
কেন ARIMA-এর জন্য stationarity essential:
(১) Statistical estimation valid
- OLS estimation — sample-based mean ও variance population-এর estimate।
- Non-stationary-এ — sample mean time-window-এ change, "true mean" undefined।
- Estimator unbiased property break।
(২) Forecasting validity
- "Past pattern = future pattern" assumption।
- Stationary-তে এটা true।
- Non-stationary-এ পুরোনো data future-এর প্রতিনিধি না।
(৩) Spurious regression
- Granger ও Newbold (১৯৭৪): দু'টি independent random walk-এর regression-এ R² = 0.7+।
- Pure noise correlation — meaningless।
- Bangladesh GDP ও global temperature both rising → "GDP causes warming" — spurious।
(৪) Confidence interval
- Standard error formula stationary assume।
- Non-stationary-এ — under-coverage; nominal 95% actually 60%।
উদাহরণ — non-stationary failure:
- Bangladesh GDP series (rising trend)।
- ARMA(1,1) fit — $Y_t = \phi Y_{t-1} + \theta \epsilon_{t-1}$।
- $\phi$ estimate ১.০ (random walk fit) — but ARMA assumes $|\phi| < 1$।
- Forecast unbounded variance।
Solutions — making stationary:
(ক) Differencing:
- $\Delta Y_t = Y_t - Y_{t-1}$।
- Linear trend remove।
- Random walk → white noise।
(খ) Log + differencing:
- Variance growing — log।
- Then trend → differencing।
- Standard for financial data।
(গ) Seasonal differencing:
- $\Delta_{12} Y_t = Y_t - Y_{t-12}$।
- Yearly seasonality remove (monthly data)।
(ঘ) Detrending (regression):
- Linear/polynomial trend regress।
- Residual model।
- Risky if trend changes dynamically।
ARIMA-এর "I" — Integrated:
- $d$-time differencing — stationary বানায়।
- ARIMA(p, d, q) — d differences, then ARMA।
- Forecast → un-difference → original scale।
Cointegration — special case:
- দু'টি non-stationary series, কিন্তু linear combo stationary।
- "Long-term equilibrium" relationship।
- Engle-Granger, Johansen tests।
- Bangladesh-এর USD-BDT rate vs reserve — cointegrated possible।
Modern alternatives — relaxed assumption:
- State-space models: Kalman filter — time-varying parameter handle।
- Prophet: non-stationarity OK — components separately model।
- Deep learning (LSTM, Transformer): non-stationarity tolerate।
- Bayesian time series: uncertainty propagate।
Practical guidance:
- Always plot first — visual stationarity check।
- ADF + KPSS dual test।
- If borderline — try both differenced ও non-differenced model।
- Out-of-sample validation — final arbiter।
Bangladesh examples:
- Daily Daraz revenue: log + differencing।
- BSEC index: differencing (returns)।
- Monthly inflation: usually stationary as-is।
- Annual GDP: differencing — growth rate stationary।
মূল উপলব্ধি: Stationarity = "predictable patterns persist"। ARIMA assume; modern method (Prophet, DL) relax। বুঝে — সঠিক tool বাছা যায়।
প্র ০২ Bangladesh-এর Eid-এর data কীভাবে model করবেন? Lunar calendar-এর সাথে standard yearly seasonality-র conflict?
এটি Bangladesh, Indonesia, Pakistan, Egypt-এর সব e-commerce ও fintech-এর crucial challenge। Standard solar-calendar-based seasonality এই situations-এ inadequate।
সমস্যা:
- Eid-ul-Fitr lunar — প্রতিবছর ~১১ দিন আগে আসে।
- ২০২৩-এ April, ২০২৪-এ April-early, ২০২৫-এ March-late।
- Standard yearly seasonality (period=365) এই shift ধরে না।
- April-এর gross average misleading।
Solution approaches:
(১) Holiday regressor (Prophet-style)
- Eid dates explicit list করুন।
- Prophet-এ
holidaysargument:
holidays = pd.DataFrame({
'holiday': 'eid_fitr',
'ds': pd.to_datetime(['2023-04-22','2024-04-10','2025-03-30']),
'lower_window': -3, 'upper_window': 3
})
m = Prophet(holidays=holidays)
- $\pm 3$ days window — pre-Eid shopping surge।
- Model holiday-specific effect learn।
(২) Hijri (Islamic) calendar features
- Each row-এ Hijri month, day add feature।
- Ramadan = Hijri month 9, Eid = Hijri month 10 day 1।
- Tree model auto-discover এই pattern।
- Library:
convertdatePython।
(৩) Days-to-Eid feature
- প্রতিটি row-এ "next Eid কত দিন দূরে" feature।
- $-30$ থেকে $+30$ continuous feature।
- Pre-Eid surge এই feature-এ encoded।
(৪) Two-fold seasonality (Prophet support)
- Standard yearly + custom Eid seasonality।
- Eid Fourier basis Hijri-anchored।
Multiple Eid:
- Eid-ul-Fitr (after Ramadan) — biggest e-commerce surge।
- Eid-ul-Adha (qurbani) — different shopping pattern (livestock)।
- দু'টোকে আলাদা holiday feature।
Other Bangladesh holidays:
- Pohela Boishakh (April 14): solar — fixed। Standard yearly seasonality OK।
- Victory Day (Dec 16): solar — fixed।
- Independence Day (March 26): solar — fixed।
- Durga Puja: lunar (Hindu calendar) — separate handle।
Ramadan-specific patterns:
- Daytime e-commerce slow (fasting)।
- Night shopping surge (after iftar)।
- Last 10 days — major Eid-shopping increase।
- "Day-of-Ramadan" feature (1-30) — non-linear pattern।
Local cultural events:
- Cricket matches — internet usage spike।
- Durga Puja — Hindu-majority area surge।
- Boi Mela (Feb) — book industry।
- School admission season (Dec-Jan)।
- Wedding season (Nov-Feb) — gold, sari market।
Seasonality interaction:
- Eid + weekend — multiplied effect।
- Eid + bonus salary day — compound।
- Tree model interaction capture; linear model explicit।
Practical pipeline:
# Hijri date features
import datetime
from hijri_converter import convert
df['hijri_month'] = df['date'].apply(lambda d: convert.Gregorian(d.year, d.month, d.day).to_hijri().month)
# Days to next Eid
eid_dates = pd.to_datetime(['2023-04-22','2024-04-10','2025-03-30','2026-03-20'])
def days_to_eid(d):
diffs = (eid_dates - d).days
return min(d for d in diffs if d > -7)
df['days_to_eid'] = df['date'].apply(days_to_eid)
Validation:
- Out-of-sample include Eid period।
- Walk-forward across multiple Eids।
- Prophet plot: holiday effect visualize।
Industry practice:
- Daraz: holiday calendar in feature store, separate model heads।
- bKash: surge prediction Hijri-aware।
- Pathao: holiday-specific surge multipliers।
- Robi: SMS campaigns adjusted।
Common mistake:
- "Eid is in April" hard-code — fails next year।
- Solar yearly seasonality standalone — Eid effect blurred।
- Single "is_holiday" boolean — all holidays same effect (wrong)।
মূল উপলব্ধি: Bangladesh time series Western-textbook examples-এ direct port না। Lunar calendar-aware feature engineering — local data scientist-এর critical skill। Cultural context = better model।
প্র ০৩ "Random train-test split" time series-এ কেন বিপজ্জনক? Walk-forward validation কীভাবে কাজ করে?
এটি time-series ML-এর সবচেয়ে fundamental concept। প্রতিটি forecasting practitioner-কে জানতে হয়।
Random split-এর সমস্যা:
- Train ও test mixed timestamps।
- Model train data future থেকে peek করে — leakage।
- Production-এ এই info available না।
- Test accuracy inflated।
Concrete example:
- Daily revenue ২০২৩ Jan-Dec।
- Random 80/20 split।
- Train-এ Dec 1, Dec 5, Dec 9...; test-এ Dec 2, Dec 6, Dec 10...।
- Test-এর Dec 6 predict-এ Dec 5, Dec 7 train-এ → trivial।
- RMSE artificially low।
Production reality:
- আজ থেকে আগামীকাল predict — কাল-পরশু-এর data নেই।
- Random split এই reality reflect করে না।
Time-based split (basic):
- Train: 2023 Jan-Aug।
- Test: 2023 Sep-Dec।
- Realistic: train past, test future।
সমস্যা — single split:
- One test period — variance high।
- Sep-Dec lucky? unlucky?
- Need multiple test windows।
Walk-forward validation (a.k.a. expanding window):
- Initial train: data up to time $t_0$।
- Predict $t_0 + h$ (forecast horizon)।
- Compute error।
- Add $t_0$-এর actual data to train।
- Next: train up to $t_0 + 1$, predict $t_0 + h + 1$।
- Repeat through all data।
- Average errors।
Visualization:
Step 1: [-train-]|test|
Step 2: [--train--]|test|
Step 3: [---train---]|test|
Step 4: [----train----]|test|
...
Sliding window (alternative):
- Fixed train length, slide forward।
- Recent history-এ focus।
- Old data discard।
- Drift handling।
Sklearn-এ TimeSeriesSplit:
from sklearn.model_selection import TimeSeriesSplit
tscv = TimeSeriesSplit(n_splits=5)
for train_idx, test_idx in tscv.split(X):
X_train, X_test = X[train_idx], X[test_idx]
# train, predict, evaluate
Considerations:
(১) Forecast horizon
- Single-step (1-day-ahead) — easier।
- Multi-step (30-day-ahead) — harder; cumulative error।
- Walk-forward প্রতিটি horizon-এ separately validate।
(২) Computational cost
- প্রতিটি step-এ retrain — expensive।
- Compromise: every k-th step retrain।
(৩) Hyperparameter tuning
- Nested walk-forward।
- Inner: tune; outer: validate।
- Time-consuming but principled।
(৪) Seasonality preserve
- Train period must include full seasonal cycle।
- 1 year minimum for yearly seasonality।
- 2 years preferred।
Anti-pattern — feature with future:
- "Rolling 30-day mean" — must use only past 30 days at scoring time।
- Not centered (which uses future)।
- Pandas:
.rolling(window=30, min_periods=1).mean()— past-only।
Cross-validation alternatives:
- Blocked CV: contiguous blocks, gap between train/test।
- Purged CV: remove temporal proximity rows (Marcos López de Prado)।
- Combinatorial purged CV: finance-specific।
Bangladesh forecasting examples:
- bKash daily transaction: walk-forward, 1-day horizon।
- Daraz weekly inventory: walk-forward, 7-day।
- Pathao surge: rolling, hour-ahead।
- BSEC index: walk-forward with regime-change handling।
Backtest pitfalls:
- Look-ahead bias: feature uses future।
- Survivorship bias: failed entities excluded।
- Selection bias: cherry-picked period।
- Overfitting: many hyperparameter trials।
Reporting:
- Mean error across walk-forward folds।
- Std deviation — robustness।
- Worst-case error — risk।
- Per-period error (Eid effect-এ separately)।
মূল উপলব্ধি: Time series-এ "test set" temporal future। Walk-forward production-এর simulation। Random split = academic shortcut, real-world deception। Senior practitioner-এর হাতিয়ার।
প্র ০৪ একটি bKash daily transaction count series-এ trend, seasonality, cyclicity, noise — কোনটা কেমন expect করবেন? কীভাবে handle?
Real production scenario। Each component-এ thoughtful approach।
Expected components:
(১) Trend
- Bangladesh mobile-banking penetration growing।
- 2017: 30M users; 2024: 70M+।
- Daily transaction count steady upward।
- Saturation eventual — but not yet।
- Linear or exponential growth।
(২) Yearly seasonality
- Eid-ul-Fitr — massive spike (gift money, salary)।
- Eid-ul-Adha — qurbani transactions।
- Pohela Boishakh — slight bump (new year shopping)।
- Ramadan — different daytime/nighttime pattern।
- December — year-end bonus।
- February — Boi Mela, school admission।
(৩) Monthly seasonality
- 1st of month — salary deposit + cash-out।
- 15th — mid-month bills।
- End of month — utility payments।
- Regular monthly cycle।
(৪) Weekly seasonality
- Sunday-Thursday: working days, business transactions।
- Friday-Saturday: weekend, more personal transactions।
- Bangladesh weekend = Friday-Saturday (different from West)।
- Pattern stable।
(৫) Daily/hourly seasonality
- Morning rush 9-11 AM।
- Lunch dip।
- Evening rush 6-9 PM।
- Late night quiet।
(৬) Cyclicity
- Macro-economic cycles — multi-year।
- 2024 inflation surge → transaction shift।
- Reserve crisis effect।
- Hard to predict, longer trends।
(৭) Noise
- Random daily fluctuation।
- Localized events (cricket match, weather)।
- System outages — momentary dips।
(৮) Special events
- Government policy changes (cash limit)।
- Hartal/lockdown।
- COVID-19 — dramatic shift (cash-out drop, online surge)।
- Anomaly handling।
Modeling approach:
(ক) Decomposition first
- STL decomposition (better than seasonal_decompose)।
- Trend, seasonal (multiple periods), residual।
- Visual inspection।
(খ) Prophet — production sweet spot
from prophet import Prophet
m = Prophet(
yearly_seasonality=True,
weekly_seasonality=True,
daily_seasonality=False, # daily count, not hourly
holidays=bangladesh_holidays, # Eid, etc.
changepoint_prior_scale=0.05 # trend flexibility
)
m.fit(df)
(গ) Multiple seasonality (TBATS)
- Yearly (365.25), weekly (7), monthly (~30)।
- TBATS supports multiple।
- Computationally heavier।
(ঘ) Deep learning (LSTM/Transformer)
- Large training data needed।
- Complex pattern auto-learn।
- Less interpretable।
- Production-এ ensemble component।
(ঙ) ARIMA — baseline
- Daily after differencing + log।
- SARIMA for seasonality।
- Limited multiple-seasonality।
Feature engineering:
- day_of_week, day_of_month, month, year।
- is_holiday, is_eid, is_ramadan।
- days_to_next_eid, days_after_eid।
- weather (rainy, hot)।
- cricket_match flag।
- economic_indicator (USD-BDT, inflation)।
Anomaly handling:
- COVID period exclude from training (or model break)।
- Outlier capping।
- Robust regression।
Validation:
- Walk-forward, weekly retrain।
- Per-component error analysis।
- "Eid forecast accuracy" separately track।
Operationalization:
- Hourly retrain (live transaction data)।
- 1-hour, 1-day, 7-day forecast horizons।
- Capacity planning input।
- Anomaly alerting।
Use cases:
- Server capacity scaling।
- Customer-care staffing।
- Cash management (agent network)।
- Fraud baseline — expected vs actual gap।
- Marketing campaign timing।
Bangladesh context-specific:
- NID linking changes affecting onboarding।
- Bangladesh Bank policy (transaction limit)।
- Cellular network outages (Grameenphone, Robi disruptions)।
- Salary disbursement schedule (govt vs private)।
মূল উপলব্ধি: Real time series multi-component, multi-seasonality, complex। Single model rarely sufficient। Ensemble + domain knowledge + careful validation = production excellence।
অনুশীলন
-
Decomposition: Statsmodels-এ একটি ১ বছরের daily simulated time series-এ trend + yearly seasonal + noise inject করুন। Decompose করে component recover করুন।
import numpy as np, pandas as pd from statsmodels.tsa.seasonal import seasonal_decompose dates = pd.date_range('2023-01-01', periods=730, freq='D') trend = np.linspace(100, 200, 730) seasonal = 30 * np.sin(2*np.pi*np.arange(730)/365) noise = np.random.normal(0, 5, 730) ts = pd.Series(trend + seasonal + noise, index=dates) result = seasonal_decompose(ts, period=365) result.plot() # 4 subplotsDecomposition recovered components — visual সাথে input compare।
-
ADF test: Random walk vs white noise — ADF test result interpret।
from statsmodels.tsa.stattools import adfuller import numpy as np rw = np.cumsum(np.random.normal(0, 1, 500)) wn = np.random.normal(0, 1, 500) print(adfuller(rw)[1], adfuller(wn)[1])RW p-value > 0.05 (non-stationary), WN p-value < 0.05 (stationary)।
-
Seasonality detection: ACF plot বানান একটি সিরিজে — period 30 inject করুন এবং plot-এ peak detect করুন।
from statsmodels.graphics.tsaplots import plot_acf import numpy as np, matplotlib.pyplot as plt ts = np.sin(2*np.pi*np.arange(300)/30) + np.random.normal(0,0.3,300) plot_acf(ts, lags=60) plt.show()Lag 30, 60-এ ACF peak — period confirmed।
আরও পড়ুন · ABCL TECH-এ আপনার পরবর্তী পদক্ষেপ
- পাঠ ২৩ · ARIMA ও Prophet পরবর্তী পাঠ Theory → forecast model।
- পাঠ ২১ · Feature selection আগের পাঠ Selection-এর পর time-aware data।
- পাঠ ১৬ · EDA এই পাঠের সাথে সম্পর্কিত Time series-এর EDA — special considerations।
- সব AI Courses দেখুন ABCL TECH Python, ML, DL, NLP, CV, GenAI, RL, MLOps।