📚 Series ShipPaulJobs AI Learning Roadmap | PART 1 Lesson 2 of 5 · Course Index →
PART 1 · Lesson 2 Machine Learning Training · Inference

How Machines Learn from Data

Dataset · Features · Labels · Training Loop · Loss Function · Gradient Descent · Model · Inference · Supervised, Unsupervised & Reinforcement Learning — the core vocabulary that underlies every AI system you will encounter in this roadmap.

Captain Paul
Captain Paul
Maritime Cybersecurity · IACS UR E26/E27
September 2026
🎯 Lesson Objective

After this lesson you can explain what a training dataset is and why data quality matters; describe the training loop including loss functions and gradient descent; distinguish between a model and its training process; explain inference and why it differs from training; and categorise AI learning approaches as supervised, unsupervised, or reinforcement learning.

Lesson 1 established that Machine Learning inverts classical programming: instead of writing rules, you provide data and let the machine discover the rules. But that description skips an enormous amount of engineering and mathematics. What does "providing data" actually mean? What does "learning" actually look like inside a computer? What is a model, and how do you know it has learned something useful?

These questions are not academic. Every practical AI deployment — a vessel maintenance anomaly detector, a document classification system for port state control reports, a generative model that drafts technical responses — is built on the foundations this lesson covers. You cannot evaluate an AI system's reliability, safety, or security without understanding how it was trained and what its failure modes are.

This lesson focuses on supervised learning — the dominant paradigm in production AI today — and introduces unsupervised and reinforcement learning as contrasting approaches. The mathematics is kept to intuition level; the goal is conceptual clarity, not derivation.

1. Data — The Foundation of Every Model

A dataset is a collection of examples, where each example is a pair: an input (also called a sample, observation, or instance) and an output (also called a label, target, or ground truth — in supervised learning). The model learns to map inputs to outputs by seeing thousands or millions of such pairs.

For a vessel engine vibration anomaly detector, each input might be 60 seconds of vibration sensor readings from a main engine bearing; each label might be "normal" or "pre-failure." For a maritime document classifier, each input might be the text of a port state control report; each label might be a category like "deficiency — fire safety" or "detained."

Dataset Quality — What Determines Model Performance
  • Volume: More examples generally improve a model — but with diminishing returns. A model trained on 100 examples is almost always weaker than one trained on 100,000 comparable examples.
  • Label quality: Incorrect labels (mislabelled sensor readings, incorrectly coded inspection outcomes) teach the model wrong patterns. The aphorism in the field is "garbage in, garbage out."
  • Class balance: If 99% of examples in a vessel fault dataset are "normal" and 1% are "fault," a model that always predicts "normal" achieves 99% accuracy but is useless. Imbalanced datasets require special treatment (oversampling, weighted loss).
  • Distribution shift: If training data comes from one vessel type and the model is deployed on a different type, the patterns learned may not transfer — a critical risk in maritime AI where fleet diversity is high.
  • Data leakage: If information from the test set accidentally enters training (e.g., timestamps that reveal the outcome), the model's measured accuracy is inflated and its real-world performance will be worse.

The training set is used to fit the model. The validation set is used to tune hyperparameters and detect overfitting during development. The test set is held out entirely until final evaluation — it simulates the model's performance on data it has never seen, which is what actually matters in deployment.

2. Features, Labels, and the Learning Signal

Features are the measurable properties of the input that the model uses to make predictions. For tabular data, features are the columns: vessel age, engine RPM, sea state, fuel consumption per nautical mile. For images, features are pixel values (or, in deep learning, learned representations of those pixels). For text, features are token embeddings — high-dimensional numerical vectors that represent each word or subword.

In classical ML, feature engineering is the art of choosing which features to compute from raw data. A domain expert decides that the ratio of fuel consumption to propeller speed is more predictive of engine wear than either measurement alone, and adds that ratio as a feature. In deep learning, the network learns features automatically from raw inputs — but the raw inputs must be in a form the network can process (pixels, tokens, audio spectrograms).

A note on representation

Everything a machine learning model processes must be a number. Text is converted to integers (token IDs) then to floating-point vectors (embeddings). Images are grids of RGB integers normalised to floats. Categorical variables (vessel type: "bulk carrier", "tanker", "container") are converted to one-hot encoded vectors or learned embeddings. The transformation from raw data to numerical representation is called encoding or preprocessing and is a source of subtle bugs and quality problems in production AI systems.

3. The Training Loop — How a Model Updates Its Parameters

A model is a mathematical function with parameters (also called weights): numbers that are initialised randomly and then iteratively adjusted during training. For a neural network, these are the connection weights between neurons. For a linear model, these are the coefficients in the equation y = w₁x₁ + w₂x₂ + b.

