# Comparing spectra from hyperspectral images

I extracted the mean spectra of regions of interests of different tissues from hyperspectral images. How to compare those spectra by the difference of their reflectance and their spectral behavior (I mean the spectra look similar but are shifted to the left or right).

Example of the mean spectra of two regions:

I would like to know the similarity between the two spectra. I tried cross correlation and Root mean square error but the results were not satisfying.

The goal is to predict a genetic distance of species from the spectra. For instance if the genetic distance of species 1 and species 2 is very height I would expect a different spectra. If the distance is 0 or very low,m the spectra are the same /very similar.

• You'll have to explain what your goal for comparison is. What compares "highly", what not? Without knowing what you want, it's not possible to help you. Also, it's very physically unusual for spectra to be shifted "left and right" (unless things are moving near speed of light, that is), so you'll want to first get rid of that measurement artifact before doing anything else. – Marcus Müller Dec 30 '19 at 12:14
• I edit my question, hope that helps a bit. Thanks – snowflake Dec 30 '19 at 12:22

The goal is to predict a genetic distance of species from the spectra. For instance if the genetic distance of species 1 and species 2 is very height I would expect a different spectra. If the distance is 0 or very low,m the spectra are the same /very similar.

In that case, defining the distance between two spectra based on the spectra makes no sense – you want to define it based on the genetic distance.

So, you want to infer a model that describes genetic distance based on spectra. That's fine – but such a model will be very complex, and it's (as far as I can tell) not possible to find an easy function that will just give you what you want.

Unless you have a large dataset of genetic distances, I'll even go as far as saying that this is scientifically a very dangerous thing to do: your spectra are themselves large sets of data (a lot of points, say 1000). If you have, say, only 100 genetic distances, then you'll always find something that correlates well with the genetic distance within your large number of points, without having anything to do with it: the 101. genetic distance would not be represented by that model at all, i.e. it would only fit to the data set you had when you formed that model.

Basically, what you're describing is a problem that these days would usually be solved using neural networks. Again, this all depends on you having enough data to train your network, or else your network will not generalize to new spectral measurements and be useless outside your training data set.

• I agree that the problem is not well-posed yet. This sounds like a feature-based approach to prediction, hoping that a "natural" curve feature (a distance) could predict something else (genetic distance). There might be other methods to use before NN: regression models (PLS-like methods) or decision trees for instance – Laurent Duval Dec 30 '19 at 12:34
• @LaurentDuval You're right! There's more than one solution to Bayesian problems :) – Marcus Müller Dec 30 '19 at 13:07
• Bayesian? You're talking to a pure frequentist :) – Laurent Duval Dec 30 '19 at 13:22
• @LaurentDuval :D the empirics strike back :) – Marcus Müller Dec 30 '19 at 13:32
• I cannot ninefold up-arrows on comments – Laurent Duval Dec 30 '19 at 13:35