How to judge quality of Savitzky-Golay smoothing?

  • Follow


I have used sgolayfilt and performed some Savitzky-Golay smoothing to data:
http://www.mathworks.com/help/toolbox/signal/ref/sgolayfilt.html

For now, it neesd to be a Savitzky-Golay filter - not moving average, loess, etc. Now, I need to know how to judge what the best Savitzky-Golay filter parameters are. There are 2 options for parameters: k - degree of polynomial and f - frame size. I am not very familiar with smoothing techniques so I have some questions.

Questions:
1. How does one judge the quality of the smoothing? Is visual judgement sufficient (I can do this)?
2. Can a R^2 be computed for the agreement/disagreement between the smoothed data and the raw data? Would this be a valid approach to making this judgement?
0
Reply studentt_44 (52) 8/11/2012 8:08:07 PM

"Stan" wrote in message <k06e37$m9g$1@newscl01ah.mathworks.com>...
> I have used sgolayfilt and performed some Savitzky-Golay smoothing to data:
> http://www.mathworks.com/help/toolbox/signal/ref/sgolayfilt.html
> 
> For now, it neesd to be a Savitzky-Golay filter - not moving average, loess, etc. Now, I need to know how to judge what the best Savitzky-Golay filter parameters are. There are 2 options for parameters: k - degree of polynomial and f - frame size. I am not very familiar with smoothing techniques so I have some questions.
> 
> Questions:
> 1. How does one judge the quality of the smoothing? Is visual judgement sufficient (I can do this)?
> 2. Can a R^2 be computed for the agreement/disagreement between the smoothed data and the raw data? Would this be a valid approach to making this judgement?

R^2 is a terrible choice for automatic judgment of
smoothing.

Use your eyes to tell you when you are happy, not
any single number. As soon as you agree to remove
your own mind, your brain, your knowledge from the
equation, replacing them with a single number to
judge the result, you will get what you deserve.

John
0
Reply woodchips (7921) 8/11/2012 8:29:07 PM


I agree with John.  There is no single equation that will give you some kin=
d of quality metric that will tell you when you have the optimal set of par=
ameters.  It's optimal when you say it's optimal.  How much smoothing or no=
ise reduction you need is a subjective and personal decision.  So unless yo=
u have some "ground truth" (the theoretically perfect and known noise-free =
signal) then you can just adjust it as you please.
0
Reply imageanalyst (7590) 8/11/2012 11:15:03 PM

"Stan" wrote in message <k06e37$m9g$1@newscl01ah.mathworks.com>...
>
>
> Questions:
> 1. How does one judge the quality of the smoothing? Is visual judgement sufficient (I can do this)?
> 2. Can a R^2 be computed for the agreement/disagreement between the smoothed data and the raw data? Would this be a valid approach to making this judgement?
============

In image processing, what people often do is plot a noise/resolution trade-off curve as a function of the filter parameters. They would then select the parameters based on the resolution/noise level they want to operate at.

Although this isn't image processing, I image you have ways of measuring both noise and the sharpness of the signal features you want to preserve. You could therefore plot the trade-off in a similar way.
0
Reply mattjacREMOVE (3180) 8/12/2012 12:31:06 AM

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <b28337e0-c93b-410b-bd65-ab9c50543b43@googlegroups.com>...
> I agree with John.  There is no single equation that will give you some kind of quality metric that will tell you when you have the optimal set of parameters.  It's optimal when you say it's optimal.  How much smoothing or noise reduction you need is a subjective and personal decision.  So unless you have some "ground truth" (the theoretically perfect and known noise-free signal) then you can just adjust it as you please.

There are some theory that tends to estimate the parameters automatically, such as cross validation, L-curve.

Compromise between smoothness and overfit is usually challenging to be done well automatically, but it's NOT a matter of subjective decision.

Bruno
0
Reply b.luong5955 (6348) 8/12/2012 2:23:07 AM

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <k0742b$nv8$1@newscl01ah.mathworks.com>...
> ImageAnalyst <imageanalyst@mailinator.com> wrote in message <b28337e0-c93b-410b-bd65-ab9c50543b43@googlegroups.com>...
> > I agree with John.  There is no single equation that will give you some kind of quality metric that will tell you when you have the optimal set of parameters.  It's optimal when you say it's optimal.  How much smoothing or noise reduction you need is a subjective and personal decision.  So unless you have some "ground truth" (the theoretically perfect and known noise-free signal) then you can just adjust it as you please.
> 
> There are some theory that tends to estimate the parameters automatically, such as cross validation, L-curve.
> 
> Compromise between smoothness and overfit is usually challenging to be done well automatically, but it's NOT a matter of subjective decision.
> 
> Bruno

I have no desire to argue the matter, but I will disagree
that automatic tools are up to the task of such a decision
at least at the current state of the art.

Anyway, this is not the choice of a continuous smoothing
parameter, that MIGHT arguably be chosen by a tool, but
the choice of parameters like window width and order of
the implicit fit in a Savitsky-Golay smoother.

The eyes of the person doing the fit will often be far better
at making such decisions than a computational algorithm.
You are the person who knows what your goal is for the fit,
and who knows how much of that noise really is noise and
what is acceptable for your purposes. You can often see
immediately when the fit is one that overfits the data or is
inadequate for your needs.

Trust your eyes rather than rely on a black box.

John
0
Reply woodchips (7921) 8/12/2012 2:37:06 AM

Okay, lots of information there to digest. Let me start with this:

> ============
> 
> In image processing, what people often do is plot a noise/resolution trade-off curve as a function of the filter parameters. They would then select the parameters based on the resolution/noise level they want to operate at.
> 
> Although this isn't image processing, I image you have ways of measuring both noise > and the sharpness of the signal features you want to preserve. You could therefore > plot the trade-off in a similar way.
> ============

Here is what I have access to (this is spectroscopy data - counts vs channels is what I am dealing with):
1. x - channels
2. y - measured counts
3. yf - smoothed counts

What is the noise trade-off equation that you are refering to? I don't mean the MATLAB version, but just the equation in general (if you have a link that you be best) unless it's easier to just write out the MATLAB code.
0
Reply studentt_44 (52) 8/12/2012 8:27:06 PM

6 Replies
38 Views

(page loaded in 0.123 seconds)


Reply: