写了186篇博客,刚好,家里门牌号186,所以在家里停留很久,现在又出发......

看到一篇bpnet好文章,有一种代码实现的冲动,还是先捋一遍,再代码化:

总误差由0.2983降到0.2910,迭代10000次后,输出o1,o2=0.0159,0.984;总误差0.000035085,说明已经收敛到【0.01,0.99】,bpnet学习结束。

我们实现以上过程,进行了简化,少了一个输出,多了两个输入:

为什么步长要取0.5?这个步长在机器学习中(人工智能)实在太重要,后面我们会专门再讨论他。

程序实现后,验证了上面给出的数据是正确的,然后继续改进,就用到mfcc语音数字特征(输入数据改进为5)的识别了,mfcc又进了一步,了却了心事两件,c#代码如下:

最后改进版,针对mfcc语音数字特征13取5:

int   number_feature_vectors = (4096 - 256) / 128 + 1;//这是一个很特殊的值
         int m = 0;
            for (int j = 0; j < 5; j++)//mfcc13个数据只使用前面5个输入足够
            {
               
                int temp = 0;
                for (int i = 0; i < number_feature_vectors; i++)//number_feature_vectors=31
                {               
                    //如果(int)feature_vector1[i][0]>0,为有效特征帧,参与训练
                    if(feature_vector2[i][0]>0)
                    {//取[i][0],[i][1],[i][2],[i][3],[i][4]
                        m++;
                        bpnet改进((float)feature_vector2[i][0],(float)feature_vector2[i][1], (float)feature_vector2[i][2], (float)feature_vector2[i][3], (float)feature_vector2[i][4],

ref  weight1, ref weight2, ref weight3, ref weight4, ref weight5, ref weight6,
                            ref weight7, ref weight8, ref weight9, ref weight10, ref weight11, ref weight12);
                    }
                }
               
            }

void bpnet改进(float input1, float input2, float input3, float input4, float input5, ref float weight1, ref float weight2, ref float weight3, ref float weight4,
           ref float weight5, ref float weight6, ref float weight7, ref float weight8, ref float weight9, ref float weight10, ref float weight11, ref float weight12)
        {//再改进留给数组或list<float>吧
            float i1 = input1;
            float i2 = input2;
            float w1 = weight1;
            float w2 = weight2;
            float w3 = weight3;
            float w4 = weight4;
            float w5 = weight5;
            float w6 = weight6;
            float b1 = 0.35f;
            float b2 = 0.6f;
            double neth1 = 0;
            double neth2 = 0;
            double outh1 = 0;
            double outh2 = 0;
            //增加输入i3,i4和权值w7,w8,w9,w10          
            float i3 = input3;
            float i4 = input4;
            float i5 = input5;
            float w7 = weight7;
            float w8 = weight8;
            float w9 = weight9;
            float w10 = weight10;
            float w11 = weight11;
            float w12 = weight12;
            neth1 = w1 * i1 + w2 * i2 + w7 * i3 + w8 * i4 + w11 * i5+ b1 * 1;
            neth2 = w3 * i1 + w4 * i2 + w9 * i3 + w10 * i4 + w12 * i5 + b1 * 1;
            outh1 = 1 / (1 + Math.Exp(-neth1));
            outh2 = 1 / (1 + Math.Exp(-neth2));
            //hide->out
            double netho1 = outh1 * w5 + outh2 * w6 + b2 * 1;
            double outho1 = 1 / (1 + Math.Exp(-netho1));
            //error
            double etotal = 0;
            double EO = 0.85;//逼近1,但不等于1
            etotal = 0.5 * (EO - outho1) * (EO - outho1);//总误差小于0.00001时认为学习ok,退出,权值学习成功,以后直接使用。
            textBox总误差.Text = etotal.ToString();
            if (etotal < 0.00001) { return; }
            //w5 update
            double 吆西 = -(EO - outho1) * outho1 * (1 - outho1);
            double 吆西1 = outh1 * (1 - outh1);
            double 吆西2 = outh2 * (1 - outh2);
            double etotal对于w5的偏导 = 吆西 * outh1;
            double w5update = w5 - 0.5 * etotal对于w5的偏导;
            weight5 = (float)w5update;
            //w6 update
            double etotal对于w6的偏导 = 吆西 * outh2;
            double w6update = w6 - 0.5 * etotal对于w6的偏导;
            weight6 = (float)w6update;
            //w1 update
            double etotal对于w1的偏导 = 吆西 * w5 * 吆西1 * i1;
            double w1update = w1 - 0.5 * etotal对于w1的偏导;
            weight1 = (float)w1update;
            //w2 update
            double etotal对于w2的偏导 = 吆西 * w5 * 吆西1 * i2;
            double w2update = w2 - 0.5 * etotal对于w2的偏导;
            weight2 = (float)w2update;
            //w7 update
            double etotal对于w7的偏导 = 吆西 * w5 * 吆西1 * i3;
            double w7update = w7 - 0.5 * etotal对于w7的偏导;
            weight7 = (float)w7update;
            //w8 update
            double etotal对于w8的偏导 = 吆西 * w5 * 吆西1 * i4;
            double w8update = w8 - 0.5 * etotal对于w8的偏导;
            weight8 = (float)w8update;
            //w11update
            double etotal对于w11的偏导 = 吆西 * w5 * 吆西1 * i5;
            double w11update = w11 - 0.5 * etotal对于w11的偏导;
            weight11 = (float)w11update;
            //w3 update
            double etotal对于w3的偏导 = 吆西 * w6 * 吆西2 * i1;
            double w3update = w3 - 0.5 * etotal对于w3的偏导;
            weight3 = (float)w3update;
            //w4 update
            double etotal对于w4的偏导 = 吆西 * w6 * 吆西2 * i2;
            double w4update = w4 - 0.5 * etotal对于w4的偏导;
            weight4 = (float)w4update;
            //w9 update
            double etotal对于w9的偏导 = 吆西 * w6 * 吆西2 * i3;
            double w9update = w9 - 0.5 * etotal对于w9的偏导;
            weight9 = (float)w9update;
            //w10 update
            double etotal对于w10的偏导 = 吆西 * w6 * 吆西2 * i4;
            double w10update = w10 - 0.5 * etotal对于w10的偏导;
            weight10 = (float)w10update;
            //w12 update
            double etotal对于w12的偏导 = 吆西 * w6 * 吆西2 * i5;
            double w12update = w10 - 0.5 * etotal对于w12的偏导;
            weight12 = (float)w12update;
        }

