亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? art2.c

?? 各種神經(jīng)網(wǎng)絡(luò)C源代碼。包括: CPN、BPN、ART1、ART2。
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/**************************************************************************
 **************************************************************************
 ***									***
 ***				ART2.C					***
 ***									***
 *** Notice:															***
 ***    This code is copyright (C) 1995 by David M. Skapura.  It may	***
 ***    be used as is, or modified to suit the requirements of a		***
 ***    specific application without permission of the author.		    ***
 ***    There are no royalty fees for use of this code, as long         ***
 ***    as the original author is credited as part of the final		    ***
 ***    work.  In exchange for this royalty free use, the user       	***
 ***    agrees that no guarantee or warantee is given or implied.   	***
 ***									***
 ***									***
 **************************************************************************
 **************************************************************************/



#define ART2
#define LAYER n->net
#define I n->net[0]
#define F1 n->net[1]
#define F2 n->net[2]
#define e 0.0001

#include <stdio.h>
#include <conio.h>
#include <math.h>

#include "netstrct.h"
#include "activate.c"
#include "propgate.c"
#include "initnet.c"
#include "buildnet.c"
#include "shownet.c"
#include "exemplar.c"



typedef struct
 {
  float  *w;
  float  *x;
  float  *v;
  float  *u;
  float  *p;
  float  *q;
  float  *r;
 } sublayer;


typedef struct
 {
  int       layers;		    /* number of layers in the network	*/
  int	    exemplars;		    /* number of training pairs in net	*/
  float     A, B, C, D, theta, rho; /* ART Learning parameters		*/
  float     *errs;		    /* array of error values at output	*/
  iop	    *patterns;		    /* training pairs structure pointer	*/
  layer     **net;                  /* use the basic network structure	*/
  sublayer  f1;			    /* F1 sublayer structure		*/
  char      filename[40];	    /* default name for network file	*/
 } art2;



/************************************************************************

 The function build_art2 creates a generic ART2 network in memory.
 The network created by this function differs slightly from the
 conventional ART model, in that it will create a three-layer network
 instead of just two layers.  There are two reasons for this difference;
 in this model, we will use the input layer to hold the state of the
 input vector to the network, while the second layer (which will be the
 true F1 layer) will use its input connections to model the top-down
 connections in the ART network.  Recall that, in our conventional
 network model, the input layer to the network has no input connections.
 The function returns a pointer to the new network structure in memory.

*************************************************************************/


art2 *build_art2 (int *sizes)
 {
  art2 *n;
  int i, layers;

  n = (art2 *) calloc (1, sizeof(art2));
  layers = sizes[0] + 1;
  sizes[0] = sizes[1];		/* Input layer will be same size as F1 */
  n->net = build_net (layers, sizes);
  n->layers = layers;

  n->f1.w = (float *) calloc (sizes[1], sizeof(float));
  n->f1.x = (float *) calloc (sizes[1], sizeof(float));
  n->f1.v = (float *) calloc (sizes[1], sizeof(float));
  n->f1.u = (float *) calloc (sizes[1], sizeof(float));
  n->f1.p = (float *) calloc (sizes[1], sizeof(float));
  n->f1.q = (float *) calloc (sizes[1], sizeof(float));
  n->f1.r = (float *) calloc (sizes[1], sizeof(float));

  n->patterns = (iop *) calloc (1, sizeof(iop));
  n->patterns->dimX = -1;	/* no exemplars yet */
  n->patterns->dimY = -1;
  n->patterns->invecs = NULL;
  n->patterns->outvecs = NULL;

  n->exemplars = 0;
  strcpy (n->filename, "");
  free (sizes);

  return (n);
 }


/************************************************************************

 The function destroy_art2 undoes the build operation.  It takes a art2
 structure pointer as input, then proceeds to deallocate all of the
 memory used to model the network.

*************************************************************************/


void destroy_art2 (art2 *n)
 {
  int i;

  for (i=0; i<n->exemplars; i++)
   {
    if (n->patterns->invecs[i])  free (n->patterns->invecs[i]);
    if (n->patterns->outvecs[i]) free (n->patterns->outvecs[i]);
   }

  if (n->f1.w) free (n->f1.w);
  if (n->f1.x) free (n->f1.x);
  if (n->f1.v) free (n->f1.v);
  if (n->f1.u) free (n->f1.u);
  if (n->f1.p) free (n->f1.p);
  if (n->f1.q) free (n->f1.q);
  if (n->f1.r) free (n->f1.r);

  if (n->errs) free (n->errs);
  if (n->patterns->invecs)  free (n->patterns->invecs);
  if (n->patterns->outvecs) free (n->patterns->outvecs);

  destroy_net (n->layers, n->net);
  free (n);
 }


