Lecture 3: Deep Learning for Structured and Engineering Data

From prediction to representations and modern modeling paradigms

Special Topics in Artificial Intelligence (STAI 2026)

Three Questions for This Lecture

Today we ask three questions about neural networks:

  • What can they predict? For example, concrete strength from its ingredients.
  • What can they learn from measurements? For example, useful features for detecting machine faults.
  • How can several sites learn together? For example, factories training a shared model while keeping their data locally.

Engineering measurements enter a trained network, which provides a prediction or a learned representation. Measurements can be used for prediction or to learn useful features.

FIG. From Measurements to Predictions and Features

Today’s Roadmap

Week 2 covered model evaluation. Today we focus on:

  1. Neural-network foundations: how networks make predictions, learn, and are expressed in PyTorch.
  2. Engineering applications: how the available data affect our modeling choices.

Roadmap for lecture 3: engineering data, neural networks, learning, and PyTorch before the break, then modern modeling paradigms for engineering AI after the break.

FIG. Lecture Topics Before and After the Break

Engineering Data: Inputs and Targets

Tabular data are organized into rows and columns.

  • Each row is one example, such as a concrete mix tested in a laboratory.
  • The inputs describe that mix and its curing conditions.
  • The target is measured strength. Use only inputs available for a new mix.

TABLE. Concrete Inputs and Targets

An illustrative concrete dataset separates five input columns from the measured strength target. A prediction model uses the inputs to estimate strength.

FIG. Predicting Strength

Typical Engineering AI Problems

Four mini flow diagrams: material composition to strength, machine sensors to failure, manufacturing parameters to quality, and operating conditions to energy.

FIG. Engineering Inputs and Prediction Targets

In each example, a model uses measured inputs to estimate an outcome.

Start with a simple comparison model. On small tabular datasets, a random forest or gradient-boosted model may work as well as, or better than, a neural network.

Neural networks are useful when learning features from complex measurements or reusing learning across tasks.

Neural Networks

From Linear Model to Artificial Neuron

A neuron is a network’s basic building block: it combines inputs, then applies an activation. Training learns how to combine the inputs.

z = w_1x_1 + w_2x_2 + \dots + w_nx_n + b,\qquad a=f(z)

  • x_i: input i; w_i: its learned weight; b: a learned bias.
  • z: the weighted sum; f: activation function; a: neuron output.

Inputs are weighted, added with a bias, and transformed by an activation to produce the neuron output.

FIG. Weighted Inputs, Bias, Activation, and Neuron Output

What Do Hidden Layers Learn?

A hidden layer sits between the inputs and the final prediction.

Its units learn combinations of measurements that help the prediction task. For example, a useful combination might involve temperature, pressure, and flow.

Temperature, pressure and flow rate feeding hidden neurons that form learned combinations, which then produce a quality score.

FIG. Inputs, Learned Hidden Features, and Prediction

These features form a representation. They help the final layer predict from patterns across measurements. They need not correspond to named physical quantities.

From a Neuron to a Network

A multilayer perceptron (MLP) is a network of fully connected layers: each unit receives the outputs of the previous layer.

A multilayer perceptron with eight inputs, a hidden layer of 64 units, a hidden layer of 32 units, and one strength output.

FIG. An Eight-Input Multilayer Perceptron

One layer computes h=f(Wx+b): W contains its weights, b its biases, and h its outputs.

Layers turn measurements into learned features, then a prediction. For example: 8 inputs → 64 units → 32 units → 1 strength prediction.

Why Activation Functions?

Nonlinear activations let a network learn curved and more complex relationships.

Without them, several linear layers are equivalent to one linear layer:

Three stacked linear layers collapsing into a single equivalent linear box, contrasted with a nonlinear stack that does not collapse.

FIG. Why Stacked Linear Layers Need Nonlinear Activations

Common choices: ReLU for hidden layers; sigmoid for a binary probability; softmax for probabilities across classes. A numerical output often uses no final activation.

A Network Maps Inputs to Predictions

We can write a network’s prediction as \hat{y}=f_\theta(x).

  • x: the measured inputs.
  • \theta: all the weights and biases that training can change.
  • \hat{y}: the predicted output.

A black box labeled f theta of x, then opened to reveal that theta consists of the weights and biases of every layer.

FIG. The Network Function and Its Learned Parameters

Training adjusts parameters to reduce prediction errors.

Part II. How Does the Network Learn?

Make a prediction, measure its error, and update the parameters.

