r-barnes / faster-unmixer

A faster implementation of the sediment inverse/unmixing scheme proposed in Lipp et al (2021).
5 stars 1 forks source link

Add regularization by penalising relative deviations from mean #27

Closed AlexLipp closed 1 year ago

AlexLipp commented 1 year ago

We currently regularise by penalising the roughness of the proposed solution, considering adjacent nodes. However, this considers only absolute difference between nodes when relative deviations are desired. This current method produces results which thus allow for significant overfitting of low-magnitude observations (i.e., orders of magnitude below one) which is undesirable for fitting (for example) trace element concentrations. An example of these undesirable outputs are shown here: old_regularization

In this PR, I instead penalise relative deviations of each variable from the mean of all observations. This permits slightly 'rougher' solutions, but inspecting the results, the results are elsewise much better conditioned. Specifically, no longer do we see outputs spuriously spanning many orders of magnitude below, as shown in the example below which is same as example above but with new regularization method:

new_regularization

This PR removes the need for an adjacency matrix which also simplifies the code.

AlexLipp commented 1 year ago

If we decide to pursue this in we should change obs_mean to be the geometric mean of the data not the arithmetic mean as it currently is.

r-barnes commented 1 year ago

I'm okay going with this for now as I don't have better ideas yet of how to combine log-ratio regularization with the log-ratio primary terms. If we decide to stick with it for the long-term, I should probably go back and remove the sample adjacency/border length code.

AlexLipp commented 1 year ago

Agreed on this. The specific attachment to smoothness as opposed to model size is a legacy from previous ways of solving in any case.

r-barnes commented 1 year ago

@AlexLipp : Could you also rebase to fix the merge conflict?

AlexLipp commented 1 year ago

@r-barnes I've incorporated the suggested changes and rebased to main