/***********************************************************************

 The function show_net is useful during debug to display the internal
 configuration of the ART2.  It iterates through all layers, showing
 actual outputs and weight values for all layers, and target values
 for the output layer.  Use this function only on small networks.
 Otherwise, too much information is sent to the screen.

************************************************************************/


void show_net (art2 *n)
 {
  int i;
  float *l;

  printf ("\nW: ");
  for (i=0, l=n->f1.w; i<F1->units; i++) printf ("%7.3f ", l[i]);
  printf ("\nX: ");
  for (i=0, l=n->f1.x; i<F1->units; i++) printf ("%7.3f ", l[i]);
  printf ("\nV: ");
  for (i=0, l=n->f1.v; i<F1->units; i++) printf ("%7.3f ", l[i]);
  printf ("\nU: ");
  for (i=0, l=n->f1.u; i<F1->units; i++) printf ("%7.3f ", l[i]);
  printf ("\nP: ");
  for (i=0, l=n->f1.p; i<F1->units; i++) printf ("%7.3f ", l[i]);
  printf ("\nQ: ");
  for (i=0, l=n->f1.q; i<F1->units; i++) printf ("%7.3f ", l[i]);
  printf ("\nR: ");
  for (i=0, l=n->f1.r; i<F1->units; i++) printf ("%7.3f ", l[i]);
  printf ("\n\n");

  for (i=0; i<n->layers; i++)
   {
    show_outputs (LAYER[i]);
    show_weights (LAYER[i]);
    printf ("\n");
   }

  if (getch() == ' ') exit (0);
 }




/***********************************************************************

 The function get_invec locates the start of the next input pattern
 vector in the exemplar set.  It returns a pointer to the start of the
 array that defines the input vector.

************************************************************************/

float *get_invec (art2 *n, int pattern)
 {
  if (n->patterns->invecs) return (n->patterns->invecs[pattern]);
  else return (NULL);
 }



/***********************************************************************

 The function get_outvec locates the start of the next output pattern
 vector in the exemplar set.  It returns a pointer to the start of the
 array that defines the output vector.

************************************************************************/

float *get_outvec (art2 *n, int pattern)
 {
  if (n->patterns->outvecs) return (n->patterns->outvecs[pattern]);
  else return (NULL);
 }




/***********************************************************************

 The function valid_exemplars tests that the dimension of the exemplars
 read from the file match the dimension of the input vector to the
 network.

************************************************************************/

int valid_exemplars (art2 *n)
 {
  return (F1->units == n->patterns->dimX);
 }




/***********************************************************************

 The function magX computes the magnitude of the vector X as the square
 root of the sum of the squares.  This function is used to propagate
 information between the sublayers on F1 in the network.

************************************************************************/


float mag (float *x, int dim)
 {
  int i;
  float sum=0.0;

  for (i=0; i<dim; i++) sum += x[i] * x[i];
  return (sqrt (sum));
 }




/***********************************************************************

 The function init_sublayers initializes the values of all sublayers in
 the ART2 F1 layer to zero.  This function is used prior to any new
 pattern propagation to ensure that the layer is prepared for a new
 pattern.

************************************************************************/

void init_sublayers (art2 *n, float *inval)
 {
  int i;
  float *l;

  for (i=0, l=n->f1.w; i<F1->units; i++) *l++ = 0.0;
  for (i=0, l=n->f1.x; i<F1->units; i++) *l++ = 0.0;
  for (i=0, l=n->f1.u; i<F1->units; i++) *l++ = 0.0;
  for (i=0, l=n->f1.v; i<F1->units; i++) *l++ = 0.0;
  for (i=0, l=n->f1.p; i<F1->units; i++) *l++ = 0.0;
  for (i=0, l=n->f1.q; i<F1->units; i++) *l++ = 0.0;
  for (i=0, l=n->f1.r; i<F1->units; i++) *l++ = 0.0;
  for (i=0, l=I->outputs; i<I->units; i++) *l++ = inval[i];
  for (i=0, l=F1->outputs; i<F1->units; i++) *l++ = 0.0;
  for (i=0, l=F2->outputs; i<F1->units; i++) *l++ = 0.0;
 }



