justd0 发表于 2020-5-2 10:00

【LSM6DSOX的MLC机器学习理解】--机器学习使用教程分享

本帖最后由 justd0 于 2020-5-2 13:20 编辑

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;"><a href="https://bbs.eeworld.com.cn/thread-1120838-1-1.html" target="_blank">【LSM6DSOX的MLC机器学习理解】--机器学习简介</a>中简单介绍了机器学习模块的特点和大致的实现流程。上个帖中我简单介绍了下</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">LSM6DSOX</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">机器学习功能实现需要用</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">有监督学习方法</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,即人为采集动作数据样本,人为标注动作类别,统计出不同类别间的数据差异,构建成决策树来实现。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">本贴将结合</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">U</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">nico</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">介绍如何实际使用</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">MLC</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">模块。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">希望能够抛砖引玉帮到大家,由于自己也是仅仅摸索出了它的使用方法,而其功能之强大未完全掌握,在讲解有误的地方请各位指正~</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">在使用</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">MLC</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">机器学习模块之前,我们需要明确要识别的类别都是什么。这里,我用</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">静坐(</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">stationary</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">)</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">和</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">起身(</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">standup</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">)</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">两个动作举例。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">有监督学习第一步就是要<strong>构建数据集</strong>。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">在</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">U</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">nico</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的界面中,根据我们动作设定好所需要的</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">传感器量程</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">和</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">采样频率</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">。静坐和起身两个动作相对来将不需要很高的量程范围和采样频率,所以就以默认的参数来配置,如下图所示:</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">配置好参数后,<span lang="zh-CN" style="font-weight:bold">点击</span><span lang="en-US" style="font-weight:bold">start</span>,传感器便开始工作,这是我们点击<span lang="en-US" style="font-weight:bold">Load/Save</span>标签页。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">可以看到其中有个</span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">S</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">aveData</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的分块布局,点击</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">Browser</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">按钮选择你要保存文件的路径和</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">文件名</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">按照MLC的说明文档,我们<span lang="zh-CN" style="font-weight:bold">仅</span>需要<span lang="zh-CN" style="font-weight:bold">加速度计的</span><span lang="en-US" style="font-weight:bold">Acceleration</span>和<span lang="zh-CN" style="font-weight:bold">角速度计的</span><span lang="en-US" style="font-weight:bold">Angular Rate</span>数据,所以其他的选项<span lang="zh-CN" style="font-weight:bold">全都取消掉</span>,如下图所示。</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Times New Roman&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">配置好后呢我们就可以开始采集数据了,按照</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">U</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">nico</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">上</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">MLC</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的使用</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">.pdf</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">中第</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">10</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">页中所述:&ldquo;注意:</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">正确地启动和停止</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">数据日志记录是很重要的,这样才能在日志文件中获得所需的类(例如,当要记录某个移动时,必须在</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">单击【Start】之前启动该移动,在移动停止之前必须按下【Stop】</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">)&rdquo;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">这就很难受了,此例子中的静坐和起立两个动作都比较缓慢,所以直接按照上面的操作来,还是可以接受。但是一旦</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">动作速度很快</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,比如我即将要做的</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">羽毛球挥拍</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的动作识别,要实现上面的过程,画面可以想象(一手拿球,一手拿拍子,一手要点鼠标</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">&hellip;</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">)</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">而且,要想训练的准确,需要</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">很多数据集</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,而根据测试,</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">Unico</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">MLC</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">模块需要每个数据集放在一个</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">TXT</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">文件中。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">上述保存数据的过程,点击start和stop之后,会将数据保存在所设置的data.txt文件中,再次采集数据时,数据会叠加在这个文件中的后面,到时候我们还需要一个个分割出来。。。要么就采集一次,输入一个新的保存文件名。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">这操作兼职堪称反人类了。。我这样采集几百个数据肯定要疯了</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">&hellip;</span></span></p>

<p lang="en-US"><span style="font-size:14.0pt"><span style="font-family:&quot;Times New Roman&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">于是乎,我花了一天的时间,写了个</span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;"><span style="color:#fa0000">MLC</span></span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;"><span style="color:#fa0000">数据修正工具</span></span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;"><span style="color:#fa0000">修补了这个缺陷,详细使用方法可以参考</span></span></span><a href="https://bbs.eeworld.com.cn/thread-1120853-1-1.html" target="_blank"><span style="font-size:20px;">【LSM6DSOX的MLC机器学习理解】--训练数据集修正小工具</span></a></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">根据帖子里讲的,我们只需要在采集某个动作类别时,提前点击start,动作结束后stop,然后再次进行该动作,重复上述即可,最后保存的文件可以通过小工具处理成需要的格式~~。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">有了上面的这个小工具,我们就可以很轻松的采集数据了。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">通过多次start和stop,采集<span lang="zh-CN" style="font-weight:bold">静坐</span>数据,保存到stationary_data.txt中。多次strat和stop,采集<span lang="zh-CN" style="font-weight:bold">起身</span>数据,保存到standup_data.txt中。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">最后可以得到这两个数据集文件,如下图所示:</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">其中的数据格式如下图所示,点开查看大图,如果<span style="font-weight:bold">保存的类型不一致</span>,请检查上述保存选项是否<span style="font-weight:bold">只选择了红框中的两项</span>哦。</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">用</span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;"><span style="color:#fa0000">MLC</span></span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;"><span style="color:#fa0000">数据修正工具</span></span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">可以轻松得到静坐数据集和起身数据集,如下图所示:</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Times New Roman&quot;">&nbsp;</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">然后我们就可以通过</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">U</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">nico</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">MLC</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">模块来处理数据集了</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">打开</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">MLC</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">模块,依次导入数据集文件,如下图所示</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">依次导入完所有动作类型的数据集后,点击configuration,开始生成训练文件。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">按照需要的配置一步步的向下进行,</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">在设置到窗口宽度参数时,我们需要根据动作的周期来决定,滤波器也还没太会用,就都先用默认值了,之后再仔细研究下。</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">如上图所示,底部需要我们选择</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">F</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">eatures</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,动作的特征,即我们根据传感器的那些值来判断,实现决策树的分类,特征具体有哪些可以参考上一篇帖子</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">的简介</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">我又写了个</span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;"><span style="color:#fa0000">MLC</span></span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;"><span style="color:#fa0000">数据显示工具</span></span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,专门看修正后数据的各种参数使用,具体使用说明可以</span></span><a href="https://bbs.eeworld.com.cn/thread-1120854-1-1.html" target="_blank"><span style="font-size:20px;">【LSM6DSOX的MLC机器学习理解】--训练数据集显示小工具</span></a><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;"><span style="color:#fa0000">。</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">想要看自己采集数据的各种特征呢,便可通过</span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;"><span style="color:#fa0000">MLC</span></span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;"><span style="color:#fa0000">数据显示工具</span></span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">显示</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">所有特征值,我把能计算的量都算了出来,可以对数据有个直观的参考</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">~~</span></span></p>

