Skip to content
Stand with Ukraine flag

Prediction

Trendz provides built-in tools for time-series prediction, letting you create predictive models with minimal data science background. Data filtering, normalization, and model training are all handled automatically in the background.

You can enable predictions for any data field, including calculated fields. Typical use cases include:

  • Energy forecasting — estimate consumption for the upcoming quarter or year
  • Maintenance scheduling — predict optimal maintenance windows
  • Failure prediction — anticipate the next potential system failure
  • Manufacturing KPIs — forecast key performance indicators and their relation to current system state
  • Resource management — calculate time until a resource (e.g. fuel tank) is depleted

Click the Prediction Models icon in the left sidebar to open the models section. The table lists all existing prediction models with their key details. To create a new forecast, click Create model.

The Input tab configures all settings needed to generate forecasts.

FieldDescription
EntityThe entity type for which the prediction is performed.
Predicted FieldThe specific field to forecast (e.g. energy consumption, temperature).
ItemOne or more specific devices or assets to focus the analysis on. Multiple items can be selected.
KeyThe identifier under which predicted telemetry is saved in ThingsBoard, prefixed with _EPD_. For example, setting the key to energy_forecast stores telemetry under _EPD_energy_forecast. The prefix ensures predicted values never overwrite existing ThingsBoard telemetry.
Timerange for Model TrainingThe historical data period used for training (e.g. last 3 months, last year).
Prediction RangeHow far into the future the model predicts (e.g. 3).
Prediction UnitThe time unit for the prediction range: Hours, Days, Weeks, Month.

Select the algorithm that best fits your data characteristics. Each method includes a short in-UI description.

MethodBest for
Fourier TransformationData with cyclic trends and seasonal patterns — decomposes the series into its frequency components.
ProphetTime series with strong seasonality and holiday effects; uses an additive model of trend + seasonality + holidays.
Multivariable ProphetMultiple interconnected time series that should be predicted simultaneously.
ARIMASeries with trends and seasonal variation; combines autoregressive and moving-average components.
Linear RegressionPredicting a dependent variable from one or more independent variables via a linear relationship.
Custom ModelArbitrary multivariable predictions using any Python library; you supply the model source and Trendz handles data injection and output processing. On self-hosted installations you can install additional Python packages to extend the available libraries. See Custom Python models.

Before training, Trendz divides input telemetry into segments — equal-length time ranges that cover the full training period. Segments are used iteratively for model fitting, prediction building, and accuracy calculation.

FIXED — sequential, no gaps, no overlaps
──────────────────────────────────────────▶ time
╔════════╗╔════════╗╔════════╗╔════════╗
║ seg 1 ║║ seg 2 ║║ seg 3 ║║ seg 4 ║
╚════════╝╚════════╝╚════════╝╚════════╝
SLIDING_WINDOW_UNIT — overlapping, step < segment size
──────────────────────────────────────────▶ time
╔════════╗
║ seg 1 ║
╚════════╝
╔════════╗
║ seg 2 ║
╚════════╝
╔════════╗
║ seg 3 ║
╚════════╝
STICK_TO_END — only the last N segments are used
──────────────────────────────────────────▶ time
░░░░░░░░░░░░░░░╔════════╗╔════════╗╔════════╗
(excluded) ║ seg 1 ║║ seg 2 ║║ seg 3 ║
╚════════╝╚════════╝╚════════╝
StrategyDescription
AUTOTrendz automatically analyzes the data and determines the optimal segmentation. Use this if you are unsure which strategy suits your task.
FIXEDDivides data sequentially from start to end with no gaps or overlaps. A 120-day range with 10-day segments produces 12 segments.
SLIDING_WINDOW_UNITLike FIXED, but segments overlap. The step size is defined in time units. A 120-day range with 10-day segments and a 5-day step produces 23 segments, each overlapping its neighbors.
SLIDING_WINDOW_PERCENTLike SLIDING_WINDOW_UNIT, but the step is a percentage of the segment size. A 20% step on a 10-day segment equals a 2-day step.
STICK_TO_ENDLike FIXED, but only uses the last N segments from the end of the training range. Useful for focusing training on the most recent data.

Include Last Unfinished Segment — when enabled, Trendz includes any partial segment at the end of the training range that does not fill a full segment length. Disable this if partial segments would cause overfitting.

These settings preprocess data before it is fed into the prediction model:

