tl;dr
--I made a muscle training estimation app --Qore uses an algorithm called reservoir computing --Performed a task of classifying time series data from acceleration data that can be acquired with a smartphone. -Code --The accuracy is pretty good --Test data, accuracy 99.6% ――You should be a muscle engineer with this
--Collect accelerometer data on your smartphone (iphone) --You can get time series data with 3 components of x, y, z axis --Learning with 4 types of muscle training: push-ups, abs, squats, and abs rollers ――You can see what kind of muscle training you did with just your smartphone
--Muscle training with your smartphone in your pants pocket ――This time, put your smartphone in the pocket in the same direction for all muscle training. ――It seems that it will be more difficult to estimate if you turn it in a different direction. --I used the following app to measure acceleration. -["Acceleration / Gyroscope / Magnetic Sensor Logger"](https://apps.apple.com/jp/app/%E5%8A%A0%E9%80%9F%E5%BA%A6-%E3% 82% B8% E3% 83% A3% E3% 82% A4% E3% 83% AD% E3% 82% B9% E3% 82% B3% E3% 83% BC% E3% 83% 97-% E7% A3 % 81% E5% 8A% 9B% E3% 82% BB% E3% 83% B3% E3% 82% B5% E3% 83% BC% E3% 83% AD% E3% 82% AC% E3% 83% BC / id448070865) --Measurement interval is 0.1 sec --Number of muscle trainings performed --Push-ups: 21 times (~ 35 sec) --Abs: 20 times (~ 66 sec) --Squat: 20 times (~ 51 sec) --Abdominal muscle roller (sitting roller): 12 times (~ 50 sec) ――In order to increase the amount of data, you have to do more muscle training ――You should be able to become macho someday
――The following is the raw data of the acceleration that was actually measured.
--Abs
--Squat
--Abdominal muscle roller (sitting roller)
――It's periodic, and I got more beautiful data than I expected.
--I tried using qore_sdk.utils provided by Qore SDK.
--For learning and reasoning, [Sample Code](https://github.com/qcore-info/advent-calendar-2019/blob/master/Qore%E3%82%B5%E3%83%B3%E3%83 % 97% E3% 83% AB1_with_UCI.ipynb) exactly the same --Set up your account information below
client = WebQoreClient(username=username,
password=password,
endpoint=endpoint)
--Learn below
res = client.classifier_train(X=X_train, Y=y_train)
print(res)
# {'res': 'ok', 'train_time': 7.2200915813446045}
――Learning was completed in about 7.2 seconds --Quite early --Test (inference)
res = client.classifier_test(X=X_test, Y=y_test)
print(res)
{'accuracy': 0.9964285714285714, 'f1': 0.9964301018846474, 'res': 'ok'}
--Accuracy is 0.9964
--This is also the sample code --Linear regression --Learning time: 0.28547000885009766 \ [sec ] --Accuracy: 0.9964285714285714
--SDK was simple and easy to use ――The accuracy was high, but linear regression and MLP also gave sufficient accuracy. --The problem may have been too easy --I want to try a more difficult estimation task --I would like to verify what happens if I use qore_sdk.featurizer that I could not try this time (time) if there is)
The following article (1st day of Advent calendar) has a brief explanation.
[World of Reservoir Computing ~ With Qore ~ --Qiita](https://qiita.com/ryoppippi/items/f607c8828238094eade0#qore%E3%81%AB%E3%81%A4%E3%81%84%E3% 81% A6)
It is an application of reservoir computing with some modifications.
Achieve a highly accurate model even with a small reservoir size by developing original mechanisms for pretreatment and posttreatment as well as inside the reservoir.
It seems that.
Does it seem to be based on the following paper? Van der Sande, Guy & Brunner, Daniel & Soriano, Miguel. (2017). Advances in photonic reservoir computing. Nanophotonics. 6. 561-576. 10.1515/nanoph-2016-0132.
I want to read it when I have time.
The jupyter notebook has been published in the following repository. See the README and notebook scripts for instructions.
GitHub - hnishi/muscle_QoreSDK_AdvCal2019
--classification Classification task
――I wanted to use the full functionality of the Qure SDK. ――I want you to be able to detect change points and anomalies.
QoreSDK doc QoreSDK 0.1.0 documentation
Feature extraction is performed by frequency decomposition so that the number of classes is 40.
n_filters = 40
featurizer = Featurizer(n_filters)
X = featurizer.featurize(X, axis=2)
QoreSDK accuracy for test data is below
acc= 1.0 f1= 1.0 elapsed_time:52.20956110954285[sec]
The result is an accuracy of 1.
On the contrary, logistic regression and MLP are less accurate than before using Featurizer.
===LogisticRegression(Using Sklearn)===
elapsed_time:0.2480778694152832[sec]
acc= 0.6291666666666667
f1= 0.630372638509498
===MLP(Using Sklearn)===
elapsed_time:8.673331499099731[sec]
acc= 0.95
f1= 0.9502859082452324
Added the non-muscle training state to the classification task class. (Data was collected as a control while preparing lunch.) Again, the accuracy was 1.
Click here for the notebook used for the work. https://github.com/hnishi/muscle_QoreSDK_AdvCal2019/blob/master/muscle_QoreSDK_v2.ipynb
Create a data set different from the one used at the time of learning with the abdominal muscle roller. Inference was made using this data.
Click here for the notebook used for the work. https://github.com/hnishi/muscle_QoreSDK_AdvCal2019/blob/master/muscle_QoreSDK_v2.ipynb
As a result, the accuracy for this verification data is as follows
With the QoreSDK, the correct answer rate was about 70%. In order to improve the accuracy, it seems necessary to expand and learn various patterns of learning data for each item of muscle training.
Recommended Posts