敲开bp神经网络之门(二,mfcc中使用,c#)相关推荐

  1. 敲开bp神经网络之门(三,机器视觉斑点blob匹配中使用)

    前面我们神经网络在mfcc语音识别中,小试牛刀,再没什么进展,主要还停留在理论理解透彻而已,近期在blob匹配相似度对比中实战,发现问题还不少. 1,没有对截距b更新 启用截距迭代的好处,参数收敛变快 ...

  2. 遗传算法优化BP神经网络在非线性函数拟合中的应用

    遗传算法优化BP神经网络在非线性函数拟合中的应用 在工程应用中经常会遇到一些复杂的非线性系统,这些系统状态方程复杂,难以用数学方法精确建模.在这种情况下,可以建立BP神经网络表达这些非线性系统.通常B ...

  3. 机器学习 | MATLAB实现BP神经网络newff参数设定(中)

    机器学习 | MATLAB实现BP神经网络newff参数设定(中) 目录 机器学习 | MATLAB实现BP神经网络newff参数设定(中) 基本介绍 程序设计 参考资料 致谢 基本介绍 newff搭 ...

  4. matlab耀输,基于 Matlab的BP神经网络在太阳耀斑级别预测中的应用

    第 42卷 第 3期 2014年 5月 河南师范大学学报(自然科学版) Journal of Henan Normal University(Natural Science Edition) Z.42 ...

  5. 【图像处理】——Python实现图像特征提取BP神经网络实现图像二分类

    目录 一.图像特征提取 二.BP实现图像二分类 1.输入层.隐层.输出层结点个数设置 (1)one hot码(假设是n分类问题) (2)一个输出,输出层结点为1 一.图像特征提取 图像具有灰度特征.G ...

  6. BP神经网络原理及在Matlab中的应用

    一.人工神经网络 关于对神经网络的介绍和应用,请看如下文章 ​ 神经网络潜讲 ​ 如何简单形象又有趣地讲解神经网络是什么 二.人工神经网络分类 按照连接方式--前向神经网络.反馈(递归)神经网络 按照 ...

  7. 基于Matlab的遗传算法优化BP神经网络在非线性函数拟合中的应用

    本微信图文详细介绍了遗传算法优化BP神经网络初始权值阈值的过程,并通过实例说明该优化能够提升BP神经网络的预测精确程度.

  8. 基于Matlab的多层BP神经网络在非线性函数拟合中的应用

    本图文详细介绍了如何利用Matlab神经网络工具箱实现多层BP神经网络对非线性函数的拟合.

  9. 基于Matlab的BP神经网络在非线性函数拟合中的应用

    本图文详细介绍了如何利用Matlab神经网络工具箱实现BP神经网络对非线性函数的拟合.

最新文章

  1. SSH 组建轻量级架构 附录 -- 遇到的问题和解答
  2. 「天才少年」稚晖君调戏机械臂!加上AI视觉,2小时学会抓螺母
  3. nginx php post限制,叫你如何修改Nginx与PHP的文件上传大小限制
  4. Columns Controller
  5. 变换编码(DCT)基本理解
  6. client-go workqueue demo
  7. DPCM 压缩系统的实现和分析
  8. 出生日期,看出你的天赋
  9. 二等水准数据平差_二等水准复测平差成果表
  10. Windows、Linux、macOS 爆严重安全漏洞!
  11. 有道口语大师APP评测:语音识别准确度低
  12. java utility工具类怎么导入_Utility.java
  13. 多Tabs的横向滚动插件(支持Zepto和jQuery)
  14. win10monkey安装教程_详解win10下pytorch-gpu安装以及CUDA详细安装过程
  15. java代码控制开关
  16. 信号时域频域特征公式
  17. 子、辰、卯、酉、午、辰时是几点到几点钟「知识普及」
  18. 来,带你看看京东“硬核”科技!
  19. Authing | 如何打造一个高效的分布式研发团队
  20. BUUCTF:[BJDCTF 2nd]假猪套天下第一

热门文章

  1. Ubuntu16.04 Modelsim 10.2c安装
  2. 失恋CPR 自救手册
  3. uni-app 实现手写签名
  4. 倪海厦天纪笔记16_倪海厦《天纪》——人间道听课笔记
  5. AI绘画是什么软件?看完你就知道了
  6. hannoi塔(汉诺塔)移动过程解析
  7. 新生儿登记-申办报告
  8. C语言进阶第23式:#error和#line的使用分析
  9. C语言——笨方法找“水仙花数”,步步分析
  10. Zimbra部署https证书的操作方法