Not every analytics problem comes with reliable labels. Some require discovering groups, compressing complex inputs or learning a sequence of decisions. Clustering, neural networks and reinforcement learning address these different tasks, but their outputs require different forms of validation.

This reference joins the mathematical ideas behind those methods while keeping their purposes separate. It is an analytics reference, not a claim that a particular algorithm delivers profitable autonomous trading or a recommendation for a named vendor.

Unsupervised groups reflect the chosen representation

Clustering groups observations according to similarity in a feature space. The result depends on features, scaling, distance metric and the clustering objective. It does not reveal a uniquely correct set of natural categories independently of those choices.

For financial records, similarity might concern transaction amounts and timing, balance-sheet ratios, return patterns or document features. Each representation answers a different question. Combining unrelated scales without standardisation can make the largest-unit feature dominate.

Missingness can also be informative or distortive. A cluster of records with many missing values may reflect a data-collection process rather than an economic segment. Analysts should examine both the numerical grouping and the mechanism that generated the observations.

K-means alternates assignment and centroid updates

Given observations xix_i, cluster assignments cic_i and centroids μk\mu_k, k-means minimises

∑i∥xi−μci∥2.\sum_i\|x_i-\mu_{c_i}\|^2.

It alternates between assigning each observation to its closest centroid and replacing each centroid with the mean of its assigned observations. Each step does not increase the objective, but the algorithm can settle at a local optimum dependent on initialisation.

Multiple starting points help assess that sensitivity. Empty clusters, outliers and highly unequal cluster sizes require attention. The squared-distance objective naturally favours compact groups and can struggle with elongated or nonconvex structures.

Choosing the number of clusters requires a purpose. An elbow in within-cluster error or a silhouette measure can help compare partitions, but neither substitutes for a useful operational interpretation. A segmentation that cannot support a different decision may add complexity without value.

Self-organising maps provide a visual neighbourhood

A self-organising map places prototype vectors on a low-dimensional grid. For an input xx, the closest prototype is identified, and it and nearby grid prototypes are moved toward the input. A typical update is

wjnew=wjold+ηthj,b(t)(x−wjold),w_j^{\mathrm{new}}=w_j^{\mathrm{old}} +\eta_t h_{j,b}(t)(x-w_j^{\mathrm{old}}),

In words: Move each selected map point toward the input, with movement set by the learning rate and its neighbourhood weight.

where wjw_j is prototype jj, bb is the best-matching prototype, ηt\eta_t is the learning rate and hj,bh_{j,b} is a neighbourhood weight.

The learning rate and neighbourhood radius usually decline during training. Early updates establish broad organisation; later updates refine local positions. The final map helps visualise nearby feature patterns.

Grid proximity is an approximation to similarity in the original feature space. A two-dimensional layout cannot preserve every high-dimensional relationship. Quantisation error and topology distortion should be assessed, and the map should not be treated as a causal map of the underlying economy.

Neural networks fit compositions of functions

A feedforward network applies layers such as

a(ℓ)=ϕ(W(ℓ)a(ℓ−1)+b(ℓ)),a^{(\ell)}=\phi(W^{(\ell)}a^{(\ell-1)}+b^{(\ell)}),

where a(ℓ)a^{(\ell)} is the activation vector at layer ℓ\ell, W(ℓ)W^{(\ell)} its weight matrix, b(ℓ)b^{(\ell)} a bias vector and ϕ\phi an activation function. The final layer is chosen for the target, such as a numerical value or class probabilities.

Nonlinear activations allow compositions to represent relationships beyond a single linear transformation. Without nonlinearities, stacking linear layers still gives a linear transformation, regardless of how many layers are drawn in a diagram.

Training minimises a loss function over examples. Backpropagation applies the chain rule to calculate gradients efficiently. An optimiser then updates parameters. The gradients are exact derivatives of the computational graph, but the overall training problem is generally nonconvex and does not promise a unique global solution.

Figure 01 · Conceptual framework

From representation to a tested policy

From representation to a tested policyFrom representation to a tested policy. Choose the learning task: Separate grouping, compression and sequential action. Build the representation: Scale inputs and preserve meaningful information. Fit the model: Control architecture, reward and regularisation. Test outside training: Compare stability and decisions with simpler alternatives.Choose the learning taskSeparate grouping, compressionand sequential actionBuild the representationScale inputs and preservemeaningful informationFit the modelControl architecture, reward andregularisationTest outside trainingCompare stability and decisionswith simpler alternatives
Reading the figureConceptual sequence drawn from the report; the steps describe responsibilities and analytical dependencies, not measured market outcomes.

A small architecture already has many parameters

The retained teaching architecture has three inputs, eight hidden units and two outputs. A fully connected version with a bias for each hidden and output unit has 3×8+8+8×2+2=503\times8+8+8\times2+2=50 trainable parameters.

