Organising data for machine learning using buffer function

Hi,
I have some accelerometer data for various activities (standing, sitting, walking, walking upstairs, walking downstairs, laying), each activity coded by a number e.g. standing is 5 (see attached mat file - actid is the activity label and totalacc the accelerometer data). I’m looking to use the acc data to train a machine learning model to automatically identify the various postures/activities from accelerometer data.
To do so, I need to reorganise my accelerometer data into shorter buffers (50 samples long) of fixed length, for each posture/activity label. I have tried to use the buffer function but because the activities are all different sizes, I get zeros at the end (see "output_standing" variable in attached file as an example).
Is there a way to interpolate the data to replace my zeros with actual values? I tried the interp1 function but get NaN values - I think this is because it's the end of the signal, and ends in zeros.
Any help would be most appreciated!
Thanks!

 採用された回答

Star Strider
Star Strider 2020 年 5 月 30 日

0 投票

There may be more efficient ways to create specific features for classification. See: Introduction to Feature Selection for a number of examples.
In any event, MATLAB has a number of feature selection algorithms that can make this easier and more reliable. (I have very limited experience with these functions, since they did not exist when I was doing classification, and I only looked through them out of curiosity.)

4 件のコメント

Impala
Impala 2020 年 6 月 1 日
Many thanks for this - I will look into the link you've sent.
But just wanted to know, generally - is there a way to use the interp1 function when interpolating the last few points of a signal, rather than inbetween? The last point having a value of zero (like in output-standing in the attached mat file)?
Thanks once again!
Star Strider
Star Strider 2020 年 6 月 1 日
My pleasure!
If I understand what you want to do, you can ’fill’ non-existent data by extrapolating it. This is not generally a good idea, however it may work for a few samples. See: Extrapolation Using Two Different Methods for an illustration.
Impala
Impala 2020 年 6 月 3 日
This is great! Thanks very much :) very helpful!
Star Strider
Star Strider 2020 年 6 月 3 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

リリース

R2019b

質問済み:

2020 年 5 月 30 日

コメント済み:

2020 年 6 月 3 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by