⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 x68.html

📁 一个功能强大的神经网络分析程序
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><HTML><HEAD><TITLE>Getting Started</TITLE><link href="../style.css" rel="stylesheet" type="text/css"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINKREL="HOME"TITLE="Fast Artificial Neural Network Library"HREF="index.html"><LINKREL="UP"TITLE="Introduction"HREF="c13.html"><LINKREL="PREVIOUS"TITLE="Installation"HREF="x26.html"><LINKREL="NEXT"TITLE="Getting Help"HREF="x100.html"></HEAD><BODYCLASS="section"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Fast Artificial Neural Network Library</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="x26.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 1. Introduction</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="x100.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="section"><H1CLASS="section"><ANAME="intro.start">1.3. Getting Started</A></H1><P>&#13;        An ANN is normally run in two different modes, a training mode and an execution mode. Although it is        possible to do this in the same program, using different programs is recommended.      </P><P>&#13;        There are several reasons to why it is usually a good idea to write the training and execution in two	different programs, but the most obvious is the fact that a typical ANN system is only trained once, while it	is executed many times.      </P><DIVCLASS="section"><H2CLASS="section"><ANAME="intro.start.train">1.3.1. Training</A></H2><P>&#13;	  The following is a simple program which trains an ANN with a data set and then saves the ANN to a file. 	</P><DIVCLASS="example"><ANAME="example.simple_train"></A><P><B>Example 1-1. Simple training example</B></P><PRECLASS="programlisting">&#13;#include "fann.h"int main(){        const float connection_rate = 1;        const float learning_rate = 0.7;        const unsigned int num_input = 2;        const unsigned int num_output = 1;        const unsigned int num_layers = 3;        const unsigned int num_neurons_hidden = 4;        const float desired_error = 0.0001;        const unsigned int max_iterations = 500000;        const unsigned int iterations_between_reports = 1000;        struct fann *ann = fann_create(connection_rate, learning_rate, num_layers,                num_input, num_neurons_hidden, num_output);                fann_train_on_file(ann, "xor.data", max_iterations,                iterations_between_reports, desired_error);                fann_save(ann, "xor_float.net");                fann_destroy(ann);        return 0;}          </PRE></DIV><P>&#13;	  The file xor.data, used to train the xor function:	  <PRECLASS="literallayout">&#13;4 2 10 000 111 011 10	  </PRE> The first line consists of three numbers: The first is the number of training pairs in the file, the second is the number of inputs and	  the third is the number of outputs. The rest of the file is the actual training data, consisting of one line with inputs, one with outputs etc.	</P><P>&#13;	  This example introduces several fundamental functions, namely <AHREF="r258.html"><CODECLASS="function">fann_create</CODE></A>,	  <AHREF="r806.html"><CODECLASS="function">fann_train_on_file</CODE></A>,	  <AHREF="r474.html"><CODECLASS="function">fann_save</CODE></A>, and <AHREF="r361.html"><CODECLASS="function">fann_destroy</CODE></A>.	</P></DIV><DIVCLASS="section"><H2CLASS="section"><ANAME="intro.start.execution">1.3.2. Execution</A></H2><P>&#13;	  The following example shows a simple program which executes a single input on the ANN. The program introduces two new functions	  (<AHREF="r519.html"><CODECLASS="function">fann_create_from_file</CODE></A> and	  <AHREF="r376.html"><CODECLASS="function">fann_run</CODE></A>) which were not used in the training procedure, as well as the <SPANCLASS="type">fann_type</SPAN>	  type.	</P><DIVCLASS="example"><ANAME="example.simple_exec"></A><P><B>Example 1-2. Simple execution example</B></P><PRECLASS="programlisting">&#13;#include &#60;stdio.h&#62;#include "floatfann.h"int main(){        fann_type *calc_out;        fann_type input[2];        struct fann *ann = fann_create_from_file("xor_float.net");                input[0] = 0;        input[1] = 1;        calc_out = fann_run(ann, input);        printf("xor test (%f,%f) -&#62; %f\n",                input[0], input[1], *calc_out);                fann_destroy(ann);        return 0;}          </PRE></DIV></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="x26.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="index.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="x100.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Installation</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="c13.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Getting Help</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -