Skip to content

For the complete documentation index and AI-optimized content, see /llms.txt. All pages support markdown format via .md extension or Accept: text/markdown header.

Model Exploration

For the complete documentation index and AI-optimized content, see /llms.txt. All pages support markdown format via .md extension or Accept: text/markdown header.

Kedify Predictor can create a temporary JupyterLab workspace for one MetricPredictor. The workspace reads that resource’s stored metric history, so you can visualize several forecasting techniques against the same data, compare their errors, and experiment with Prophet parameters before changing the production model.

The supplied notebooks are exploratory: they do not ingest measurements, update the MetricPredictor, or publish a model. Prophet remains the model used by the MetricPredictor custom resource.

Before starting, make sure that:

  • Kedify Predictor is installed with a chart version that includes notebook support.
  • Predictor uses PostgreSQL. Notebook deployment is not supported with the default SQLite metric store. Follow the external PostgreSQL setup if needed.
  • A MetricPredictor already exists and has stored metric data. Several notebooks require at least 1,800 finite measurements by default. The predictive scaling example shows how to bootstrap a model with historical CSV data.
  • You can annotate the MetricPredictor, inspect resources in the keda namespace, and port-forward a Service.

The commands below use a MetricPredictor named e-shop in the app namespace. Replace both values with your resource’s name and namespace.

Confirm that the resource exists and is collecting data:

Terminal window
kubectl get metricpredictor e-shop -n app -o wide

The notebook is scoped automatically to this resource’s model name. You do not need to configure a database query or model identifier in JupyterLab.

Add the kedify.io/notebook=true annotation:

Terminal window
kubectl annotate metricpredictor e-shop -n app \
kedify.io/notebook=true --overwrite

The Predictor controller creates a one-replica Deployment and a ClusterIP Service in the keda namespace. For names of at most 63 characters, both resources are named <metricpredictor-name>-<metricpredictor-namespace>, which is e-shop-app in this example.

List all notebook resources and wait for this Deployment to become available:

Terminal window
kubectl get deployment,service -n keda \
-l app.kubernetes.io/name=kedify-prophet-notebook
kubectl rollout status deployment/e-shop-app -n keda --timeout=2m

If the combined name exceeds Kubernetes’ 63-character limit, the controller truncates it and adds a hash suffix. Use the label-based listing above to find the generated name.

The Service is not exposed outside the cluster. Forward its default port to localhost:

Terminal window
kubectl port-forward -n keda --address 127.0.0.1 \
service/e-shop-app 8888:8888

Leave this command running and open http://localhost:8888 in a browser. Start with 00-index.ipynb, then open a technique-specific notebook. Run its cells from top to bottom to load the selected model’s measurements, create a chronological training/test split, fit the technique, and visualize its held-out and future forecasts.

The workspace uses an emptyDir volume. Download any notebooks or results you want to keep before undeploying it.

4. Compare the included forecasting techniques

Section titled “4. Compare the included forecasting techniques”

The notebook image ships with the following examples:

NotebookTechniqueWhat it demonstrates
01-simple-exponential-smoothing.ipynbSimple Exponential Smoothing (SES)Estimates a changing level using alpha. It is small and stable, but multi-step forecasts are flat because it does not model trend or seasonality.
02-double-exponential-smoothing.ipynbHolt’s double exponential smoothingAdds a local linear trend to the level using alpha and beta. It suits non-seasonal trends but extrapolates a straight line.
03-triple-exponential-smoothing.ipynbHolt-Winters triple exponential smoothingAdds a repeating seasonal component using alpha, beta, gamma, and a known seasonal period. It works best when the cycle and trend remain stable.
04-linear-regression.ipynbLinear regressionFits one global time-based slope. It is fast and easy to interpret, but does not capture cycles or changing trends without additional features.
05-moving-averages.ipynbRecursive moving averageEvaluates short, fixed-window forecasts at rolling historical origins. It is a useful near-term baseline, but long recursive forecasts converge toward a constant.
06-arma-arima.ipynbAR, MA, and ARIMACompares lagged values, lagged forecast errors, and differencing on the same holdout. These models can work well for stable short-term linear dependence, but require choosing p, d, and q and do not add seasonality unless extended.
07-dynamic-harmonic-regression.ipynbDynamic harmonic regression with ARIMA errorsUses Fourier terms for daily and weekly cycles and ARIMA for residual dependence. It handles multiple long seasonalities efficiently, but requires fixed periods, Fourier orders, and ARIMA orders.
08-fft.ipynbFast Fourier Transform (FFT) spectral forecastingFinds dominant frequencies, filters noise, aligns phase, and optionally extrapolates a trend. It is very fast for stable periodic signals, but does not model changepoints, holidays, or calibrated uncertainty.
09-prophet.ipynbProphetReuses the production model-building and evaluation logic to combine a flexible trend, changepoints, multiple seasonalities, country holidays, custom seasonality, and uncertainty intervals.

