Clustering Commodity Markets in Space and Time: Clarifying Returns, Volatility, and Trading Regimes Through Unsupervised Machine Learning
90 Pages Posted: 31 Mar 2021 Last revised: 28 Feb 2023
Date Written: February 23, 2021
Unsupervised machine learning can interpret logarithmic returns and conditional volatility in commodity markets. k-means and hierarchical clustering can generate a financial ontology of markets for fuels, precious and base metals, and agricultural commodities. Manifold learning methods such as multidimensional scaling (MDS) and t-distributed stochastic neighbor embedding (t-SNE) enable the visualization of comovement and other financial relationships in three dimensions.
Different methods of unsupervised learning excel at different tasks. k-means clustering based on logarithmic returns works well with MDS to classify commodities and to create a spatial ontology of commodities trading, A strikingly different application involves k-means clustering of the matrix transpose, such that conditional volatility is evaluated by trading date rather than by commodity. This approach can isolate the two most calamitous temporal regimes of the past two decades: the global financial crisis of 2008-09 and the immediate reaction to the Covid-19 pandemic. Temporal clustering of trading days, unlike the corresponding spatial task of clustering commodities, is better visualized through t-SNE than through MDS.
Keywords: Commodities, commodity markets, precious metals, base metals, energy markets, agricultural markets, machine learning, unsupervised learning, GARCH, clustering, k-means clustering, hierarchical agglomerative clustering, multidimensional scaling, MDS, t-distributed stochastic neighbor embedding, t-SNE
JEL Classification: C38, C65, Q02
Suggested Citation: Suggested Citation