Training is the process of finding parameter values that make the model's predictions match the labels as closely as possible. This is formalised through a loss function — a measure of how wrong the model's current predictions are on the training set. Common loss functions include Mean Squared Error (for regression) and Cross-Entropy Loss (for classification).

The Training Loop — Step by Step
  1. Forward pass: Feed a batch of training examples into the model. The model computes its current predictions using the current parameter values.
  2. Compute loss: Compare predictions to ground-truth labels using the loss function. A high loss means predictions are far from correct; a low loss means they are close.
  3. Backward pass (backpropagation): Compute the gradient of the loss with respect to each parameter — how much does each parameter need to change, and in which direction, to reduce the loss?
  4. Gradient descent update: Adjust each parameter by a small amount in the direction that reduces the loss. The size of the adjustment is controlled by the learning rate hyperparameter.
  5. Repeat: Iterate over the entire training set (one epoch) many times until the loss converges — i.e., stops decreasing meaningfully.

The learning rate is one of the most important hyperparameters: too large and the parameter updates overshoot the minimum; too small and training is slow and may get stuck. Modern optimisers like Adam (Kingma and Ba, 2014, arXiv:1412.6980) adapt the learning rate per parameter, making training more robust. GPT-3 was trained with Adam; most production models use similar adaptive optimisers.

4. Overfitting, Underfitting, and Generalisation

The goal of training is not to minimise loss on the training set. The goal is to minimise loss on new data — data the model has never seen. This capability is called generalisation and it is the core challenge of machine learning.

❌ Underfitting

Model is too simple or trained too briefly. High loss on both training and test sets. Does not capture the patterns in the data. Fix: more complex model, longer training.

✅ Good Fit

Low loss on both training and test sets. Model captures real patterns without memorising noise. Generalises to new data. The goal.

⚠️ Overfitting

Model memorises training examples including noise. Very low training loss, high test loss. Does not generalise. Fix: regularisation, dropout, more data, early stopping.

For maritime AI, overfitting has a specific dangerous form: a maintenance anomaly model that is highly accurate on the training vessels but performs poorly on new vessel classes, or on the same vessels after a scheduled drydock that changed the baseline sensor readings. Regular re-evaluation on held-out data and periodic retraining with new operational data are operational requirements, not optional improvements.

5. Inference — The Model in Production

Inference is what happens when a trained model is deployed and used on new data. The parameters are frozen — no learning is happening. The model receives an input, runs a single forward pass, and produces an output. For an LLM, this is called "generation": the model autoregressively samples the next token until an end-of-sequence token is produced.

Training and inference have very different computational profiles. Training requires backpropagation across all parameters and all training examples — enormous GPU memory and compute over hours or days or weeks. Inference requires only a forward pass on a single input — much faster, though for large models like GPT-4, still requiring significant hardware.

Why This Distinction Matters for Security

Adversarial attacks exploit inference — they craft inputs designed to cause the model to produce an incorrect output without modifying the model's parameters. A manipulated AIS signal, a corrupted sensor reading, or a carefully constructed text prompt can steer a deployed model away from its intended behaviour. This is different from poisoning attacks (which modify training data) and model theft attacks (which replicate the model by querying it). Each attack vector requires a different defence.

6. Supervised, Unsupervised, and Reinforcement Learning

The training loop described above assumes labels — a ground-truth output for each input. This is supervised learning, the most widely deployed paradigm. But two other paradigms are increasingly important in maritime AI and in the LLMs at the core of this roadmap.

Three Learning Paradigms
Supervised Learning Labelled data pairs (input, label). Model learns to predict the label from the input. Used for classification and regression tasks. Examples: fault detection, document classification, image recognition.
Unsupervised Learning Unlabelled data only. Model discovers structure — clusters, dimensions, distributions — without being told what to look for. Examples: anomaly detection (clustering normal vs. outlier), dimensionality reduction, latent space learning. LLM pre-training is a form of self-supervised (unsupervised) learning.
Reinforcement Learning An agent interacts with an environment, takes actions, and receives reward signals. The model (policy) learns to maximise cumulative reward. Used in robotics, game playing (AlphaGo, 2016), and RLHF (Reinforcement Learning from Human Feedback) which aligns LLMs to human preferences.
📎 관련 포스트

비지도 학습과 강화학습 개념이 실제 AI 에이전트 설계에 어떻게 적용되는지, Park et al. (2023) 논문을 통해 분석합니다. 이번 섹션 6을 읽은 후 이 논문 리뷰에서 learning paradigm의 실전 적용 사례를 확인하세요.

The dominant paradigm in LLM development combines all three: self-supervised pre-training (predict the next token in massive text corpora — no labels required), followed by supervised fine-tuning (train on high-quality curated examples of the desired behaviour), followed by RLHF (use human preference feedback to further align output quality). This three-stage pipeline produced ChatGPT (Ouyang et al., 2022, "Training language models to follow instructions with human feedback," arXiv:2203.02155).