The count is small relative to many practical networks, but it shows why sample size and regularisation matter. Adding units and layers increases capacity even when the diagram looks only slightly more complicated.

Learning rate controls update size. Too large a rate can produce unstable optimisation; too small a rate can make progress slow or leave training poorly converged. Feature scaling, initialisation and activation choice also affect gradient behaviour.

A low training loss shows that the network fits its training objective. It does not establish generalisation, economic relevance or calibration. Validation performance, learning curves and sensitivity to initialisation are more informative than the training loss alone.

Regularisation trades fit against stability

Regularisation methods and what they change

Aspect Retained observation
Weight penalties Weight penalties discourage large parameter values.
Early stopping Early stopping ends training when validation performance stops improving.
Dropout Dropout randomly removes activations during training under a specified scheme.

Each technique changes the effective fitting process and introduces choices that belong inside validation.

Data leakage can make all these controls appear successful while leaving the real problem unresolved. Preprocessing, feature construction and target timing must be established before judging the network. For financial time series, random splits may not represent future deployment conditions.

Networks can also extrapolate poorly outside their training range. A pricing surrogate may reproduce training prices while violating monotonicity, convexity or other contract constraints in sparse regions. Domain checks and stress inputs remain necessary even when average prediction error is low.

Autoencoders compress a representation

An autoencoder maps an input to a lower-dimensional latent representation and reconstructs the original input from it. The retained example compresses ten input features into three bottleneck coordinates before reconstruction.

Low reconstruction error indicates that the representation preserves information useful under the reconstruction loss. It does not guarantee that the retained dimensions preserve the information needed for a different downstream task, such as tail-risk prediction.

A standard autoencoder is not automatically a well-specified generative model. Arbitrary points in its latent space may decode into implausible observations. Using the decoder to generate scenarios therefore requires additional checks on latent distribution, economic constraints and out-of-sample behaviour.

Figure 02 · Qualitative comparison

Different algorithms solve different problems

Different algorithms solve different problems
Approach or conceptWhat it contributesWhat still matters
K-means and mapsGroup similar observations or visualise neighbourhoodsClusters are not automatically economic regimes
AutoencodersCompress a representationReconstruction quality does not guarantee useful trading information
Reinforcement learningChooses a policy over repeated decisionsSimulator and reward design can hide future costs
Reading the figureQualitative comparison of the alternatives and limits discussed in the report; no empirical ranking or performance estimate is implied.

Reinforcement learning chooses actions over time

Reinforcement learning concerns a sequence of states, actions, rewards and transitions. A policy π(a∣s)\pi(a\mid s) selects an action aa in state ss. The objective is typically expected discounted cumulative reward.

For discount factor 0≤γ<10\leq\gamma<1, the state value under policy π\pi is

Vπ(s)=Eπ[∑t=0∞γtrt+1∣s0=s].V^\pi(s)=\mathbb E_\pi\left[\sum_{t=0}^{\infty}\gamma^tr_{t+1}\mid s_0=s\right].

In words: Under the chosen policy, a state’s value is the expected total reward, with later rewards given less weight.

The action value Qπ(s,a)Q^\pi(s,a) also conditions on an initial action. These functions connect current decisions to future consequences. A suitable Markov state summarises the information needed for transitions; if relevant history is omitted, the assumed state may be inadequate.

The environment need not be completely unknown. Reinforcement-learning methods can learn from interaction, use a known simulator, learn a model of transitions or combine these approaches. The important distinction is sequential decision optimisation rather than one-step prediction alone.

Bellman updates make the recursion operational

A one-step Q-learning update is