SettingDescription
AggregationHow input data is summarized: AVG, SUM, LATEST, MIN, MAX, COUNT, UNIQ, and others.
Grouping IntervalThe time bucket for aggregation: hour, day, week, month.

Enable Set Limits to constrain predicted values to a defined range. Enter the minimum and maximum values to serve as prediction boundaries.

Example: For a water temperature model, setting MIN to 0 and MAX to 100 ensures all predicted values stay within 0°C–100°C.

After training, the Accuracy tab lets you validate how well the model performs. You must configure the evaluation parameters before calculating accuracy.

  1. Select the device(s) to evaluate.
  2. Choose how thresholds are determined:
    • AUTO — Trendz analyzes your prediction data and fills the required fields automatically.
    • MANUAL — You provide the threshold values for each metric.
  3. Click Get Accuracy.

Provides an overall percentage score describing how closely the predicted values align with actual telemetry.

Displays predicted data for a selected segment alongside the corresponding original historical telemetry.

Parameters:

  • Device Name — the device to inspect
  • Segment Number — the segment whose data to display

Shows prediction accuracy as a binary metric per time unit. A time unit is marked true if both the value difference and the time offset between expected and actual values are within the configured thresholds; otherwise false. Results are aggregated across all segments.

Parameters:

  • Acceptable Value Error — maximum allowable difference between predicted and actual values
  • Acceptable Time Error — maximum allowable time offset between predicted and actual values

Example: You predict remaining fuel level over 14 days. Setting Acceptable Value Error to 20 (L) and Acceptable Time Error to 2 (hours) means a predicted value of 80 L is marked correct if the actual reading is within ±20 L of 80 at the predicted time, or equals 80 within a 2-hour window.

Shows accuracy as a continuous percentage difference (error function) between predicted and actual values, measured per time unit within each segment. The min, max, and average (displayed on the chart) are aggregated across all segments for the selected percentile of best values.

Parameters:

  • MIN — minimum possible telemetry value (defines the full value range)
  • MAX — maximum possible telemetry value (defines the full value range)
  • PERCENTILE — the percentile of best values to include when aggregating results

Example: An energy meter reports consumption between 0 and 50 kWh. Setting MIN to 0 and MAX to 50 means the full error range is 50 kWh. If the predicted value is 25 kWh and the actual reading is 30 kWh, the error is 5/50 = 10%, so accuracy is 90%.

The Tasks tab lists all jobs initiated for this model, including their current status (completed, in progress, pending). For full task management details, see the Tasks Service documentation.

Example: Forecasting energy consumption for a building

Section titled “Example: Forecasting energy consumption for a building”

This example creates a 3-month energy consumption forecast. The dataset includes Buildings, Apartments, and energy meters installed in each Apartment. Telemetry is aggregated from sensors at the building level.

Input tab:

SettingValue
EntityEnergy meter
Predicted FieldenergyConsumption
ItemEnergy Meter H101
KeyEnergy_Meter_H101
Timerange for Model TrainingLast Year
Prediction Range3
Prediction UnitMonth

Prediction Method:

SettingValue
Prediction MethodFOURIER_TRANSFORMATION
Segment StrategyAUTO

Aggregation:

SettingValue
AggregationAVG
Grouping IntervalDAY

Name the model energyConsumption prediction, then click Train Model in the upper-right corner. Once training completes, open the Accuracy tab to evaluate the model’s performance. If training fails, Trendz raises an error — check the model configuration and ensure the training time range contains sufficient data.

If the accuracy is satisfactory, enable the prediction job to write results back to ThingsBoard:

  1. Click JOBS in the upper-right corner to open the Prediction Model Parameters modal.
  2. Enable Enable prediction model refreshing.
  3. Set the refresh interval, for example: EVERY 1 DAY.
  4. Select the items to run predictions for (e.g. Energy Meter H101).
  5. Enable Enable Model Retraining so the model retrains automatically when new data arrives.
  6. Click Save.
  1. Go to View Fields and select a Line Chart view.
  2. Add Date (RAW) as the X-axis.
  3. Add energyConsumption telemetry as the Y-axis.
  4. Add energyConsumption prediction telemetry as a second Y-axis series.
  5. Add the energy meter field to the Filter section and select Energy Meter H101.
  6. Set the date range to cover both historical and predicted data (e.g. 07/01/2024–07/04/2025).
  7. Click Build report.