The Forward Pass and the Loss

The forward pass computes a prediction. The loss gives training an objective: reduce prediction error.

For N examples, mean squared error compares targets y_i with predictions \hat y_i:

L=\frac{1}{N}\sum_i(y_i-\hat{y}_i)^2

Forward pass showing target 70 megapascals, prediction 52, an error of 18, and a large loss value in red.

FIG. Comparing Predicted and Measured Strength

Example: 70 MPa measured, 52 MPa predicted. Error magnitude: 18 MPa.

Gradients and Gradient Descent

A gradient describes how the loss changes when each parameter changes slightly.

A loss versus parameter curve with a tangent line marking the slope at one point.

FIG. How Loss Changes with a Model Parameter

Use the gradient to choose an update that aims to lower the loss:

\theta \leftarrow \theta-\eta\nabla_\theta L

\nabla_\theta L is the gradient of the loss. The learning rate \eta controls the update size.

Backpropagation

Forward arrows from input through layers to prediction and loss, with red backward gradient arrows underneath.

FIG. Forward Predictions and Backward Gradients

Backpropagation computes the gradients needed for training. It works backward from the loss through the network’s calculations.

The optimizer then uses those gradients to update the parameters.

The Complete Training Loop

A circular five step training loop: forward pass, compute loss, backward pass, update parameters, repeat.

FIG. Prediction, Loss, Gradients, and Parameter Updates
  1. Make predictions and calculate the loss.
  2. Compute gradients and update the parameters.
  3. Repeat with more training examples.

Each update aims to improve the model’s predictions.

Batches, Learning Rate, and Optimizer

A batch is a group of examples used for one update. An epoch is one pass through the training set.

With 1,000 examples and batches of 100, one epoch has 10 updates.

Three training loss curves: a too small learning rate converging slowly, a reasonable rate converging, and a too large rate oscillating and diverging.

FIG. How Learning Rate Affects Training Loss

The optimizer (for example, SGD or Adam) determines the update. The learning rate sets its size: too small can be slow; too large can be unstable.

Training, Validation, and Test

Diagram of three dataset roles: training data learns parameters, validation data selects models and hyperparameters, test data gives a final untouched evaluation.

FIG. Roles of Training, Validation, and Test Data
  • Training data: used to adjust the model’s parameters.
  • Validation data: used to choose settings and decide when to stop.
  • Test data: kept separate for the final assessment.

Do not use test results to tune the model.

Overfitting in Neural Networks

Training loss falling steadily while validation loss falls and then rises, with the early stopping point marked.

FIG. Training and Validation Loss During Overfitting

Overfitting occurs when a model fits the training examples but performs poorly on new examples.

If training loss falls while validation loss rises, consider more representative data, a simpler model, or regularization. Early stopping keeps a model from an earlier, better validation result.

PyTorch

Connecting the training concepts to code.

What Is PyTorch?

PyTorch is a Python library for building and training neural networks.

Official PyTorch logo.

FIG. PyTorch Framework Logo
  • Tensors store numerical data.
  • Modules define network layers.
  • Autograd computes gradients.

Tensors, neural network modules, and automatic differentiation are the framework's three building blocks.

FIG. Tensors, Modules, and Automatic Differentiation

PyTorch provides the data, model, and gradient tools needed to implement the training loop.

Tensors

A tensor is an array of numbers. This separate example stores two samples with three features each.

import torch

x = torch.tensor([[0.5, 1.2, 3.1],
                  [0.7, 0.9, 2.8]])

print(x.shape)   # torch.Size([2, 3])
TABLE. NumPy Arrays and PyTorch Tensors
Capability NumPy array PyTorch tensor
Store numerical data Yes Yes
Run on a supported GPU No Yes
Track operations for gradients No Yes, when enabled

Here, rows are samples and columns are features. The feature count must match the model input.

A Neural Network in PyTorch

This example takes eight measurements and predicts one numerical value.

from torch import nn

model = nn.Sequential(
    nn.Linear(8, 64), nn.ReLU(),
    nn.Linear(64, 32), nn.ReLU(),
    nn.Linear(32, 1),
)

Linear combines inputs using weights and biases. ReLU adds a nonlinear response.

Lines of nn.Sequential code linked by arrows to the corresponding layers of an 8 to 64 to 32 to 1 architecture.

FIG. PyTorch Code and Its Network Layers

The PyTorch Training Loop

For the eight-input model, x holds a batch of inputs and y its targets. With a loss function (criterion) and optimizer prepared:

