From our thermoelectric data to singular value decomposition

How do these three factors rebuild our materials data?

Rebuild the same thermoelectric measurements from three factors, then explore a picture one layer at a time.

We have followed our thermoelectric measurements into PCA. Now I would like to open up the calculation with you. We will return to the same records, separate their prepared data table into three factors, and check how those factors put every value back together. Then we will try the same idea with a picture.

Would you like to pause here and understand the mathematical ideas behind SVD and PCA? Let us dive into the math here

Let us begin with the first step — Our actual records, labelled Step 01 below. I have opened it for you so that we can look at the measurements together. After exploring each step, choose Next to continue with me. You can also choose any step’s button to return to an earlier idea.

Let us take the same idea into a picture

Could we investigate a visual pattern too?

We have separated a table of thermoelectric measurements into simpler numerical patterns. A digital image is also an array of numbers. In a grayscale image, each entry describes a pixel’s brightness. Let us see whether you can recognize the same decomposition in this new setting.

The picture below has eight rows and eight columns. Here, rows and columns mean pixel positions, rather than observations and measured properties. Brightness runs from 0 for black to 1 for white. I apply SVD directly to these brightness values; I do not centre or standardize this image.

Each layer is still a column pattern multiplied by a singular value and a row pattern. Positive entries add brightness; negative entries subtract it. The layers are numerical contributions, rather than recognizable objects or transparent sheets.

Add the picture layers yourself

Start with one layer. Compare the original with the rebuilt picture, then add another layer and look at the correction. Can you see the same addition of patterns that we used for our materials table?

Original and rebuilt brightness use the same black-to-white scale, 0 to 1. In the added layer, red means add and blue means subtract, on a fixed −1 to +1 scale. Values are clipped only for display; the error uses the original numerical values. Four layers recover this deliberately simple picture; a micrograph will usually need more.

You may remember how we rebuilt an image from waves in the Fourier transform lesson. There, we used a fixed set of sinusoidal patterns. Here, SVD finds row and column patterns for this particular brightness array. Both let us express an image through simpler contributions, but retaining a few SVD layers is not the same operation as selecting Fourier frequencies.

What if you have many micrographs?

Now imagine that you have a collection of aligned images of the same size. We can put each whole image into one data row, with a column for each pixel position. After subtracting each column’s mean, PCA can help you explore the main patterns of variation across the images. If we standardize pixels too, that is an additional modelling choice.

Notice the change in the question: SVD of one image rebuilds its brightness array; PCA of an image collection investigates differences between observations. With zero retained layers, we add back the means of T, S and the two conductivity logarithms. Reversing those logarithms gives geometric-mean conductivities. The uncentred picture above starts from a black image.

Let us explore PCA with small pixel images →

I would encourage you to ask what a strong pattern means physically. It might reflect a material feature, but it could also reflect lighting, alignment or image acquisition. Neither SVD nor PCA identifies the cause on its own.

Check the data and the calculation with me

Our materials calculation uses all 5,205 original ESTM observations, with no removal or imputation. Columns are temperature, Seebeck coefficient, log₁₀ electrical conductivity and log₁₀ thermal conductivity. We subtract full-dataset column means and divide by sample standard deviations (divisor n − 1). Composition identifies each observation; it is not a column in this four-property SVD. The separate composition PCA has 65 elemental-fraction columns.

This is our educational analysis of the released data, rather than the paper’s supervised SIMD representation. The picture is a separate constructed teaching example.

Na & Chang (2022): reference paper · Original ESTM dataset

The factors are computed using NumPy’s reduced SVD. Their signs are aligned with the PCA walkthrough; reversing a matching column of U and row of Vᵀ leaves their product unchanged. Displayed values are rounded; reconstruction uses the stored full-precision factors.

Help me keep these tutorials going

If this tutorial helped you, you can support the time I spend creating examples and checking the code.

Support is voluntary. My tutorials remain freely available.