Improving classifier

Posted on Oct 3, 2017 | Comments Off on Improving classifier

Today I tried a simple improvement to classifier. I took a previous algorithm and enhanced the classifier categorization logic.  Previously I’ve required that the model leading coefficient (c[0]) should be more than noise threshold for every data point. This was my “goodness of fit” criteria. If the coefficient was too small for any of the sample points, the classifier would produce “no movement signal” output. This have lead to a very unstable output oscillating between “signal” and “no signal”.

Instead I changed the criteria to require that within analyzed interval majority of points should have coefficient above noise threshold. Then the whole interval is marked as “movement signal” and the output will be an averaged values.

Here is the code in python for aggregating classifier output:

outSig = [freqNA] * (len(freqEstimate)+Nlen)
# do one more pass to determine if range has majority of records with the signal or majority without signal
for ii in range(len(freqEstimate)):
freqCnt, freqVal = 0, -1.0
for jj in range(Nlen):
# if frequency estimate is more than zero, that means classifier decided that the signal is good
if ii+jj > len(freqEstimate) – 1: break
#print(‘freqEstimate:{}’.format(freqEstimate[ii+jj]))
if freqEstimate[ii+jj] and freqEstimate[ii+jj] > 0:
freqCnt += 1
freqVal += freqEstimate[ii+jj]
if freqCnt > Nlen/2+1:
freqVal /= freqCnt
outSig[ii+Nlen] = freqVal

Here are the results of the new classifier that is based on a function of model coefficients f(c0,c1,c2).

majority_classifier_sample2

Compare that to a previous classifier output:

bokeh_plot (2)

As you can see the output signal (in black) is a lot more stable.

For comparison, I’m also showing the output of the modified classifier that is based on NMSE, rather than coefficients:

breath_plot_nmse

Here is the output from another bigger data sample with classifier based on coefficients:

majority_classifier_sample1

and same sample and NMSE classifier:

breath_plot_nmse2

One can conclude that this “smoothing” aggregation technique works a lot better.

Comments are closed.