<p></p>

<p lang="en-US"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">这里呢,由于静坐和起身两个动作的角速度值具有很明显的差异,于是我就暴力的选择了所有角速度的均值、方差、能量和峰峰值,最后保存</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">ARFF</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">文件,如下图</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">这里需要注意,在填写了arff file,需要<span lang="zh-CN" style="font-weight:bold">点击</span><span lang="en-US" style="font-weight:bold">next</span>之后才会保存文件。保存了之后,unico就暂时先不使用了,但也<span lang="zh-CN" style="font-weight:bold">别关</span>。后面需要用。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">接下来需要用到的是机器学习工具,这里我就用官方文档中推荐的</span><span lang="zh-CN" style="font-family:&quot;Times New Roman&quot;">Weka</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">来举例介绍</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">~</span></span></p>

<p lang="en-US"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">用</span><span lang="zh-CN" style="font-family:&quot;Times New Roman&quot;">Weka</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">打开生成的</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">action.arff</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">文件,可以看到如下界面。</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">由于静坐和起身这连个动作的上述指标差异都很大,所以可以看到class项两个类别的数值还是有一定差异的,所以我们可以直接生成决策树。如果动作复杂,则需要针对性的选择不同的轴的不同统计特征来进行判断哦。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">点击classify界面,点击choose,在trees下选择<span lang="en-US" style="font-weight:bold">J48</span><span lang="zh-CN" style="font-weight:bold">二叉树分类</span>方法。</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">然后点击start,即可得到学习结果了,如下图所示。</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Times New Roman&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">我们将上面决策树部分信息复制到一个txt文件中,如下图</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">然后在仍打开的</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">U</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">nico</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">MLC</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">界面下导入决策树,如下图</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;"><span lang="en-US" style="font-weight:bold">Meta-classifier</span>是<span lang="zh-CN" style="font-weight:bold">元分类器</span>,可以对决策树的结果进行进一步滤波,我这里就默认不设置了,可以根据实际需要进行设置,于是我们就可以将机器学习的配置文件导出来了,如图中的<span lang="en-US" style="font-weight:bold">.ucf</span>文件:</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Times New Roman&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">最后通过</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">U</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">nico</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">load/save</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">界面中导入配置,即可将机器学习配置导入进来啦</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">~</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Times New Roman&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">加载完成后,我们可以在</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">D</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">ata</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">界面看到决策树的数据结果,下图是静坐时,决策树</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">1 </span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的数据为</span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">0</span></span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">.</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">当我带着传感器起身后,决策树输出会变成前面设置的 <span lang="en-US" style="font-weight:bold">4</span>,如下图所示</span></span></p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Times New Roman&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">但由于我没有做任何滤波,所以结果很容易被触发成起身的动作,增加滤波器之后应该会好很多了。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">LSM6DSOX的</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">MLC</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">机器学习模块的的使用流程分享大致就这样了</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">~</span></span></p>

<p lang="en-US"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">当然它还可以结合FSM有限状态机,组成包含更复杂逻辑的运动判断功能,待后面玩顺了再分享了~</span></span></p>

<p>&nbsp;</p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">本文中我收集的数据集已经添加为附件,里面有10个起身动作和9个静坐动作的原始数据,各位如果有兴趣可以下载试试~</span></span></p>

<p>&nbsp;</p>

<p><br />
</p>

<p>处理好的数据集我放到底下啦,各位回复下即可下载食用~<br />
**** Hidden Message *****<br />
&nbsp;</p>

poponianhua 发表于 2020-5-2 22:56

<p>学习,学习。厉害了!</p>

jcwangzi 发表于 2020-5-8 16:03

<p>GOOD DATA</p>

传媒学子 发表于 2020-5-24 22:15

<p>厉害了,我还没搞清楚MLC的具体内容, 先参考参考</p>

zhangpeng2 发表于 2020-12-14 17:52

<p>好文章</p>

xiangbudao 发表于 2023-7-28 11:25

学习,学习。

yplwrt 发表于 2023-11-7 11:16

<p>11</p>

龙城飞将001 发表于 2024-3-9 20:24

<p>大佬太强了</p>

sage11 发表于 2024-5-5 22:20

<p>1</p>

<p>&nbsp;</p>

<p>&nbsp;</p>
页: [1]
查看完整版本: 【LSM6DSOX的MLC机器学习理解】--机器学习使用教程分享