optimizer.zero_grad()               # clear old gradients
prediction = model(x)               # forward pass
loss = criterion(prediction, y)     # measure the error
loss.backward()                     # compute gradients
optimizer.step()                    # update parameters

backward() computes gradients. step() changes the parameters.

Five training loop code lines each mapped to its concept: clear gradients, forward pass, loss, gradients, and parameter update.

FIG. Training Code and the Operation Performed by Each Line

Autograd and CPU/GPU Computation

Autograd records calculations and computes gradients during the backward pass. It handles the differentiation needed to train the network.

Computational graph from input through Linear, ReLU, Linear to prediction and loss, with backward arrows labeled autograd.

FIG. A Computation Graph Used for Automatic Differentiation

Training can run on a CPU or a supported GPU. The model and its input tensors must be on the same device.

device = "cuda" if torch.cuda.is_available() else "cpu"
model.to(device)

BREAK

Input arrow into a neural network block, with a large question mark instead of an output.

FIG. From a Network to Questions About Its Use

After the break: how should we change our modeling approach when labels are scarce or data are spread across sites?

Part IV. Modern Modeling Paradigms for Engineering AI

Choosing an approach that fits the engineering problem.

IV) Beyond One Dataset and One Model

So far, we have used one dataset to train one predictor. Other situations raise new questions:

The starting example of dataset to neural network to prediction, expanded into multiple assets, unlabeled data, distributed data, and different regimes, motivating different modeling choices.

FIG. Learning Situations Beyond One Dataset and One Model

Choose the approach from the problem: available labels, related machines, and data-sharing limits. The next sections address these different needs.

IV) A Map of Modeling Approaches

Five concepts answer different questions about features, shared learning, pretraining, training location, and expert routing.

FIG. Different Questions About an AI System

These are different dimensions of a system. They can overlap and be combined.

IV.A) Representation Learning

A label is a known target, such as a confirmed machine fault. Factories may collect years of sensor readings but record only a few confirmed faults.

A very large block of unlabeled sensor measurements beside a very small block of labeled failure events.

FIG. Many Sensor Recordings but Few Confirmed Failures

Representation learning learns useful features from data. Here, the aim is to learn from many unlabeled readings, then use the few fault labels to train a detector.

IV.A) From Measurements to Useful Features

Representation learning learns features that help describe the input 1.

Raw measurements are mapped to learned features z, which can support classification, regression, clustering, anomaly detection, or forecasting.

FIG. From Measurements to Features and Downstream Tasks

A downstream task uses those features for a later purpose, such as fault detection.

Autoencoders are one method. Representation learning can also use supervised or self-supervised training.

IV.A) Representation and Autoencoders

An autoencoder learns to reconstruct its input: \hat{x}\approx x.

An encoder maps input x to code z, then a decoder reconstructs the input as x hat. Training compares the reconstruction with the input.

FIG. Encoder, Latent Code, and Reconstruction

The encoder maps x to learned features z, the latent code. The decoder reconstructs \hat{x} from z.

A compact code encourages the model to preserve structure needed for reconstruction. Training minimizes \lVert x-\hat{x}\rVert^2: the sum of squared reconstruction differences. Check whether z helps the intended task.

IV.A) Three Autoencoder Variants

Comparison of three autoencoders: standard x to z to x hat, denoising corrupted x to z to clean x hat, and variational x to a mean and spread to a sampled z to x hat.

FIG. Standard, Denoising, and Variational Autoencoders
  • Standard autoencoder: reconstruct the input.
  • Denoising autoencoder: reconstruct a clean input from a corrupted version.
  • Variational autoencoder (VAE): learn a probabilistic latent representation that supports generation.

Choose the training task to match the aim: reconstruct inputs, remove noise, or learn to generate samples.

IV.A) Self-Supervised Learning

Supervised learning: use known task labels. Self-supervised learning: construct targets from the data themselves.

  • Hide a sensor reading and predict it from the others.
  • Use earlier time-series observations to predict a later region.

Unlabeled recordings support self-supervised pretraining, producing learned features that are adapted with fault labels for fault detection.

FIG. Self-Supervised Pretraining Followed by Fault Detection

Self-supervision is broader than autoencoders. The training task should preserve information useful for the downstream task.

IV.B) Local and Global Models

Suppose a company operates many similar pumps. Should each pump have its own prediction model?

Four machines A, B, C and D, each with its own separate dataset and its own separate local model.

