hello everybody and welcome to this
webinar on signal processing techniques
for machine learning using MATLAB my
name is Gabriella Boone Kyla and I'm a
senior application engineer and math
works
a big part of my job is about helping my
abusers in the area of signal processing
which is where my background is so what
people talk about signals they usually
refer to some specific type of data that
represent values varying over time in
this webinar I'll discuss some standard
techniques available in MATLAB to take
quantitative measurements of signals and
to use them with them wider data
analysis workflows including for example
machine learning algorithms like
clustering or classification by the end
of this webinar I hope you will have
gained some familiarity with a few
standard techniques starting from simple
things like basic signal manipulations
and visualization including plotting and
spitting and selecting portions of
signals moving on to simple testicle
parameter estimation and then on to more
advanced or more specific signal
processing topics like using digital
filters for example to separate
individual components of a signal or
computing frequency domain
transformation to get further insight
into signal variations over time and
finally tool to make signal measurements
and extract representative features from
tanana main signals the idea here is
distilled information from just raw
waveforms and enable the use of further
algorithms that produce the
understanding of the data typically in
the area of machine learning the
techniques in this list are important
because they are common to metadata
analysis an algorithm design workflows
and despite being relevant to the work
of many engineers many of them often
feel they're challenging even if in
actual facts they are within quite easy
reach if one uses the right tools now
while I have some more slides to show
you for most of this webinar I'm going
to discuss one single practical example
hands-on and MATLAB let me switch to my
left for a minute then I describe
quickly what this example is about
in this continuously updating plot we're
looking at 3 accelerometer output
signals captured using a phone one like
the smartphone you may happen to have in
your pocket right now the signals that
we're seeing correspond to different
physical activities carrying out by a
person or a subject that's wearing this
smartphone in this case we happen to
know the ground truth but we're also
trying to automatically understand what
activity this is using computational
methods so that's purely based on
measurements on the signals as you can
see most of the time we've successfully
guessing what the activity actually was
now just a quick note to say that the
data that I'm using in this example is
recorded so we don't have to wait for
the new data to be ready and we can
proceed to the next buffer as soon as
we're done with a previous one because
my I'll be carrying out all the required
computations very efficiently on my lap
so this is making it run just under a
hundred times faster than real time that
it's pretty fast when you think about it
something else that I want to mention is
that you could do what I've just shown
also perfectly while using live data
MATLAB has long been able to connect to
a variety of professional external
hardware for the purpose of acquiring
real-world signals and these days it is
becoming increasingly capable to also
connect in mobile and low-cost devices
for example file exchange or MATLAB
central offers free downloads to stream
sensor signals into MATLAB from both
iPhones and Android based smartphones so
please take a look in there if this is
something you're interested in now we
can again in my example here well this
happens to be accelerometer data the
techniques that I'll this cars are
broadly relevant to most types of sample
signals of time series even if we have
to think about applications that share a
similar classification twist the
examples that are collected in this
short list
here already spanner number of different
industries like for example electronics
aerospace automotive finance defense or
a space again so these are applications
that I personally came across during my
career Malthus began a comprehensive
list will be much longer
now once again the reason why I put this
content together is that
even if signal analysis is common to
many applications and industries many
people still don't do it well one reason
is that if they didn't study signal
processing at uni then the individual
techniques relevant to signal analysis
often sound daunting and starting them
often implies having to learn a lot of
domain-specific jargon some other times
it's not clear ahead of time exactly
what type of analysis will give you the
answer that you're looking for making
the problem open-ended finally problems
like computational efficiencies lack of
extensive algorithmic libraries or rigid
frameworks make some common tools that
many people use out there not adequate
for completing tasks of even medium
complexity I'm hopeful that by the end
of the session you get a taste of why
MATLAB can address these challenges and
be a perfect fit for this type of work
now before I go back to MATLAB let me
review once again what our example is
about we're using three components
acceleration signal coming from a smart
of accelerometer and solely based on an
automated analysis of those three scalar
signals the objective is to understand
what activity the person that's wearing
the phone is actually doing as a choice
between six different options classes
walk in walking up stairs walking down
stairs sitting standing and laying to do
that we use a classification algorithm
this is a class of algorithm that can
tell to which class a new data sample
belongs to based on previous knowledge
of reasonable set of similar data
samples the way it works is that at
first the algorithm is exposed to a
large set of known cases and trained or
optimized so they can recognize those
known cases as accurately as possible
then it can be run on new unknown data
samples for example in this case a new
signal buffer and for each new signal
buffer it can formulate a guess on the
right class based on its pre-experience
now turns out that if the data used and
him talking about both training and test
steps where the actual role waveforms
the job of the classification algorithm
would be very hard or often impossible
in practice one very important step to
happen ahead of the actual
classification has to do with extracting
affinity set of characterizing
measurements from the waveforms
in this case for example these
measurements should be able to capture
quantitative descriptions able to
differentiate the signals produced by a
given activity from those produced by a
different one in the language of machine
learning this app is called feature
extraction the features are a set of
measured values from the signals the
main aim of this webinar will be to
identify good characterizing features
based it based mainly on signal
processing techniques and also to
automate the measurement using the
MATLAB language now final note in order
to select the right set of features this
is common to use a known data set for
example in this case one coming from a
controlled experiment where the activity
is known for every buffer of signal
samples available as we've seen the
knowledge of the data is key to the
initial exploratory phase of Fisher
selection for this example I'm using a
good data set made available by two
research groups respectively from
Catalonia and Spain in general in Italy
in case you're interested you can get a
hold of the data set yourself of this
address below so I hope the general
problem is clear enough by now let's see
in a bit more detail how we can use
MATLAB to develop a system that
addresses a similar challenge to explore
this example I'm going to use a MATLAB
script I'm going to assume that you're
familiar with scripts and functions in
MATLAB if you're not though you don't
need to worry too much
these are easy concepts grasp and I'm
hopeful you'll be able to get the core
ideas of this presentation anyway all
that you see here coloring green are
comments explaining what that code is
doing you can see that to turn a line
into a comment you must use a percent
sign at the beginning of it two
consecutive person signs as I have for
example here create a cell of code that
can be executed in isolation and
highlighted in the editor as the cursor
is placed inside it in the script I have
many cells which I'm going to execute
and discuss consecutively one at a time
the first cell of the script was the one
that launched my completed application
so I'm not going to execute it again the
following cell loads a portion of the
data and plots it
here I have a function which I
previously wrote the read some data from
our data set and returns the specific
set of variables as a result we now have
a vector ax containing the samples of
the vertical acceleration of some
number one over a period of time it is
worth noting that the reset itself comes
with recordings from 30 different
subjects we know we have 50 samples per
second of our acceleration signal
because the sampling frequency of 50
Hertz was used as indicated here by this
variable F as we also have the time
vector T corresponding to the
acceleration vector the two t + acts
have exactly the same length which
allows us to plot the former I guess the
latter if I look at this plot and how it
was achieved this is a very easy plot to
realize in my lab and take indeed only a
single short line of code reduce it plot
X variable Y variable by the way if
you're not confident with using the
MATLAB language right away this could
have also been achieved through pointing
clicking for example wait first lacking
T holding down control setting X and
then I right clicking and selecting plot
or go into the plots tab up here and
clicking on plot the plot shows us that
the acceleration for the subject was
recorded for almost eight minutes which
would be 480 seconds and it is also
worth noticing that it in a way this is
a simple case you know the time samples
are already regularly spaced over time
and all of them are available in a
number of real-world applications some
samples may be missing so I should at
least mention that there are techniques
in MATLAB to regularize and pre process
those types of signals now going back to
the plot if you're familiar with
plotting in MATLAB you'll know that
plots can be customized extensively both
interactively and programmatically I
won't go through that process myself
here and in the following cut section
I'll just use a function that I've
previously written to produce a slightly
more insightful plot
besides having now sound axis labels a
title and a legend this plot is actually
also using additional information on the
data that was available in my workspace
specifically the variable act ID which
is a shorthand for activity ID this time
I guess what activity the subject was
engaged in for each single data sample
as an integer number between 1 and 6 we
can interpret the meaning of those
integers by looking at the remaining
variable act labels if we look back at
the plot that we just produced this
looks very similar to our final
objective which is about guessing the
activity of every new portion of signal
I'll remember that in this case this is
known data and in here we're not yet
guessing but only visualizing some
knowledge that is already available now
the real question is what about if we
didn't know what each activity was how
will you possibly work it out based on
numerical analysis of the signal
I think this plot is really quite useful
that is definitely showing that this
acceleration signal does somewhat look
different when it comes from different
activities just by inspecting this plot
visually I think we can already under
find some patterns for example all
activity were the upper part of the body
is rented vertically seemed to have an
offset or average on the value of 10
meters per second squared that's pretty
close to G who is the vertical bar you
utilize around 9.81 meters per second
square so I think it can confidently say
that that's chooser the vertical
component of the gravitational field
that's not exception to that seems to up
and well that's how it is sitting but
then what everybody always set up right
probably depending on how comfortably
you're sitting you may be bending
forward or backwards which explains
lower average values here another
pattern is that the signal coming from
walking activities either plane walking
walking up stairs walking down stairs is
oscillating much more around it so I'll
provide you then for more static
activities in vertical position like
standing or sitting based on those
considerations if we wanted to work
things out for ourselves in some cases
that may be straightforward for example
we could easily distinguish between
laying down and walking by computing the
average of the samples in our buffering
compared to a threshold if it's lower
than say 5 is laying otherwise is one of
the others we could also quantify this
remarkable most more rigorously by
looking at the statistics
of the signal in this case a single
histogram or prove the point the
histogram is showing the number of value
of currencies we're going to fill it set
of intervals in passing let me make a
point of that make it an instrument plot
like this from scratch would require
quite a bit of effort for example one
could have to go through the data for
each data sample finding which interval
the value folds in and increment this to
encounter for that interval instead
underneath this function of mine the
built-in function histogram is doing all
the hard work the rest of the code is
simply arranging the two plots on top of
each other and customizing the
appearance so you know the function
histogram released introducing release
our 2014 B of MATLAB and it provides a
new more efficient way of plotting
instagrams and by the way I also assume
that computing the mean value root mean
squared values standard deviation will
be easy enough because if my up it is if
you are using a different environment or
general purpose programming language
with no mathematical support you may
find evz operations like B's may require
quite a bit of clicking around but at
least fresh memories about basic maths
and starts to call these back from
scratch now come back to similar ways of
easily distinguishing different
activities we could easily separate
things like standing and walking based
on other measurements like for example
standard deviations or RMS as per root
mean squared values at this other
histogram shows but what about if we had
to work out the difference between plain
walking and walking upstairs in this
case this is what we see for the two I
would say that this shows a similar
average value and a similar standard
deviation in this case if you know about
statistics you may be thinking that
things like higher order moments might
gave us more information in that case
you probably want to contain Your
Enthusiasm because from a static
statistical point of view if you look
across the various subjects here you'll
soon realize that these two things are
almost the same so for me the main
takeaway here is that to discriminate
signal like these two data statistical
analysis it's not sufficient and really
what we need to do is to look at how
things vary over time because that would
allows it for example
to measure things like the rate of
oscillation of the secular acceleration
signal this could be useful on the
assumption that people move faster for
example when they will downstairs
compared to when they woke up stairs or
even the shape of the oscillation itself
this would be relevant if we thought
that the type of movement done while
engaging in plain walking is different
from that captured for example when
walking down stairs
to prepare ourselves to analyze
variations over time there's one
important point that needs to be made I
believe we've already established that
we have two main types of causes that
contribute to the acceleration signals
in the data set one is the alignment of
the subject with respect to the
gravitational field and the other is the
energy generated by the body movements
one big difference between the two is
that the gravity contribution is almost
constant if we wanted to be less
assertive we might say that it's
bearings more slowly instead the body
movements are the faster ones when we
focus on how signal vary over time
naturally we'd like to restrict our
attention to the contributions generated
by their body movements because that's
what we're trying to classify then a
very relevant question is is there any
way to separate out of the two
contributions which are now blended
together into a signal signal so that we
could look at analyze each one of them
separately while there are cases where
this task is pretty difficult for a wide
range of practical situations a standard
method is to design and apply linear
digital filters or simply digital
filters for short to the data digital
filters were peculiar well when the
signal components that we want to
isolate or remove are well defined in
terms of the rate of variation over time
or use the more specific jargon by their
so called spectral frequency domain
components in this case for example we
want to keep only the contributions due
to the body movements let's say there's
varying more quickly than about 1
oscillations per second that's about the
number of steps per second and of an
average Walker and we want to discard
contributions with slower variations in
the signal processing jargon this
translates to willing to design and
apply to a data and appropriate
high-pass filter I'll repeat these ideas
as we go through the process now if I
just use a general-purpose language
without specific signal processing
libraries the task of designing and
planning a digital filter will be pre
daunting the design phase in particular
requires quite a bit of maths and a lot
of domain-specific knowledge in MATLAB
there are many different ways in which
one
the chill filter for example you may
choose to do it entirely
programmatically which means only using
MATLAB Commons or alternatively using
built-in apps let's first take a look at
what the latter would look like using an
app is generally great idea when you
approach a problem for the first time to
do that I go to the apps tab of the map
tool trip and I scroll down to the
signal processing and communications
area in here we'll pick the filter
design and analysis tool for more
advanced filter design you'll be able to
want to try the filter builder up the
filter design analysis tool is composed
of several sections for example this
filter specification pane will help us
specify the right requirements for our
filter down here to the left is where we
start to define what we looking to
achieve in this case I'll select high
pass filter you can see that a lot of
our choices are also possible this is
through the standard low pass band pass
band stop filters plus a range of more
advanced designs now further down here
we are asked to choose between F IR NIR
these are the two main big families of
digital filters if you know about
digital filters you'll probably have a
good idea about which of the two to
select and the design methods listed
here will resonate quite a bit here I'll
skip the details and I'll just use this
option then I move over to the right and
I keep capturing my requirements with a
help of specification pane above things
I have to say include we're using a
sampling frequency of 50 Hertz we want
to keep on altered that is we want to
attenuate by a factor of 1 or 0 dB
all signal components oscillating more
quickly than one type per second or 1
Hertz let's actually be slightly more
generous and set this F value to no
point 8 Hertz we also want to make sure
that everything to the left of this
value smaller than F pass called f-stop
is attenuated by at least to give a
number of DBS
I'll set this to say no point for a
correspond
inglis a stop to 60 DB this ensures that
all oscillations slower than 0.4 hers or
times per second will be made a thousand
times smaller by the filter finally by
pressing design we realize a filter that
satisfies our requirements and we have a
set of analysis tools available right
within this app to verify that the
filter is behaving as expected
for example now we're looking at what's
called magnesia response of a frequency
if an it to confirm that this is
honoring the specification I can overlay
a specification mask and zoom in to
check the filter owners are requirements
you can see in 0.4 0.8 or if I want to
understand the transit behavior by
express of a button I can have access to
things like the impulse response or the
step response once my filter is designed
what I really want to do is to apply to
my signal remember that in this case the
objective was to get rid of the slowly
varying contributions suiting the
alignment of my accelerometer with AK
rotational field to use this filter with
a my MATLAB code I can choose between
two types of approaches I can go to file
and explore the filter into my MATLAB
workspace as one or more variables or I
can generate some MATLAB code that
realizes all that I've just done
interactively through a programmatic
approach the code that you see here has
just be generated automatically however
something to notice that I could have
just as well decided to use similar
comments independently on my own and
having this generated automatically for
me can also help me gain some insight so
that the next time around I could more
quickly design a filter programmatically
but more importantly it now gives me a
quick way of realizing the filter from
my code just by using this function call
I'm not going to discard this function
because I have a previously saved
version already available in my work it
folder called HP filter you can see that
this looks just exactly like the one
that we had just generated going back to
my script you
see that I'm creating a filter via via
my pre-saved function using one line of
code and in the next line I'm applying
the filter to my vertical acceleration
that creates a new signal where we hope
to find only the contributions due to
the body movements if I execute the
section
I'm also plotting the new filtered
signal against the original one in the
block we can see that the new signal is
now all centered around zero with no
offset due to gravity you can also see
some transient behavior every time that
new activity kicks in this is totally
normal and that can be quantified in
detail while designing the filter as we
saw a few minutes ago so now we're at a
point where we can really start to
analyze the behavior of the signal over
time let's recap once again what we're
trying to do we're trying to select a
suitable set of measurements that can
capture the differences between signals
generated by different activities in
order to investigate what techniques are
more likely to be effective a helpful
thing to do is to look at individual
activities separately I'd like to show
you a very effective method to select
portions of signals in MATLAB based on
what we call logical indexing when I
look at this plot for example I want to
isolate this portion of signal relative
to walking this information on which
once those samples are restored my
vector art ID here in my workspace
because here we have more than one
instance of every activity we may say
that we only want those samples with
time say less than 250 milliseconds if
we formalize what I've just said in
plain English veterans lays into this
line of code the result here is a vector
of the same length as my signal with
ones in the region of interest in zeros
elsewhere when we use this vector to
index into our signal or the actual time
vector the result is a single portion of
signal that we are interested in now we
can more easily look at this walking
segment in more detail we can zoom in
and confirm that the signal oscillates
fairly regularly roughly speaking what
can say the signal is also periodic now
good
question would be how can I measure how
quickly this is oscillating or even
capture some quantitative description
about the shape of this oscillation and
a good answer would be by transforming
the signal into the frequency domain or
otherwise dead by looking at its
spectral representation for example a
lot of people that I know where this
time we're throw-in the idea of
computing n FFT which is the shorthand
for fast Fourier transform in actual
fact the results delivered by a bear FFT
algorithm taken in isolation will still
be a few steps away from becoming
actually useful more in general here
where you will be looking for is called
spectral density or power spectral
density now do you know how to compute
that from scratch you may do perhaps
based on the availability of an fft
function which comes with the basic
matter of installation but more
generally if you know the name of an
operation or an algorithm that you need
to use then you can search the MATLAB
documentation or this function browser
over here
typing spectral density here brings up a
lot of names of functions that do that
for example here I recognize the name of
a method for special density estimation
that I remember from uni called the
Welch method for some quick guidance on
how to use this function I can hover
over its name and browse this context
guide on the left here where I can
follow the link to the full
documentation here along with a list of
syntaxes available I can also find
explanations about the algorithms used
and links to related pages discussing
technical topics more in general as for
example here our patron spectral
analysis which includes an introduction
to the topic the list of methods
available and a discussion on when each
particular method is more appropriate
now going back to my script just running
this P Welch function on my signal and
specifying the sampling frequency gives
me some insightful results pretty
quickly what is produced is something
like this plot on the x axis I have
frequency from 0 to
for my sampling frequency which was 50
Hertz and on the y-axis I have the power
density in units of DB over Hertz then
the region when the values of this plot
are higher is likely to carry the
information that I'm after in this case
this pattern of peaks between zero and
ten Hertz is holding a lot of measurable
information on the rate and shape of our
time domain oscillations for those of
you who are at least a bit familiar with
signal theory it may be useful to draw a
parallel with signals produced by
musical instruments even if in this case
this is not even a sound signal here you
would talk about a fundamental frequency
roughly around one Hertz and a number of
harmonics at positions multiple of that
frequency the distance in frequency
between these Peaks tells us about the
rate of oscillation of our signals and
the relative amplitudes of the peaks are
closely related to the shape of the
oscillations a bit like what is referred
to as the timbre for musical signals to
validate these statements let me plot
the spectrum from walking on top of the
one for walking up stairs and restrict
the view to the range between zero and
ten Hertz what I notice here is that the
peaks for walking up stairs are closer
together and push to the left telling me
that the rate of oscillation is lower in
this case also the amplitude of the
peaks to the right of the fundamental
increases very quickly telling me that
the shape of the oscillation for walking
up stairs is less abrupt almost smooth
being more similar to a simple slivovitz
signal which is ideally formed of just
one single peak so the positions and
amplitudes of those Peaks carry
descriptive quantitative information
which if measured would constitute good
descriptive features to further convince
myself I could also compare how the
spectrum looks like for all working
signals across the 30 subjects in the
data set which I'm doing here
despite the different scale used here
for the vertical axis and the results in
plot you can see that in fact the
location of the first few peaks and the
relative scaling is fairly similar
across the 30 recordings available
that's the 30 different subjects of my
data set now going back to our spectrum
for the walking signal our aim here is
not simply to inspect this plot visually
but it implies a programmatic mechanism
so that we can automate the process of
taking measurements for every new
portion of signal that the system is
presented with you can think that
extracting this kind of information on
positions and outputs used up of these
Peaks from this plot is easy but if you
tried at least once in your life
probably you realized that it's actually
not as easy as it may initially appear
for example one can quickly get position
and amplitude of the highest peak by
using the MATLAB function max for
maximum value but then moving off from
there is less trivial
luckily the signal processing toolbox
for matlab has a function called fine
peaks that is built to do just that now
if we use this function find Peaks
without providing any other information
but our raw special density then this is
what it returns this is the complete set
of local Peaks found in my plot none of
the rest of code was just taking care of
plotting well this is not yet what we
are exactly looking for if we put some
more effort into defining that for
example telling the function how many
Peaks it should return and what is the
peak prominence that we require or what
is the minimum distance between nearby
Peaks that we expect then the results
are a lot more encouraging and just
using a few lines of code we now have a
programmatic measurement approach that
can be automated and is highly
descriptive of our signal
characteristics the speak measurement
approach that I used here for the
spectral density can also be used for
other types of analysis an example that
I have in mind is the autocorrelation
function which is particularly useful to
estimate fundamental frequencies that
there are very low compared to the
signal sampling frequency I'm just going
to show a quick example of that here
this is how the autocorrelation of our
walking signal would look like the user
correlation is always symmetric with a
high peak in the middle representing the
energy of the signal and for periodic
signals the location of the largest
peaks to the right of the central one
defines the fundamental frequency of the
signal to make my point a bit better let
me overlay the autocorrelation curves
for walking up stairs and walking down
stairs and zoom in around the first peak
to the right these two signals have very
similar frequencies and yet the
respective first peaks can be separated
relatively well being around at least
four sampling periods apart from each
other once again to compute the
autocorrelation I didn't have to
remember any formula and it took me just
one line of code now I could go on
discussing relevant measurements and
strategies to automate them but for the
purpose of this demo we'll stop here
once I've selected a number of
measurements that I think is quite well
the differences between the different
classes of my problem I need to group
that together so that for each new
signal buffer or set of samples I'm able
to produce the collection of all my
measurements or features for that
particular instance the way that I did
it here is that I collected all the
steps that we went through together into
this individual function call features
from buffer M here for every new buffer
or acceleration samples in the three
directions I am applying the filter
computing main and RMS values and then
computing variance and spectral features
using helper functions down here if I go
down here you can recognize X score for
autocorrelation the finepix function
together with a p welch function and in
a similar way of the find Peaks this is
very similar to what we've done together
a few minutes ago plus something that I
haven't discussed in detail in the
interest of time which is simple measure
of how the energy of the oscillation is
distributed across the power spectrum of
my signal
what I really like about this function
is that if I measure the net number of
code lines excluding comments and empty
lines that sums up to only sixty five
lines of code here I'm using this s lock
function available for free from the
matlab central file exchange
so to recap at this point now for every
new signal buffer we have a way to
extract a feature vector containing 66
measurements that characterize the
signal at this point if our problem is
simple enough we may consider putting in
place some custom logic that looks at
the feature vector and according to the
values in there implants a strategy to
guess what the right class of the signal
is that's theoretically possible that
logic might look like if the mean value
is greater than X and the RMS is greater
than Y and the position of the first
peak for example is small instead and
the amplitude of the first peak is
smaller than W then the signal was
produced by walking upstairs say the
reality is that as the complexity of the
problem goes up coming up with such a
manual logic mechanism is highly
impractical plus it does not guarantee
that we take advantage of all the
information in the feature vectors the
way these features really are commonly
used is by means of a classification
algorithm as we said earlier there are
many types of classification algorithms
available out there and more
specifically within MATLAB in this case
I'm using a neural network in one line
of code here I'm creating a network if
you're familiar with neural network you
may like to know that this simple syntax
in this case creates a feed-forward
network with a single internal layer of
18 neurons that techniques to choose
these magic numbers but let's ignore
that for this simple example in this
other line I'm training the network
using a portion of my data set the
training process adapts the internal
parameters of the model in this case the
network so that it can optimally
identify the right activity for the
supplied signal segments remember that
my data set would composed of both the
recordings and the known activity ID
values for each portion of the
recordings to train the network here
we're supplying both
as I trigger the training of the network
you notice that a user interface
appeared this was updating us on the
progress of the training process and it
may be very useful for monitoring the
optimization on complex networks for
which training may take longer in this
case everything happened pretty quickly
my network is now trained to classify a
new signal segments that is never seen
before
I can now run the network on new data
and take a qualitative look at how well
it's doing we have now finally come to
the place where we originally started
for every new signal buffer here we are
plotting three components of the
acceleration computing our successive
features live online and finally using
our trade network to predict what we're
doing because these new signals are
still coming from the data set even if
they are new to our classification
algorithm we still know what activity
they belong to so we can compare our
automated guess to the ground truth
finally to really assess the performance
of the classification algorithm instead
of observing it in action online as
we've just done one would typically let
it classify a new portion of the data
set in batch mode so all at once and
then compute some statistics for example
one common way of summarizing visually
the performance of a classification
algorithm is the confusion matrix which
I'm creating in this code section if we
wanted to take away a single number we
probably look down here to the right and
say that overall our system was close to
92% accurate on the test set more in
general this matrix displaced account
for all the couplings between a given
target class and guesses of the
algorithm with right guesses lying on
the matrix diagonal and the rest of
diagonal for example in this case this
2x2 region over here is showing an
important number of wrong guesses
between sitting and standing if we
wanted to improve the performance of our
algorithm something we could probably
focus on will be to identifying more
features that help better differentiate
these two particular cases okay at this
point let me go back to my slides
if I had to summarize this example our
main objective has been to identify ways
of extracting highly scripted features
from the time domain data or signals my
three main takeaways would be that we're
able to do that entirely by reusing
existing signal processing functions
available out of the box in total we
automated the measurement of sixty-six
features using all these six defined
lines of code and we also took good
advantage of the language and the built
in and visualization features to
establish what worked and what not by
doing that we were able to get to the
bottom of this task pretty quickly about
the last use of built-in functions that
we made something that I'm particularly
keen to remind you is the number of
things that allowed us not to have to
reinvent if I look at the sample
functions that we used then these would
be some of the underlying formula that
we would have needed to dig out from the
web or maybe a textbook or a paper
understand in detail and that code in
MATLAB and the signal processing toolbox
available allowed us to simply save all
that time we also to great advantage of
the neural network toolbox which allowed
us to build and train a conventional
type of neural network in two lines of
code if you ever study neural networks
you may remember that even training
simple networks were basic optimization
algorithm is quite complex error-prone
if done from scratch I've already also
mentioned that neural networks only
represent a particular set of possible
choices for a classification algorithm
for all the other general-purpose
classification algorithms from mave
Bayesian classifiers the support vector
machines a good place to look as the
statistics toolbox statistics toolbox
also covers other machine learning
techniques by clustering or regression
this brings me to the conclusion of this
webinar I hope you enjoyed it and that
if not anything else at least I managed
to give you an idea of the extensive set
of functions for signal processing and
data analysis available with MATLAB and
it's toolboxes I also hope I conveyed
the idea of hive easy visualization
function and built in MATLAB apps can
make complex discovery cycles pretty
quickly after all that was also thanks
the concise MATLAB language which
allowed us to carry out advanced
processing and analysis tasks in just a
few lines of code now if you have
questions at this point please post them
into the Q&A panel
which is indicated by a question mark in
your WebEx panel at the top of the
screen we will take a few minutes to
review them and then come back online to
answer your questions