Linear regression reduces the history to one global trend. In this strongly seasonal example, its flat holdout and future forecasts make the model’s limitation immediately visible:

Linear regression notebook showing holdout and future forecasts

Triple exponential smoothing adds level, trend, and a repeating seasonal pattern. The Holt-Winters forecast follows the observed cycles, although its smoothing parameters and seasonal period still need careful tuning:

Triple exponential smoothing notebook showing Holt-Winters holdout and future forecasts

FFT forecasting decomposes the history into periodic components and extrapolates selected frequencies. Here, phase alignment carries the recurring pattern across the forecast boundary:

Fast Fourier Transform notebook showing a phase-aligned spectral forecast

Prophet combines the forecast and uncertainty interval with explainable trend and seasonal components. The component plots help reveal what the model learned from the history:

Prophet notebook showing held-out predictions, uncertainty, trend, weekly seasonality, and daily seasonality

Use the holdout metrics and forecast shape together when comparing techniques. A visually smooth in-sample fit is not evidence that a method predicts unseen data well.

Open 09-prophet.ipynb. It initializes the experiment from the current MetricPredictor model settings and exposes editable values for:

  • training/test split, look-back period, aggregation frequency, forecast frequency, and forecast periods;
  • daily, weekly, and yearly seasonality;
  • additive or multiplicative seasonality mode;
  • changepoint prior scale;
  • country holidays and holiday prior scale;
  • custom seasonality name, period, and Fourier order; and
  • the built-in six-hour seasonality and its Fourier order.

Change one group of parameters at a time, rerun the notebook, and compare the held-out MAPE, prediction graph, uncertainty interval, changepoints, and component plots. Aggregating dense measurements can keep interactive fitting within the notebook pod’s memory limit while retaining the broader history and seasonal structure.

Changes made in the notebook are isolated from the production model. When you find a better configuration, apply the corresponding values to .spec.model on the MetricPredictor and let Predictor retrain the model.

Notebook settings can be changed through Predictor Helm values. The defaults request 250m CPU and 512Mi memory and set a 2Gi memory limit:

notebook:
port: 8888
resources:
requests:
cpu: 250m
memory: 512Mi
limits:
memory: 2Gi

Increase the memory limit if your experiments need a denser or longer training set. If you change notebook.port, use the same port on the right-hand side of the kubectl port-forward mapping.

  • If no Deployment appears, run kubectl describe metricpredictor e-shop -n app and inspect its events. A MetricPredictorNotebookRequiresPostgres warning means Predictor is still configured for SQLite.
  • If the pod reports missing model metadata or too few measurements, wait for the source to populate the Predictor database or bootstrap it with historical data.
  • If the pod cannot start, inspect it with kubectl describe deployment/e-shop-app -n keda and kubectl get pods -n keda. The notebook image tag normally defaults to the Predictor chart application version with a -notebook suffix.

Stop the port-forward with Ctrl+C. After saving anything you need from the ephemeral workspace, remove the annotation:

Terminal window
kubectl annotate metricpredictor e-shop -n app kedify.io/notebook-

The Predictor controller then deletes the notebook Deployment and Service. Confirm that both are gone:

Terminal window
kubectl wait --for=delete deployment/e-shop-app -n keda --timeout=2m
kubectl wait --for=delete service/e-shop-app -n keda --timeout=2m