欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    人工智能应用技术实验报告人工神经网络程序设计.docx

    • 资源ID:7516606       资源大小:53.65KB        全文页数:15页
    • 资源格式: DOCX        下载积分:3金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录
    二维码
    微信扫一扫登录
    下载资源需要3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,免费下载
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    人工智能应用技术实验报告人工神经网络程序设计.docx

    1、人工智能应用技术实验报告人工神经网络程序设计实 验 报 告课程名称 人工智能应用技术 实验项目 人工神经网络程序设计 实验仪器 WindowsXP、Visual C+ 学 院 信息管理学院 专 业 信息安全 班级/学号 信安1401 学生姓名 Cony 实验日期 2016-5-10 成 绩 指导教师 赵 刚 北京信息科技大学信息管理学院(课程上机)实验报告实验课程名称:人工智能应用技术 专业: 信息安全 班级: 学号: 姓名: 实验名称人工神经网络程序设计实验地点学院机房实验时间5/10 14节1. 实验目的: 掌握基本神经网络的常用学习规则 掌握人工神经网络的训练过程2. 实验内容: 相关知

    2、识:基本神经网络(感知器,前馈网络)的常用学习规则 实验环境:Windows XP, Visual studio 主要内容:人工神经网络的程序设计与实现3. 实验要求: 完成神经网络学习程序的调试,课堂演示程序执行结果 输出神经网络权值调整过程值,分析结果数据,绘制神经网络 提交实验报告4. 实验准备:掌握感知器学习算法1 初始化:将权值向量赋予随机值,t=0(迭代次数)2 连接权的修正:对每个输入样本xk及期望输出dk完成如下计算a. 计算网络输出:y = f(S),其中S =wixi,f为激活函数b. 计算输出层单元期望输出dk与实际输出y间的误差: ek = dk - yc. 若ek为零

    3、,则说明当前样本输出正确,不必更新权值,否则更新权值: w(t+1) = w(t) + ek xk t = t + 1 01为学习率。3 对所有的输入样本重复步骤(2),直到所有的样本输出正确为止5. 实验过程:#include #include stdafx.h#define MAX_ITERATIONS 1000#define INPUT_NEURONS 2#define NUM_WEIGHTS (INPUT_NEURONS+1)#define ALPHA (double)0.2double weightsNUM_WEIGHTS;typedef struct double a; doubl

    4、e b; double expected; training_data_t;#define MAX_TESTS 4training_data_t training_setMAX_TESTS= -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0 ;double compute( int test ) double result; /* Equation 10.2 */ result = (training_settest.a * weights0) + (training_settest.b * weights1) +

    5、(1.0 * weights2) ); if (result 0.0) result = 1.0; else result = -1.0; return result;int main() int i, test; double output; int change; /* Initialize the weights for the perceptron */ for ( i = 0 ; i NUM_WEIGHTS ; i+ ) weightsi = 0.0; /* Train the perceptron with the training set */ change = 1; while

    6、 (change) change = 0; for ( test = 0 ; test MAX_TESTS ; test+ ) /* Test on the perceptron */ output = compute( test ); /* Perceptron Learning Algorithm */ double dif=training_settest.expected-output; if ( (int)training_settest.expected != (int)output ) /* Use Equation 10.3 */ weights0 += ALPHA * tra

    7、ining_settest.expected * training_settest.a; weights1 += ALPHA * training_settest.expected * training_settest.b; weights2 += ALPHA * training_settest.expected; change = 1; /* Check the status of the Perceptron */ for (i = 0 ; i MAX_TESTS ; i+) printf( %g OR %g = %gn, training_seti.a, training_seti.b

    8、, compute(i) ); return 0;#include #include #include maths.c#include rand.h#define INPUT_NEURONS 35#define HIDDEN_NEURONS 10#define OUTPUT_NEURONS 10double inputsINPUT_NEURONS+1;double hiddenHIDDEN_NEURONS+1;double outputsOUTPUT_NEURONS;#define RHO (double)0.1double w_h_iHIDDEN_NEURONSINPUT_NEURONS+1

    9、;double w_o_hOUTPUT_NEURONSHIDDEN_NEURONS+1;#define RAND_WEIGHT (double)rand() / (double)RAND_MAX) - 0.5)#define IMAGE_SIZE 35typedef struct test_images_s int imageIMAGE_SIZE; int outputOUTPUT_NEURONS; test_image_t;#define MAX_TESTS 10test_image_t testsMAX_TESTS = 0,1,1,1,0, / 0 1,0,0,0,1, 1,0,0,0,1

    10、, 1,0,0,0,1, 1,0,0,0,1, 1,0,0,0,1, 0,1,1,1,0 , 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0,0,1,0,0, / 1 0,1,1,0,0, 0,0,1,0,0, 0,0,1,0,0, 0,0,1,0,0, 0,0,1,0,0, 0,1,1,1,0 , 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 , 0,1,1,1,0, / 2 1,0,0,0,1, 0,0,0,0,1, 0,0,1,1,0, 0,1,0,0,0, 1,0,0,0,0, 1,1,1,1,1 , 0, 0, 1, 0, 0, 0, 0, 0, 0,

    11、0 , 0,1,1,1,0, / 3 1,0,0,0,1, 0,0,0,0,1, 0,0,1,1,0, 0,0,0,0,1, 1,0,0,0,1, 0,1,1,1,0 , 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 , 0,0,0,1,0, / 4 0,0,1,1,0, 0,1,0,1,0, 1,1,1,1,1, 0,0,0,1,0, 0,0,0,1,0, 0,0,0,1,0 , 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 , 1,1,1,1,1, / 5 1,0,0,0,0, 1,0,0,0,0, 1,1,1,1,0, 0,0,0,0,1, 1,0,0,0,1,

    12、0,1,1,1,0 , 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 , 0,1,1,1,0, / 6 1,0,0,0,0, 1,0,0,0,0, 1,1,1,1,0, 1,0,0,0,1, 1,0,0,0,1, 0,1,1,1,0 , 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 , 1,1,1,1,1, / 7 1,0,0,0,1, 0,0,0,0,1, 0,0,0,1,0, 0,0,1,0,0, 0,1,0,0,0, 0,1,0,0,0 , 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 , 0,1,1,1,0, / 8 1,0,0,0,1, 1,0,0

    13、,0,1, 0,1,1,1,0, 1,0,0,0,1, 1,0,0,0,1, 0,1,1,1,0 , 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 , 0,1,1,1,0, / 9 1,0,0,0,1, 1,0,0,0,1, 0,1,1,1,1, 0,0,0,0,1, 0,0,0,1,0, 0,1,1,0,0 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ;void init_network( void ) int i, j; /* Set the input bias */ inputsINPUT_NEURONS = 1.0; /* Set the hidden

    14、bias */ hiddenHIDDEN_NEURONS = 1.0; /* Initialize the input-hidden weights */ for (j = 0 ; j HIDDEN_NEURONS ; j+) for (i = 0 ; i INPUT_NEURONS+1 ; i+) w_h_iji = RAND_WEIGHT; for (j = 0 ; j OUTPUT_NEURONS ; j+) for (i = 0 ; i HIDDEN_NEURONS+1 ; i+) w_o_hji = RAND_WEIGHT; return;void feed_forward( voi

    15、d ) int i, j; /* Calculate outputs of the hidden layer */ for (i = 0 ; i HIDDEN_NEURONS ; i+) hiddeni = 0.0; for (j = 0 ; j INPUT_NEURONS+1 ; j+) hiddeni += (w_h_iij * inputsj); hiddeni = sigmoid( hiddeni ); /* Calculate outputs for the output layer */ for (i = 0 ; i OUTPUT_NEURONS ; i+) outputsi =

    16、0.0; for (j = 0 ; j HIDDEN_NEURONS+1 ; j+) outputsi += (w_o_hij * hiddenj ); outputsi = sigmoid( outputsi ); void backpropagate_error( int test ) int out, hid, inp; double err_outOUTPUT_NEURONS; double err_hidHIDDEN_NEURONS; /* Compute the error for the output nodes (Equation 10.6) */ for (out = 0 ;

    17、 out OUTPUT_NEURONS ; out+) err_outout = (double)teststest.outputout - outputsout) * sigmoid_d(outputsout); /* Compute the error for the hidden nodes (Equation 10.7) */ for (hid = 0 ; hid HIDDEN_NEURONS ; hid+) err_hidhid = 0.0; /* Include error contribution for all output nodes */ for (out = 0 ; ou

    18、t OUTPUT_NEURONS ; out+) err_hidhid += err_outout * w_o_houthid; err_hidhid *= sigmoid_d( hiddenhid ); /* Adjust the weights from the hidden to output layer (Equation 10.9) */ for (out = 0 ; out OUTPUT_NEURONS ; out+) for (hid = 0 ; hid HIDDEN_NEURONS ; hid+) w_o_houthid += RHO * err_outout * hidden

    19、hid; /* Adjust the weights from the input to hidden layer (Equation 10.9) */ for (hid = 0 ; hid HIDDEN_NEURONS ; hid+) for (inp = 0 ; inp INPUT_NEURONS+1 ; inp+) w_h_ihidinp += RHO * err_hidhid * inputsinp; return;double calculate_mse( int test ) double mse = 0.0; int i; for (i = 0 ; i OUTPUT_NEURON

    20、S ; i+) mse += sqr( (teststest.outputi - outputsi) ); return ( mse / (double)i );void set_network_inputs( int test, double noise_prob ) int i; /* Fill the network inputs vector from the test */ for (i = 0 ; i INPUT_NEURONS ; i+) inputsi = teststest.imagei; /* In the given noise probability, negate t

    21、he cell */ if (RANDOM() noise_prob ) inputsi = (inputsi) ? 0 : 1; return;int classifier( void ) int i, best; double max; best = 0; max = outputs0; for (i = 1 ; i max) max = outputsi; best = i; return best;int main( void ) double mse, noise_prob; int test, i, j; RANDINIT(); init_network(); do /* Pick

    22、 a test at random */ test = RANDMAX(MAX_TESTS); /* Grab input image (with no noise) */ set_network_inputs( test, 0.0 ); /* Feed this data set forward */ feed_forward(); /* Backpropagate the error */ backpropagate_error( test ); /* Calculate the current MSE */ mse = calculate_mse( test ); while (mse

    23、0.001); /* Now, lets test the network with increasing amounts of noise */ test = RANDMAX(MAX_TESTS); /* Start with 5% noise probability, end with 25% (per pixel) */ noise_prob = 0.05; for (i = 0 ; i 5 ; i+) set_network_inputs( test, noise_prob ); feed_forward(); for (j = 0 ; j INPUT_NEURONS ; j+) if

    24、 (j % 5) = 0) printf(n); printf(%d , (int)inputsj); printf( nclassified as %dnn, classifier() ); noise_prob += 0.05; return 0;6. 实验总结:(实验结果及分析)通过人工神经程序设计的学习,我进一步了解了感知器和神经网络算法,包括期望值的调整等内容,同时更加熟练地使用c语言进行程序设计,对程序设计中遇到的各种问题渐渐地有了自己的认识和解决方案。说明:1. 实验名称、实验目的、实验内容、实验要求由教师确定,实验前由教师事先填好,然后作为实验报告模版供学生使用;2. 实验准备由学生在实验或上机之前填写,教师应该在实验前检查;3. 实验过程由学生记录实验的过程,包括操作过程、遇到哪些问题以及如何解决等;4. 实验总结由学生在实验后填写,总结本次实验的收获、未解决的问题以及体会和建议等;5. 源程序、代码、具体语句等,若表格空间不足时可作为附录另外附页。


    注意事项

    本文(人工智能应用技术实验报告人工神经网络程序设计.docx)为本站会员主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开