Q(s,a)←Q(s,a)+α[r+γmax⁡a′Q(s′,a′)−Q(s,a)],Q(s,a)\leftarrow Q(s,a)+\alpha \left[r+\gamma\max_{a'}Q(s',a')-Q(s,a)\right],

In words: Move the current action value toward the observed reward plus the discounted best value available in the next state.

where α\alpha is the learning rate, rr the observed reward and s′s' the next state. SARSA instead uses the value of the action actually selected next, making its update policy-dependent in a different way.

An illustrative update starts with Q=2Q=2, reward 1, next-state maximum 3, γ=0.9\gamma=0.9 and α=0.1\alpha=0.1. The target is 3.7 and the updated value is 2.17. This is learning arithmetic, not evidence of profitable decisions.

Exploration chooses actions partly to learn their consequences; exploitation chooses actions currently estimated to be best. A policy that never explores can miss better actions, while uncontrolled exploration may be unacceptable in a costly operational setting.

Figure 03 · Conceptual framework

Does the policy survive a realistic simulator?

Does the policy survive a realistic simulator?Does the policy survive a realistic simulator?. Learned trading policy: Inspect reward, execution and state assumptions. Costs and constraints represented: Test against an interpretable baseline. Important costs omitted: Rebuild the environment before evaluating skill. Out-of-sample review: Check policy stability and delayed consequences. Lettered arrows correspond to the connection key below.Learned trading policyInspect reward, execution andstate assumptionsCosts and constraintsrepresentedTest against an interpretablebaselineImportant costs omittedRebuild the environment beforeevaluating skillOut-of-sample reviewCheck policy stability anddelayed consequencesABCD

How the parts connect

  1. Learned trading policyPath ACosts and constraints represented
  2. Learned trading policyPath BImportant costs omitted
  3. Costs and constraints representedReviewOut-of-sample review
  4. Important costs omittedReviewOut-of-sample review
Reading the figureDecision framework derived from the report. The two paths identify different evidence or control conditions; they do not predict an investment or operational outcome.

Financial use depends heavily on the simulator and reward

A trading or execution environment should account for costs, liquidity, market impact, inventory and available information. A policy can exploit an unrealistic simulator rather than learn a useful strategy. Reward definitions can encourage excessive leverage, hidden tail risk or short-horizon gains unless those effects are represented.

Historical replay is not necessarily a full counterfactual environment: a different action might have changed fills, impact or future opportunities. Off-policy evaluation faces limited support when the historical behaviour rarely took the actions proposed by the new policy.

Different learning tasks require different validation evidence

Task Suitable output Essential validation
Clustering Groups in a defined feature space Stability, scaling and practical interpretability
Self-organising map Approximate low-dimensional neighbourhood Distortion and original-space relationships
Neural prediction Estimated target from features Unseen performance, calibration and stress behaviour
Autoencoding Compressed representation Reconstruction and downstream information retention
Sequential learning Policy maximising specified reward Realistic transitions, costs and counterfactual support

The common requirement is a clear link between the mathematical objective and the decision. A cluster is not an explanation, a compressed coordinate is not an economic factor, and an optimised simulated reward is not realised performance. Keeping those distinctions visible allows these methods to be useful without overstating what they establish.

Cluster stability is more useful than a compelling label

Refit a clustering method under different initial seeds, plausible scaling choices and resampled observations. If an observation repeatedly changes groups, its membership is uncertain even when the final visualisation assigns a crisp colour.

Labels such as “high risk” or “growth segment” should follow inspection of the group characteristics and the intended use. The algorithm may have grouped records by size, missingness or a single dominant feature. A persuasive name can turn that narrow numerical grouping into an unsupported economic interpretation.

When comparing groups over time, centroid drift and changes in membership can arise from a genuinely changing population or from re-estimation. Keeping a reference representation or matching clusters between runs helps distinguish those effects. Otherwise a group label can persist while its economic contents change.

Neural-network uncertainty is not one quantity

Prediction error can reflect irreducible outcome noise, limited training data, model misspecification or optimisation variability. A standard network output does not separate these sources automatically. Repeating training with different initialisations can reveal one component but does not quantify every form of uncertainty.

An ensemble can improve stability, but averaging several models trained on the same biased dataset does not remove the bias. Uncertainty intervals need a stated construction and evaluation of their coverage under relevant conditions.

For a surrogate pricing model, validation should include economically important boundaries and stressed inputs, not just a random sample from the training distribution. A small average error can coexist with a material violation near a strike, barrier or rare combination of risk factors.

Sequential rewards can hide delayed costs

A policy rewarded for immediate profit may take actions that create later inventory, financing or tail-risk costs. Discounting future rewards too heavily can intensify that behaviour. The reward function should therefore represent the actual horizon and consequences of the decision.

Adding penalties is not purely a technical correction. A penalty on inventory or drawdown expresses a preference or constraint. Its scale determines how the policy trades off competing objectives and should be chosen transparently.

Episode boundaries matter too. If positions are reset without a liquidation cost at the end of every simulated episode, the agent may exploit that reset. Terminal inventory, cash and obligations should be valued consistently so that the simulation does not offer a free disposal mechanism absent in the real process.

Test the policy against interpretable alternatives

A sequential learner should be compared with simple fixed rules, a myopic policy and, where available, a model-based benchmark. These comparisons reveal whether the complexity produces a material improvement under the same cost and information assumptions.

Evaluate across different market or operating regimes and inspect the actions, not only cumulative reward. A policy that earns a high average by taking rare catastrophic risks requires a different judgement from one with stable performance. Out-of-distribution states should have explicit handling rather than an assumption that the learned action remains appropriate.

The useful deliverable is a tested decision rule with known inputs, incentives and limitations. The algorithm’s ability to fit data or improve a simulated score is the beginning of that assessment, not its completion.

Built from public documents and the author's own experience. No consultation informed it.