FIG. Separate Models for Individual Machines

A local model is trained for one asset. It can capture that pump’s behavior, but may have little data. If each pump has little history, consider learning across related pumps.

IV.B) Global Modeling

A global model learns from several related assets and makes predictions for them 3.

Datasets from machines A, B, C and D funnelling into a single global model, which then produces predictions for each of A, B, C and D.

FIG. One Model Learns Across Several Machines

Shared data may help when each asset has little history. However, machines can differ in age, load, and environment.

Compare performance for each asset, as well as overall.

IV.B) Global and Foundation Models

A global model shares learning across related assets. A foundation model is trained broadly so it can be adapted to many tasks 4.

Local and global models shown side by side to compare their scope. A separate flow shows broad pretraining, a foundation model, and adaptation to downstream tasks.

FIG. Global Modeling and Foundation-Model Pretraining

Pretraining is the initial learning stage. Adaptation, such as fine-tuning, prepares the model for a particular task.

Global modeling shares learning across assets; foundation models support reuse across tasks.

IV.B) Global vs Foundation: What Is Shared?

TABLE. Global Models and Foundation Models
Question Global model Foundation model
Main purpose Share learning across related assets Reuse broad pretraining across tasks
Example data Histories from many pumps Broad, diverse sensor recordings
Example use One fault-prediction task across pumps Adapt to forecasting or fault diagnosis
Further training May be trained for the shared task Fine-tuning updates pretrained parameters

More data alone do not turn a global model into a foundation model.

Pretraining builds reusable knowledge; adaptation applies it to a target task. Fine-tuning is one form of adaptation.

IV.B) Foundation Models for Engineering

A model pretrained on broad engineering data could be adapted to tasks such as fault detection or forecasting.

Heterogeneous industrial data, sensor signals, maintenance logs, images, process variables, time series and simulation data, feeding an industrial foundation model that supports forecasting, fault diagnosis, quality prediction, remaining useful life, anomaly detection and decision support.

FIG. Foundation Models for Engineering Tasks

Before using it, check whether its training data resemble your application: sensors, units, equipment, and operating conditions may differ.

Compare the adapted model with established methods on your own task.

IV.C) Federated Learning

Several factories have useful data but cannot pool their raw records. Can they learn together?

Federated learning trains a shared model across sites without collecting their raw training data in one place.

Three factories in Korea, Germany and Indonesia, each with a locked local dataset, operating similar equipment.

FIG. Factories Hold Their Training Data Locally

Each participating factory is a client. It trains locally and shares model updates.

IV.C) One Federated Training Round

Server sends a model, clients train locally, updates return, the server aggregates them, and the round repeats.

FIG. One Round of Federated Learning
  1. Send the shared model; each client trains on local data.
  2. Combine what clients learned: the server merges their updates into the next shared model.
  3. Repeat with the next participating clients.

IV.C) FedAvg: A Weighted Average

FedAvg weights client parameters by local example counts 5.

TABLE. Client Example Counts and FedAvg Weights
Client Training examples Share of total
A 1,000 50%
B 500 25%
C 500 25%
Total 2,000 100%

w_{\mathrm{global}}=0.50w_A+0.25w_B+0.25w_C=\sum_k\frac{n_k}{N}w_k

w_k: client k’s parameters after local training; n_k: its example count; N: total examples across participating clients.

A contributes half because it has half the examples. Average corresponding parameters.

IV.C) Centralized vs. Federated Learning

Left, centralized learning where factory data A, B and C move to a central server for training. Right, federated learning where each factory trains locally and only updates are aggregated.

FIG. Centralized Data and Federated Model Updates
  • Centralized training: data move to the training system.
  • Federated training: local model updates move between sites and the server.

Keeping raw data local does not guarantee privacy. Updates can reveal information, so extra protection may be needed.

IV.C) Federated Learning: Different Data

Factories train one shared model, but healthy operating temperatures differ.

Hypothetical healthy temperature distributions at three factories: A around 50 degrees Celsius, B around 70, and C around 90. All three can be healthy. A detector that ignores site conditions may raise false alarms.

FIG. Different Normal Temperatures Across Factories

The risk: a detector could mistake Factory C’s healthy 90°C readings for a fault.

IID means independent and identically distributed. These factories have different distributions, so their data are non-IID.

So, good overall accuracy is not enough. Check the shared model at every factory before using it.

IV.D) Mixture of Experts: Specialization

