# Improving classifier

Posted on Oct 3, 2017 | 0 comments

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) 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 breathing 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 “breathing 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). Compare that to a previous classifier output: 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: Here is the output from another bigger data sample with classifier based on coefficients: and same sample and NMSE classifier: One can conclude that this “smoothing” aggregation technique works a lot better.