/***********************************************************************

 The function f performs a threshold function on the input term x,
 such that if x > theta, f returns x.  Otherwise, f returns 0.

************************************************************************/


float f (float x, float theta)
 {
  if (x > theta) return (x);
  else return (0.0);
 }



/***********************************************************************

 The function prop_through_sublayers takes an array of floats, which is
 the input vector to the network, and propagates the information through
 the F1 sublayers.  The resulting pattern is stored in f1.p array in the
 sublayer structure.

************************************************************************/

void prop_through_sublayers (art2 *n)
 {
  int i, dimI;
  float *w, *x, *u, *v, *p, *q, magW, magV, magP, theta;

  w = n->f1.w;
  x = n->f1.x;
  u = n->f1.u;
  v = n->f1.v;
  p = n->f1.p;
  q = n->f1.q;
  theta = n->theta;
  dimI = F1->units;

  for (i=0; i<dimI; i++) w[i] = I->outputs[i] + n->A * u[i];

  magW = mag (w, dimI);
  for (i=0; i<dimI; i++) x[i] = w[i] / (e + magW);
  for (i=0; i<dimI; i++) v[i] = f(x[i], theta) + n->B * f(q[i], theta);

  magV = mag (v, dimI);
  for (i=0; i<dimI; i++) u[i] = v[i] / (e + magV);
  for (i=0; i<dimI; i++) p[i] = u[i] + F1->outputs[i];

  magP = mag (p, dimI);
  for (i=0; i<dimI; i++) q[i] = p[i] / (e + magP);
 }



/***********************************************************************

 The function apply_input takes an array of floats, which is assumed
 to be the same dimension as the input layer, propagates the pattern
 through the F1 sublayers, and sets the output of the F1 layer to be
 the value produced by the ART2 F1 sublayer structure.

************************************************************************/

