liveBook · Manning

Input

As explained in Digital Twins in Action

A feature is an input variable or measurable property used to characterize an instance in analytical or machine learning processing.

A feature is an input variable that characterizes an observation for analysis or a model. It can be a raw measurement, but an engineered feature often captures context the measurement alone misses: a temperature reading of 185°C might become a deviation from the optimal temperature, a rate of change, or time spent above a safe range. section 4.1.5

For historical sensor data, feature preparation can mean combining sources, aligning and resampling their readings, then producing clean, normalized values. A pipeline can store the result in Parquet for model training. A feature store serves a different storage need: it organizes curated, precomputed features for training and serving, while a transactional store supports fast application queries. section 8.1

Forecast indoor temperature

To predict the next hour’s indoor temperature, use previous indoor temperatures, outdoor temperature, normalized solar radiation, and cyclically encoded hour as features. The previous readings give the model evidence of thermal inertia; weather helps account for heating from outside. Keep the temperature being predicted as the target, not an input. A date-based train/test split and mean absolute error check the one-step-ahead predictions. section 8.3.1

Listing 8.6 Indoor temperature prediction with gradient boosting
import pandas as pd
from sklearn.ensemble import HistGradientBoostingRegressor
from sklearn.metrics import mean_absolute_error

df = pd.read_parquet("../datapipeline/2025_export.parquet")

target_col = "temp_indoor"
df = df.dropna(subset=[target_col])

feature_cols = ["t_lag_1h", "t_lag_2h", "t_lag_3h",
    "temp_outdoor", "solar_norm", "hour_sin", "hour_cos"
]

split_date = "2025-11-01" #1
train = df.loc[df.index < split_date].copy()
test = df.loc[df.index >= split_date].copy()

X_train, y_train = train[feature_cols], train[target_col]
X_test, y_test = test[feature_cols], test[target_col]

model = HistGradientBoostingRegressor(random_state=42) #2
model.fit(X_train, y_train) #3

test["prediction"] = model.predict(X_test)
mae = mean_absolute_error(test[target_col], test["prediction"])

print(f"Mean Absolute Error: {mae:.4f}")

The listing names the feature columns explicitly, separates them from the target, trains a gradient-boosting regressor, and scores its predictions. section 8.3.1

Inputs also matter in simulation. A digital twin updates its independent variables from live operating data, then compares predicted outcomes with observed outputs to improve calibration. Whether training a forecast or updating a simulation, the input values need to reflect the conditions being modeled. section 9.1.1

How Digital Twins in Action covers it

How deep it goes
Works through feature preparation and a training example, but does not implement a feature store.
Examples
Uses temperature deviations and rates of change, then lagged temperatures, weather, and encoded time in an indoor-temperature forecast.
What it assumes
Assumes historical measurements and Python data handling for the forecast, while defining engineered features from a single temperature reading.
What you can do after
Apply features via scikit-learn to train and evaluate a one-hour-ahead temperature forecast.
How it connects
Connects feature engineering to time-series data, feature stores, gradient boosting, and digital twins.

Also explained in

Compare how 14 books explain input →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Digital Twins in Action. The section links point to the parts of the book it draws on.