资源简介
c语言 神经网络算法

代码片段和文件信息
/*
Fast Artificial Neural Network Library (fann)
Copyright (C) 2003-2016 Steffen Nissen (steffen.fann@gmail.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License or (at your option) any later version.
This library is distributed in the hope that it will be useful
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not write to the Free Software
Foundation Inc. 59 Temple Place Suite 330 Boston MA 02111-1307 USA
*/
#include
#include “fann.h“
int main()
{
struct fann *ann;
struct fann_train_data *train_data *test_data;
const float desired_error = (const float)0.0;
unsigned int max_neurons = 30;
unsigned int neurons_between_reports = 1;
unsigned int bit_fail_train bit_fail_test;
float mse_train mse_test;
unsigned int i = 0;
fann_type *output;
fann_type steepness;
int multi = 0;
enum fann_activationfunc_enum activation;
enum fann_train_enum training_algorithm = FANN_TRAIN_RPROP;
printf(“Reading data.\n“);
train_data = fann_read_train_from_file(“../../datasets/parity8.train“);
test_data = fann_read_train_from_file(“../../datasets/parity8.test“);
fann_scale_train_data(train_data -1 1);
fann_scale_train_data(test_data -1 1);
printf(“Creating network.\n“);
ann = fann_create_shortcut(2 fann_num_input_train_data(train_data) fann_num_output_train_data(train_data));
fann_set_training_algorithm(ann training_algorithm);
fann_set_activation_function_hidden(ann FANN_SIGMOID_SYMMETRIC);
fann_set_activation_function_output(ann FANN_LINEAR);
fann_set_train_error_function(ann FANN_ERRORFUNC_LINEAR);
if(!multi)
{
/*steepness = 0.5;*/
steepness = 1;
fann_set_cascade_activation_steepnesses(ann &steepness 1);
/*activation = FANN_SIN_SYMMETRIC;*/
activation = FANN_SIGMOID_SYMMETRIC;
fann_set_cascade_activation_functions(ann &activation 1);
fann_set_cascade_num_candidate_groups(ann 8);
}
if(training_algorithm == FANN_TRAIN_QUICKPROP)
{
fann_set_learning_rate(ann 0.35f);
fann_randomize_weights(ann -2.0f 2.0f);
}
fann_set_bit_fail_limit(ann (fann_type)0.9);
fann_set_train_stop_function(ann FANN_STOPFUNC_BIT);
fann_print_parameters(ann);
fann_save(ann “cascade_train2.net“);
printf(“Training network.\n“);
fann_cascadetrain_on_data(ann train_data max_neurons neurons_between_reports desired_error);
fann_print_connections(ann);
mse_train = fann_test_data(ann train_data);
bit_fail_train = fann_get_bit_fail(ann);
mse_test = fann_test_data(ann test_data);
bit_fail_test = fann_get_bit_fail(ann);
printf(“\nTrain error: %f
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-11-29 13:53 fann-master\
文件 587 2015-11-29 13:53 fann-master\.gitignore
目录 0 2015-11-29 13:53 fann-master\.idea\
文件 159 2015-11-29 13:53 fann-master\.idea\encodings.xm
文件 70683 2015-11-29 13:53 fann-master\.idea\fann.iml
文件 137 2015-11-29 13:53 fann-master\.idea\misc.xm
文件 260 2015-11-29 13:53 fann-master\.idea\modules.xm
目录 0 2015-11-29 13:53 fann-master\.idea\runConfigurations\
文件 413 2015-11-29 13:53 fann-master\.idea\runConfigurations\Tests.xm
文件 180 2015-11-29 13:53 fann-master\.idea\vcs.xm
文件 417 2015-11-29 13:53 fann-master\.travis.yml
文件 4926 2015-11-29 13:53 fann-master\CMakeLists.txt
文件 26934 2015-11-29 13:53 fann-master\LICENSE.md
文件 2864 2015-11-29 13:53 fann-master\README.md
目录 0 2015-11-29 13:53 fann-master\VS2010\
目录 0 2015-11-29 13:53 fann-master\VS2010\cascade_train\
文件 7876 2015-11-29 13:53 fann-master\VS2010\cascade_train\cascade_train.vcxproj
文件 229 2015-11-29 13:53 fann-master\VS2010\cascade_train\cascade_train.vcxproj.filters
文件 13474 2015-11-29 13:53 fann-master\VS2010\fann.sln
文件 4243 2015-11-29 13:53 fann-master\VS2010\fann_tests.sln
目录 0 2015-11-29 13:53 fann-master\VS2010\fanndouble\
文件 9834 2015-11-29 13:53 fann-master\VS2010\fanndouble\fanndouble.vcxproj
文件 2880 2015-11-29 13:53 fann-master\VS2010\fanndouble\fanndouble.vcxproj.filters
目录 0 2015-11-29 13:53 fann-master\VS2010\fannfixed\
文件 2436 2015-11-29 13:53 fann-master\VS2010\fannfixed\fannfixed.filters
文件 9357 2015-11-29 13:53 fann-master\VS2010\fannfixed\fannfixed.vcxproj
目录 0 2015-11-29 13:53 fann-master\VS2010\fannfloat\
文件 9461 2015-11-29 13:53 fann-master\VS2010\fannfloat\fannfloat.vcxproj
文件 2769 2015-11-29 13:53 fann-master\VS2010\fannfloat\fannfloat.vcxproj.filters
目录 0 2015-11-29 13:53 fann-master\VS2010\gtest\
文件 8331 2015-11-29 13:53 fann-master\VS2010\gtest\gtest.vcxproj
............此处省略617个文件信息
- 上一篇:基于UDP的通信程序设计
- 下一篇:热血江湖服务端C++源代码,完整游戏服务器代码
相关资源
- 操作系统c语言模拟文件管理系统844
- C语言开发实战宝典
- C++中头文件与源文件的作用详解
- C语言代码高亮html输出工具
- 猜数字游戏 c语言代码
- C语言课程设计
- 数字电位器C语言程序
- CCS FFT c语言算法
- 使用C语言编写的病房管理系统
- 通信过程中的RS编译码程序(c语言)
- 计算机二级C语言上机填空,改错,编
- 用回溯法解决八皇后问题C语言实现
- 简易教务管理系统c语言开发文档
- 操作系统课设 读写者问题 c语言实现
- 小波变换算法 c语言版
- C流程图生成器,用C语言代码 生成C语
- 3des加密算法C语言实现
- 简单的C语言点对点聊天程序
- 单片机c语言源程序(51定时器 八个按
- 个人日常财务管理系统(C语言)
- c语言电子商务系统
- 小甲鱼C语言课件 源代码
- 将图片转换为C语言数组的程序
- C语言实现的一个内存泄漏检测程序
- DES加密算法C语言实现
- LINUX下命令行界面的C语言细胞游戏
- 用单片机控制蜂鸣器播放旋律程序(
- 学校超市选址问题(数据结构C语言版
- 电子时钟 有C语言程序,PROTEUS仿真图
- 尚观培训linux许巍老师关于c语言的课
评论
共有 条评论