A ship uses fuel differently when maneuvering, cruising, or operating in heavy weather. These are different operating regimes.

A ship fuel predictor with three candidate experts A, B, and C and illustrative gate weights. Any relationship between learned experts and operating regimes must be verified.

FIG. Different Operating Regimes Motivate Expert Models

If one predictor consistently struggles in some regimes, consider several specialized predictors. First compare with a model that includes the operating conditions as inputs.

IV.D) Mixture of Experts

A mixture of experts combines several submodels. A gating network learns to assign their contributions from the input. The gate and experts train together 6.

An input x entering a gating network that produces weights over three expert networks, whose outputs are combined into a single weighted prediction.

FIG. Input-Dependent Contributions from Expert Models

f_i(x) is expert i’s prediction. g_i(x) is the weight given to that expert for input x.

The model can rely on different experts for different operating conditions.

IV.D) A Gate Chooses the Expert Contributions

Example input: 18 knots, 0.5 m waves, 75% engine load. The gate selects these illustrative weights:

TABLE. Gate Weights and Expert Fuel Predictions
Expert Gate weight Predicted fuel use
1 0.80 20 tonnes/day
2 0.05 30 tonnes/day
3 0.15 24 tonnes/day

\hat y=0.80(20)+0.05(30)+0.15(24)=21.1\text{ tonnes/day}

In general, \hat y=\sum_i g_i(x)f_i(x): f_i(x) is expert i’s prediction; g_i(x) is the gate’s weight for input x.

Expert 1 has the most influence here (80%). The weights are nonnegative, sum to one, and can change with the input.

IV.D) Experts and Conventional Ensembles

Both approaches combine predictions from several models. Their main difference is how the contributions are chosen.

TABLE. Conventional Ensembles and Mixtures of Experts
Averaging/voting ensemble Mixture of experts
Combine predictions Average or vote Use a learned gate
Depend on the input? Usually the same combination rule Gate weights depend on the input
Which models run? Usually all members All, or a selected subset

A sparse mixture uses only a few experts for each input, reducing computation.

Check whether input-dependent specialization improves predictions enough to justify the extra complexity. Also check that the gate uses its experts effectively.

IV.E) Look Beyond the Network Diagram

A network diagram alone does not tell us how a model is used. Ask:

  • Task: what does the model need to predict or represent?
  • Training: what objective does it learn from?
  • Data: which examples and sites contribute?
  • Use: how will the result support an engineering decision?

The same type of network can play different roles, depending on these choices.

IV.E) Scope of These Approaches

The lecture covered four groups of modeling choices:

  • IV.A: learn useful features, including from unlabeled data.
  • IV.B: share learning across assets or adapt pretrained models.
  • IV.C: train across sites while keeping raw data local.
  • IV.D: combine specialized predictors.

Choose approaches for the needs they address; combine them when useful. These groups are not a complete list of AI methods.

IV.E) Choosing an Approach

Five practical questions point to candidate methods, including foundation-model reuse.

FIG. Problem Questions Suggest Candidate Approaches

This is a guide, not an exclusive decision tree. Several approaches may be combined; compare choices with a suitable baseline.

IV.E) Comparing the Approaches

TABLE. Learning, Sharing, and Combining Models
Approach or context When to consider it Main idea What to check
Self-supervised features Few task labels Learn from targets created from the inputs Do the features help the final task?
Global model Many related assets Share learning across assets Performance on each asset
Foundation model Several tasks to adapt to Reuse a broadly pretrained model Fit to the new data and task
Federated learning Data stay at different sites Train locally and combine updates Local performance, privacy, communication
Mixture of experts Different operating conditions Learn how to combine specialized models Accuracy, cost, use of each expert

Ask what is learned, shared, or reused. These choices describe different parts of a learning system.

IV.E) Which Approach Would You Choose?

For each situation, suggest an approach and explain why it may help. More than one answer may be reasonable.

  • A. Ten years of vibration data, but only 40 confirmed bearing failures.
  • B. Five companies with similar machines cannot share raw production data.
  • C. A ship’s fuel use differs during maneuvering, cruising, and heavy weather.

IV.E) Read the Method, Not Just Its Name

A paper describes its model as an industrial foundation model. Before accepting that description, ask:

  • What are the inputs and outputs?
  • What data were used for pretraining, and how broad are they?
  • What loss or objective is used for training?
  • How much adaptation does each new task require?
  • Does the method improve on a suitable baseline on unseen cases?

Judge the method by what it does and how it is evaluated.