void apply_input (art2 *n, float *invals)
 {
  float *outvals, *p;
  int i, units;

  units = F1->units;
  outvals = F1->outputs;
  p = n->f1.p;

  init_sublayers (n, invals);	/* ready for new pattern */
  prop_through_sublayers (n);	/* first pass */
  prop_through_sublayers (n);	/* second pass to ensure stability */

  for (i=0; i<units; i++) outvals[i] = p[i];

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
老鸭窝一区二区久久精品| 粉嫩绯色av一区二区在线观看| 国产精品久久久久影视| 久久综合九色综合97婷婷女人| 日韩一级二级三级精品视频| 欧美美女喷水视频| 欧美高清视频一二三区| 777奇米四色成人影色区| 欧美精品在线观看播放| 6080国产精品一区二区| 欧美一级免费大片| 日韩欧美亚洲一区二区| xnxx国产精品| 中文在线免费一区三区高中清不卡| 久久免费电影网| 中文久久乱码一区二区| 亚洲女人****多毛耸耸8| 一区二区三区精品在线| 丝袜美腿高跟呻吟高潮一区| 性感美女久久精品| 精品在线一区二区| 国产成人aaaa| 欧美在线你懂的| 7777精品伊人久久久大香线蕉完整版 | www.日本不卡| 91久久奴性调教| 欧美蜜桃一区二区三区 | 亚洲一区二区三区四区在线免费观看 | 成人晚上爱看视频| 色综合久久久久久久久| 欧美日韩综合在线免费观看| 日韩亚洲欧美中文三级| 国产伦精品一区二区三区视频青涩| 亚洲成人自拍一区| 蜜桃视频在线一区| 成人中文字幕在线| 国产日产欧产精品推荐色| 免费观看一级特黄欧美大片| 亚洲午夜精品在线| 中文字幕在线播放不卡一区| 久久精品一区蜜桃臀影院| 一级中文字幕一区二区| 日韩av中文字幕一区二区| 久久国产乱子精品免费女| 国内国产精品久久| 韩国毛片一区二区三区| 久久99久久99小草精品免视看| 天堂成人免费av电影一区| 蜜桃一区二区三区在线| 国产精品一线二线三线| 99综合电影在线视频| 欧美综合久久久| 8x8x8国产精品| 亚洲欧洲日本在线| 亚洲午夜视频在线观看| 日本aⅴ亚洲精品中文乱码| 久久er精品视频| 成人黄动漫网站免费app| 欧美性大战久久| 久久伊人中文字幕| 亚洲欧美日本在线| 男人的j进女人的j一区| 91尤物视频在线观看| 欧美一区二区三区人| 亚洲一区二区三区激情| 亚洲成人av福利| 在线播放亚洲一区| 91精品免费在线观看| 国产精品视频在线看| 国产一区二区精品久久91| 日韩久久一区二区| 亚洲视频综合在线| 国产精品亲子乱子伦xxxx裸| 性做久久久久久免费观看 | 日韩成人一级大片| a级精品国产片在线观看| 欧美一二三区精品| 亚洲摸摸操操av| 国产成人综合在线| 69堂精品视频| 亚洲免费观看在线视频| 日产国产欧美视频一区精品 | 日韩国产一区二| 欧美日韩精品一二三区| 国产精品久久三| 国产一区二区三区免费播放| 最新不卡av在线| 国产日产欧美一区| 亚洲精品国产精华液| 国产成人综合在线观看| 日韩欧美激情四射| 亚洲第一成人在线| 一本色道久久综合亚洲aⅴ蜜桃| 亚洲精品一区二区三区在线观看 | 国产视频一区二区在线| 蜜桃视频在线观看一区| 欧美日韩大陆在线| 亚洲一区二区在线免费看| av男人天堂一区| 国产日韩一级二级三级| 韩国精品免费视频| 精品国产sm最大网站| 日本怡春院一区二区| 欧美日韩一区二区三区在线 | 国产综合色视频| 亚洲欧美日韩中文播放| 国产一区不卡精品| 精品欧美一区二区久久| 天堂蜜桃91精品| 制服丝袜激情欧洲亚洲| 亚洲国产wwwccc36天堂| 欧美系列亚洲系列| 亚洲精品国产精品乱码不99 | 日韩欧美一区在线观看| 美女一区二区在线观看| 91精品国产手机| 青娱乐精品在线视频| 欧美一区二区国产| 久久av资源网| 久久久久免费观看| 国产99久久久精品| 成人欧美一区二区三区白人| 99久久亚洲一区二区三区青草| 国产精品久久久久久妇女6080| 成人短视频下载| 亚洲天堂av老司机| 欧美综合一区二区| 视频一区二区中文字幕| 欧美成人精品福利| 国产毛片精品视频| 中文字幕中文字幕一区| 91香蕉视频mp4| 亚洲成a人片在线观看中文| 88在线观看91蜜桃国自产| 美国三级日本三级久久99| 精品理论电影在线观看| 国产大陆亚洲精品国产| 中文字幕一区二区视频| 欧美吞精做爰啪啪高潮| 日韩av电影免费观看高清完整版在线观看 | 国产一区91精品张津瑜| 中文字幕av一区二区三区免费看| 成人免费视频国产在线观看| 亚洲女人的天堂| 欧美高清视频在线高清观看mv色露露十八 | 蜜臀av国产精品久久久久| 久久久噜噜噜久久中文字幕色伊伊 | 亚洲欧美中日韩| 欧美色综合天天久久综合精品| 日本亚洲三级在线| 国产色一区二区| 在线免费观看日本一区| 日本免费新一区视频 | 久久99精品国产麻豆婷婷洗澡| 欧美国产一区二区| 欧美视频一二三区| 国产精品一二三四| 亚洲精品久久久蜜桃| 欧美xxx久久| 一本到三区不卡视频| 久久se精品一区二区| 专区另类欧美日韩| 日韩欧美在线综合网| 91亚洲精品久久久蜜桃| 久久99精品久久久| 亚洲精品免费在线播放| 精品国产91九色蝌蚪| 91国内精品野花午夜精品| 精品亚洲成a人| 亚洲国产视频网站| 国产女同互慰高潮91漫画| 欧美精品国产精品| 不卡欧美aaaaa| 麻豆精品久久久| 亚洲自拍偷拍九九九| 久久精品视频在线看| 欧美日韩高清一区二区| 成人黄色免费短视频| 免费成人在线播放| 一区二区久久久| 欧美韩国日本综合| 欧美一区二区三区视频免费| 91丨九色丨黑人外教| 国产电影一区二区三区| 美女在线一区二区| 亚洲国产精品欧美一二99| 国产精品护士白丝一区av| 亚洲精品一线二线三线| 欧美精品 日韩| 欧美视频一区二区三区| 91免费观看视频在线| 豆国产96在线|亚洲| 韩国一区二区在线观看| 日韩黄色免费电影| 亚洲国产一区二区三区青草影视| 中文字幕一区二区三区视频| 国产午夜精品一区二区| 精品国产免费人成电影在线观看四季| 欧美美女直播网站| 欧美色爱综合网|