These files contain all the code necessary to run the example in the Webinar "Signal Processing for Machine Learning in MATLAB". They also include code to automate the download and preparation of the dataset used.
In that webinar we presented an example of a classification system able to identify the physical activity that a human subject is engaged in, solely based on the accelerometer signals generated by his or her smartphone.
We used consolidated signal processing methods to extract a fairly small number of highly-descriptive features, and finally trained a small Neural Network to map the feature vectors into the 6 different activity classes of a pre-recorded dataset.
The topics discussed include:
* Signal manipulation and visualisation
* Design and application of digital filters
* Frequency-domain analysis
* Automatic peak detection
* Feature extraction from signals
* Train and test of simple Neural Networks
Gabriele Bunkheila (2021). Code for Webinar "Signal Processing for Machine Learning" (https://www.mathworks.com/matlabcentral/fileexchange/49893-code-for-webinar-signal-processing-for-machine-learning), MATLAB Central File Exchange. Retrieved .
Thank you for the great webinar. I was wondering if you can elaborate on how you buffered the data to get the BufferedAccelerations matrix. In particular, how did you get the 10299x128 matrix from the raw acceleration data? It appears to me that column 1 of atx,aty or atz variables is the downsampled, appended data from all subjects. What is the data in the other columns? I presume the periods of "walking", "standing" etc all have different durations, so I am bit puzzled by how neatly they all fit the "actid" label. Perhaps I've misunderstood the data structure so any help would be appreciated. Thank you
I'm trying to classify my own dataset with this toolbox. I collected my own measurements with Myo armband and organized them according DataPreparation.m and PrepareData.m functions. I have 5 different classes of arm movements (drinking water, eating, moving glass, opening drawer and scratching). When I was labeling the data I used column vectors with a) 32 samples, b) 64 samples. I had 20 subjects and more than 50 labels per different kind of movement/ per subject.
I used the highpass filter from the toolbox and I calculated features with extractAllFeatures.m. I used ffd neural network with 18 neurons in hidden layer.
In both cases I got confusion matrix with clasiification accuracy of slightly over 50%.
Why I don't get better clasiification accuracy when the dataset is twice bigger (column vector of 64 samples compared with column vector of 32 samples)?
Should I make changes in calculation of features and in which direction?
Hi Ross - That is the folder where you should download the dataset used by this projects. Please refer to the instructions captured in the code comments of the script DataPreparation.m
Hi Gabriele, do I have to create my own /Data/Original file or is it located somewhere? I can't find this location and when I make my own file the program gets stuck unzipping the files. Thank you.
Thank you for posting. Have you tried doing what the error message suggests? Please take a look at the instructions inside DataPreparation.m and run that script first once you are all set. Feel free to contact me via my MATLAB Central profile if this issue is still current. I have limited bandwidth (and I likely I won't be able to respond timely during August) but I'll do my best to help.
Hi Gabriel, I would like to use exactly the same method of yours，but,it is have this promble:
Data file BufferedAccelerations.mat not found，
Data file RecordedAccelerationsBySubject.mat not found
Some prepared data is not yet available. Please run DataPreparation.m first
could your help me ?
Hi Gabriel, I would like to use exactly the same method of yours, but to recognise simultaneously different parts of the signal. In other words, I want to train the Machine Learning to recognise all patterns, and when I want to test it, I would like to give the whole signal (with all the activities back to back), and I want my machine to tell me where is each activity located and for how long does it last. Looking forward to hearing from you
There are 6 classes for the model. How many channels are there please?
On subid - The subid array (used in some of the helper functions) contains the ID number of the subject (between 1-30) performing the activities recorded. I used the subject ID to quickly partition the original dataset into training and test
On findpeaks and xcorr - I use minprom and mindist to ensure the output of findpeaks is what is expected. With fewer constraints, findpeaks may return "intermediate" local peaks of the autocorrelation output that are not the desired ones. It would be easy to overlook such behavior while extracting features from the whole dataset. In general, similar errors could potentially lead to extracting bad features and to compromising the whole classification task.
hey great job! how can i change the input data to some other spektrum?
Hey ! I ahve two questions : what is the subid matrix ? and when calculating the autocorrelation feature, do we really need the minprom and the mindist ? can we not just use the peaks of the xcorr function as it is ?
Hi Sirinthip, I have limited bandwidth but I am otherwise happy to help. Would you like to send you detailed question directly to firstname.lastname@example.org? Thanks
Hi I have some issues with Adam - Can anyone help to sort this out?
By the looks of your description, you may find some related guidance in the code comments of DataPreparation.m, probably the second script section. Make sure you complete the download of the dataset .zip archive and copy it in the folder .\Data\Original before executing section #3 of the script.
I hope this helps. Thanks,
When I run the file: DataPreparation.m I got this error,
Error using textscan
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in importAccelerationComponentFile (line 162)
dataArray = textscan(fileID, formatSpec, endRow(1)-startRow(1)+1, 'Delimiter',
delimiter, 'MultipleDelimsAsOne', true, 'EmptyValue' ,NaN,'HeaderLines',
startRow(1)-1, 'ReturnOnError', false);
Error in prepareData (line 58)
ax_train = importAccelerationComponentFile(fullfile(sourceTrainDataPath,'Inertial
Error in DataPreparation (line 43)
Please can anyone help me to sort it out?
In case you have not solved this yet, I suspect it is a simple case of the relevant folder not having being added to the MATLAB path. Please read read-me.txt file in the main folder and follow the setup steps in there.
The data file TrainedNetwork.mat is in the folder .\Data\Prepared
Error in runTrainedNetworkOnBufferedData (line 11)
sn = load('TrainedNetwork.mat','net');
Error in DemoMain (line 48)
can anyown pls help me with this issue. I don't have file name 'TrainedNetwork.mat'
Thanks for your effort.
There is a function named "createUnbufferedData" in "PrepareData.m" which is missing!! Do you have this function to include in the zip file or email me at email@example.com
Amazing job! thanks!
Thanks!It runs without any problem in matlab 2015a
Thanks for posting a question. It looks like something went wrong with your plot update. A possible explanation is that you are using a MATLAB version older than R2014b, so you are still running the legacy MATLAB graphics system.
The code needs a more recent release to run also in other places, so I strongly suggest updating to the latest release.
Alternatively you can sove this specific issue by replacing all dot assignments to the graphic handles (such as h(1).YData = g*ax';) with the equivalent set statement (e.g. set(h(1),'YData', g*ax');).
I hope this helps. If you run into other similar issues you can also contact MathWorks' Technical Support help desk and I am sure they'll be happy to help.
Structure assignment to non-structure object.
Hi, having an error like this for plot buffer, any know reason?
Error in runTrainedNetworkOnBufferedData/plotBuffer (line 61)
h(1).YData = g*ax';
Error in runTrainedNetworkOnBufferedData (line 42)
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!