7. Maritime Connection — Why Data Quality Is a Safety-Critical Problem

Maritime AI systems face dataset challenges that are structurally different from other domains. Unlike consumer AI, where training data is abundant (billions of web pages, millions of labelled images), maritime operational data is:

Maritime Data Challenges
  • Sparse fault labels: Engine failures and cyber incidents are rare events. A model trained to detect failures sees very few positive examples, making the classification problem highly imbalanced.
  • Siloed and proprietary: OEM sensor data, PMS records, and voyage data are held separately by shipowners, classification societies, and equipment manufacturers. Building a unified training dataset requires data-sharing agreements that are rarely in place.
  • Sensor drift and calibration gaps: A temperature sensor that gradually drifts by 2°C over six months introduces systematic error into the training data unless the calibration records are cross-referenced — which they rarely are in practice.
  • Multi-vessel, multi-type heterogeneity: A model trained on bulk carrier sensor data does not generalise to VLCC tankers without retraining. Fleet diversity is a perpetual distribution shift problem.
  • IACS UR E26 Implication: Section 4.3 of IACS UR E26 requires verification and monitoring of OT systems. AI-based monitoring systems deployed on vessels must have demonstrably reliable training data to meet this requirement — their performance must be validated and their failure modes documented.
Captain Paul
✍️ Author Insight
Captain Paul — Maritime Cybersecurity Consultant

During E26 CRSI 프로젝트 수행, one of the most consistent gaps I observe is the absence of documented model validation for AI-based OT monitoring systems. Vendors often provide accuracy numbers from their internal testing — but those numbers were produced on their own proprietary dataset, which may not reflect the distribution of data on the vessel being assessed.

The key question to ask any AI vendor in a maritime cybersecurity context is: "What was the training data distribution, and how does it compare to our operational environment?" If they cannot answer that question specifically — naming vessel types, sensor types, operational condition ranges, time periods, and known data quality issues — the validation evidence is incomplete.

A model that is 97% accurate in aggregate may be 60% accurate on the specific failure mode that matters most for your vessel's risk profile. Training data provenance and distribution shift assessment should be treated as cybersecurity evidence, not just technical documentation.

🔑 Key Takeaways
  • A dataset is a collection of (input, label) pairs. Quality, volume, balance, and distribution determine model performance more than any architectural choice.
  • Features are the numerical representation of inputs. Feature engineering is the art of deciding which representations to compute; deep learning automates this for unstructured data.
  • The training loop is: forward pass → compute loss → backpropagate gradients → update parameters. Repeat until convergence.
  • Overfitting is the key failure mode: the model memorises training data but fails on new data. Regularisation, dropout, and early stopping mitigate it.
  • Inference is the deployed use of a frozen model — computationally different from training, and the stage at which adversarial attacks are most relevant.
  • The three learning paradigms — supervised, unsupervised, reinforcement — correspond to different problem structures and different failure modes.
  • Maritime AI faces structural data quality challenges (sparse faults, sensor drift, fleet heterogeneity) that must be addressed in vendor assessment and IACS compliance review.
⏭ What's Next

Lesson 3 — CNN, RNN and the Deep Learning Era examines the two neural architectures that dominated AI from 2012 to 2017: Convolutional Neural Networks (for spatial data — images) and Recurrent Neural Networks (for sequential data — time series and text). Understanding why CNNs and RNNs were breakthroughs — and why they were eventually superseded by the Transformer — is essential context for understanding why the Transformer architecture works the way it does.

📚 Official Sources & Key Citations
  • Goodfellow, I., Bengio, Y., and Courville, A. (2016). Deep Learning. MIT Press. Available free at deeplearningbook.org — the canonical textbook for training loop mechanics and optimisation.
  • Kingma, D., and Ba, J. (2014). "Adam: A Method for Stochastic Optimization." arXiv:1412.6980.
  • Ouyang, L., Wu, J., Jiang, X., et al. (2022). "Training language models to follow instructions with human feedback." arXiv:2203.02155 (InstructGPT / RLHF paper).
  • Park, J., O'Brien, J., Cai, C., et al. (2023). "Generative Agents: Interactive Simulacra of Human Behavior." arXiv:2304.03442.
  • IACS UR E26 (Rev.3, 2024) — Section 4.3: Network Monitoring and Verification. iacs.org.uk
  • NIST AI RMF 1.0 (2023) — MAP Function: data quality as a risk factor in AI deployment. airc.nist.gov
📚 PART 1 — AI Fundamentals
L1: From AI to GenAI L2: How Machines Learn L3: CNN · RNN · Deep Learning L4: Computer Vision L5: GANs → Generative AI

⚓ Join the ShipPaulJobs Community

Join →
Share

Comments

Top Ranked · All Posts

Popular Posts