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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? art2.c

?? 各種神經網絡C源代碼。包括: CPN、BPN、ART1、ART2。
?? C
?? 第 1 頁 / 共 2 頁
字號:
 }




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

 The function prop_though propagates the information at the output of
 the F1 layer to the F2 layer.  After propagating the information, the
 function activates the F2 layer in preparation for the top-down
 processing. Finally, the function performs the top-down pattern
 propagation back to F1, adjusting sublayers p and r after the top-down
 pattern propagation.

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

void prop_through (art2 *n)
 {
  int i;
  float *p, *u, *r, magU, magP;

  propagate (F1, F2);
  activate (F2);
  propagate (F2, F1);

  p = n->f1.p;
  u = n->f1.u;
  r = n->f1.r;

  for (i=0; i<F1->units; i++) p[i] = u[i] + F1->outputs[i];
  magU = mag (u, F1->units);
  magP = mag (p, F1->units);
  for (i=0; i<F1->units; i++) r[i] = (u[i] + n->C * p[i]) / (e + magU + n->C * magP);
 }




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

 The function compare_patterns determines the degree of match between
 the STM on layer F1 and the original input pattern.  The function
 returns the ratio between the magnitude of these two vectors as
 determined by counting the number of active units on each layer.

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

float compare_patterns (art2 *n)
 {
  int i;
  float magR;

  magR = mag (n->f1.r, F1->units);
  return (n->rho / (e + magR));
 }




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

 The function adjust_bottom_up_weights adapts the connections between
 the F1 and F2 layers to encode a new memory pattern for F2 to recognize.
 The input argument is the network structure.  All values requiring
 updates are modified as part of this routine, and no return value is
 produced.

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


void adjust_bottom_up_weights (art2 *n)
 {
  int i, winner;
  float *wts, *u;

  winner = F2->processed;
  wts = F2->connects[winner];
  u = n->f1.u;

  for (i=0; i<F1->units; i++) wts[i] = u[i] / (1.0 - n->D);
 }



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

 The function adjust_top_down_weights adapts the connections between
 the F2 and F1 layers to encode a new LTM pattern for comparison to
 a new input.  The input argument is the network structure.  All values
 requiring updates are modified as part of this routine, and no return
 value is produced.

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


void adjust_top_down_weights (art2 *n)
 {
  int i, j, winner;
  float *wts, **connects, *u;

  winner = F2->processed;
  connects = F1->connects;
  u = n->f1.u;

  for (i=0; i<F1->units; i++)
   {
    wts = connects[i];
    wts[winner] = u[i] / (1.0 - n->D);
   }
 }




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

 The function inhibit is defined to prevent a competitive unit that has
 won the competition from participating in the competition again.  This
 function is necessary when training the competitive F2 layer of the ART2
 to prevent one unit from constantly winning, and therefore causing the
 network to never learn the exemplars.  The mechanism for inhibiting a
 unit is to temporarily set all of the input connection weights to that
 unit to a value of 0, thus preventing the unit from being the best match
 on the next competition.  The value returned is the pointer to the true
 weight array for the unit.

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


float *inhibit (int unit, layer *l, float *zeros)
 {
  float *wts;

  wts = l->connects[unit];
  l->connects[unit] = zeros;
  return (wts);
 }





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

 The function save_art2 creates a save filename from the training file
 name by adding a ".ar2" extension to the file, then calls save_net to
 save the network configuration data to the file.  The network saved by
 this function can be recreated by using the restore_art2 function
 defined later.

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

void save_art2 (art2 *n)
 {
  char *outfile;
  FILE *fp;
  int i, j, dotpos;

  outfile = (char *)&n->filename;
  dotpos = position ('.', outfile);

  if (dotpos >= 0) outfile[dotpos] = '\0';
  strcat (outfile, ".ar2");

  if (!(fp = fopen (outfile, "w")))
   {
    printf ("\nERROR: Could not open the file \"%s\" for data storage.", outfile);
    exit (0);
   }

  fwrite (&n->layers, sizeof(int), 1, fp);
  for (i=0; i<n->layers; i++) fwrite (&LAYER[i]->units, sizeof(int), 1, fp);

  for (i=0; i<F1->units; i++)
   fwrite (F1->connects[i], sizeof(float), F2->units, fp);

  fwrite (&F1->modifier, sizeof(float), 1, fp);

  for (i=0; i<F2->units; i++)
   fwrite (F2->connects[i], sizeof(float), F1->units, fp);

  fwrite (&F2->modifier, sizeof(float), 1, fp);

  fclose (fp);
 }



/***********************************************************************
 The function restore_art2 recreates a ART2 structure in memory from data
 saved in a file.  Note that only connection weight data is restored.
 If the ART2 uses activation functions other than the default, these must
 be reinstalled after recreating the network by using the set_parameters
 command.
************************************************************************/


art2 *restore_art2 (char *filename)
 {
  art2 *n;
  int *ldata, layers, i;
  FILE *fp;

  if (!(fp = fopen (filename, "r")))
   {
    printf ("\nERROR: Could not open configuration file \"%s\"", filename);
    exit (0);
   }


  fread (&layers, sizeof(int), 1, fp);
  ldata = (int *) calloc (layers+1, sizeof(int));

  for (i=1; i<=layers; i++)
   fread (&ldata[i], sizeof(int), 1, fp);

  ldata[0] = layers;
  n = build_art2 (ldata);
  free (ldata);

  connect (F1, F2, COMPLETE, RANDOM);
  connect (F2, F1, COMPLETE, RANDOM);

  for (i=0; i<F1->units; i++)
   fread (F1->connects[i], sizeof(float), F2->units, fp);

  fread (&F1->modifier, sizeof(float), 1, fp);

  for (i=0; i<F2->units; i++)
   fread (F2->connects[i], sizeof(float), F1->units, fp);

  fread (&F2->modifier, sizeof(float), 1, fp);

  fclose (fp);
  return (n);
 }




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

 The function train_net opens an exemplar file, loads the exemplars,
 and proceeds to train the given network until all of the input
 exemplars are learned.  If the exemplars contain a corresponding
 output, this value is ignored.

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

int train_net (art2 *n, char *filename)
 {
  int i, j, pattern, winner;
  float *p, degree_of_match, **savewts, *zeros;

  strcpy (n->filename, filename);
  n->exemplars = load_exemplars (filename, n->patterns);

  if (!valid_exemplars (n))
   {
    printf ("\NError: Exemplars do not match network size!");
    exit (0);
   }

  savewts = (float **) calloc (F2->units, sizeof (float *));
  zeros = (float *) calloc (F1->units, sizeof (float));

  for (i=0; i<F1->units; i++) zeros[i] = 0.0;

  for (i=0; i<2; i++)
   for (pattern=0; pattern<n->exemplars; pattern++)
    {
     for (j=0; j<F2->units; j++) savewts[j] = F2->connects[j];

     for (;;)
      {
       apply_input (n, get_invec (n, pattern));
       prop_through (n);
       degree_of_match = compare_patterns (n);

       if (degree_of_match <= 1.0) break;

       winner = F2->processed;
       inhibit (winner, F2, zeros);
      }

     for (j=0; j<F2->units; j++) F2->connects[j] = savewts[j];

     adjust_bottom_up_weights (n);
     adjust_top_down_weights (n);
    }

  free (savewts);
  free (zeros);
  return (TRUE);
 }



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

 The function set_parameters initializes a layer on the ART2.  Arguments
 to this function are a pointer to the layer, the propagation function
 to be used during feed-forward propagation, the activation function for
 the layer, and values for the learning rate and momentum terms.

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

void set_parameters (layer *l, pfn p, afn a, float m)
 {
  set_propagation (l, p);
  set_activation  (l, a, m);
 }




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

 The function set_art2_parameters initializes the learning parameters
 for the ART2 network.  Arguments to this function are a pointer to the
 network structure, and values for each parameter in the ART2 model.

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

void set_art2_parameters (art2 *n, float a, float b, float c, float d, float theta, float rho)
 {
  n->A = a;
  n->B = b;
  n->C = c;
  n->D = d;
  n->theta = theta;
  n->rho = rho;
 }



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

 We are now able to create and train an ART2, using the functions that we
 have defined up until now. We begin by creating a dynamic structure to
 specify the number of layers in the network, and the number of units on
 each layer.  We then create an ART2 structure in memory, connect the layers
 appropriately, initialize each layer, and train the network using data
 in the example file "xor.dat"  Once training has been completed, we
 deallocate the network structure and return to the OS.

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

void main ()
 {
  art2 *n;
  int *layers;

  layers = define_layers (2, 3, 4);
  n = build_art2 (layers);
  set_art2_parameters (n, 10, 10, 0.1, 0.9, 0.2, 0.9);

  F1->initval = 0.0;	/* top down weights are initialized to zero */
  F2->initval = 1.0 / ((1.0 - n->D) * sqrt ((float) F1->units));

  connect (F1, F2, COMPLETE, VALUE);
  connect (F2, F1, COMPLETE, VALUE);

  set_parameters (F1, DOT_PRODUCT, LINEAR, 1.0);
  set_parameters (F2, DOT_PRODUCT, ON_CENTER, 0.0);

  if (train_net (n, "art2test.dat")) show_net (n);  /* save_art2 (n); */

  free (layers);
  destroy_art2 (n);
 }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国内精品久久久久影院薰衣草 | 91国在线观看| 欧美成人三级在线| 亚洲欧美偷拍三级| 国产一区二区视频在线| 在线不卡免费av| 亚洲精品午夜久久久| 国产成人精品亚洲777人妖| 这里只有精品99re| 一区二区三区鲁丝不卡| 成人免费高清在线| 久久综合久久综合亚洲| 日韩影院在线观看| 欧美午夜影院一区| 亚洲视频图片小说| 成人丝袜视频网| 久久亚洲综合av| 555夜色666亚洲国产免| 亚洲乱码中文字幕| 成人av资源下载| 国产亚洲精久久久久久| 久久精品久久久精品美女| 欧美人与禽zozo性伦| 亚洲精品美国一| 99视频国产精品| 中文字幕一区二区三区在线不卡| 韩国v欧美v日本v亚洲v| 日韩亚洲国产中文字幕欧美| 香蕉久久一区二区不卡无毒影院 | 国产成人精品免费网站| 精品日产卡一卡二卡麻豆| 青青草原综合久久大伊人精品 | 欧美日韩精品专区| 一区二区三区成人| 色婷婷国产精品久久包臀| 国产精品国产三级国产aⅴ入口 | 久久免费的精品国产v∧| 亚洲国产aⅴ天堂久久| 色偷偷成人一区二区三区91 | 热久久一区二区| 91精品国产高清一区二区三区蜜臀 | 欧美浪妇xxxx高跟鞋交| 亚洲成人你懂的| 欧美日韩国产不卡| 日韩高清一区二区| 日韩视频一区二区在线观看| 蜜桃av一区二区在线观看| 日韩一区二区在线免费观看| 美女视频黄 久久| 精品国产精品网麻豆系列| 久久成人久久爱| 久久久久国产精品麻豆ai换脸| 韩国一区二区三区| 国产网红主播福利一区二区| 国产精品99精品久久免费| 中文在线资源观看网站视频免费不卡| 国产91综合网| 亚洲日本va在线观看| 日本精品裸体写真集在线观看| 亚洲图片自拍偷拍| 884aa四虎影成人精品一区| 另类人妖一区二区av| 久久久久久麻豆| 成人黄色综合网站| 亚洲永久免费视频| 91精品欧美综合在线观看最新| 久久精品国产秦先生| 欧美国产日韩精品免费观看| 欧美激情一区二区三区不卡 | 国产精品91xxx| 亚洲欧洲另类国产综合| 欧洲人成人精品| 午夜亚洲国产au精品一区二区| 日韩手机在线导航| 国产不卡视频在线观看| 亚洲少妇30p| 欧美精品一二三| 国产一区在线看| 亚洲欧美日韩久久精品| 欧美电影一区二区三区| 国产一区二区剧情av在线| 国产精品久久久久久户外露出| 欧美视频在线观看一区| 捆绑调教一区二区三区| 国产精品免费观看视频| 欧美日韩三级在线| 国产一区日韩二区欧美三区| 亚洲人成人一区二区在线观看| 欧美二区在线观看| 成人妖精视频yjsp地址| 亚洲v中文字幕| 日本一区二区三区电影| 欧美性感一类影片在线播放| 韩国欧美国产一区| 亚洲精品成人a在线观看| 欧美成人欧美edvon| 91亚洲精华国产精华精华液| 蜜桃av一区二区在线观看 | 欧美丰满高潮xxxx喷水动漫| 国产成人夜色高潮福利影视| 亚洲成人av福利| 国产精品免费人成网站| 欧美一级xxx| 色婷婷久久久综合中文字幕| 久久成人久久爱| 亚洲一区视频在线观看视频| 国产亚洲午夜高清国产拍精品 | 337p粉嫩大胆噜噜噜噜噜91av| 色婷婷综合久久| 国产高清久久久| 日本在线播放一区二区三区| 国产精品国产馆在线真实露脸| 日韩一级视频免费观看在线| 色综合欧美在线视频区| 国产精品正在播放| 日韩专区中文字幕一区二区| 亚洲少妇中出一区| 久久久久久久久久久久久久久99| 欧美猛男超大videosgay| 成人app网站| 国产一区二区免费视频| 日韩成人伦理电影在线观看| 日韩毛片一二三区| 国产三级精品视频| 日韩欧美电影一二三| 欧洲亚洲精品在线| 99免费精品在线观看| 国产美女精品在线| 日本欧美肥老太交大片| 亚洲国产精品嫩草影院| 日韩理论在线观看| 中文字幕电影一区| 久久影院电视剧免费观看| 欧美一区二区三区在线观看视频| 一本一本久久a久久精品综合麻豆| 国产精品一区二区久久不卡| 精品一区二区三区日韩| 免费高清在线一区| 亚洲国产精品久久一线不卡| 亚洲欧美日韩国产综合| 成人av在线一区二区三区| 国产一区二区视频在线播放| 青青草国产成人av片免费| 亚洲成人动漫一区| 亚洲国产成人av好男人在线观看| 亚洲欧美日韩久久精品| 亚洲三级理论片| 亚洲视频在线观看三级| 亚洲欧美日本韩国| **性色生活片久久毛片| 国产精品丝袜一区| 日本一区二区三区久久久久久久久不| 久久青草欧美一区二区三区| 精品国产乱码久久久久久影片| 欧美tickle裸体挠脚心vk| 精品国产三级a在线观看| 日韩美女一区二区三区| 日韩精品一区二区三区四区 | www.在线成人| 99精品热视频| 91日韩在线专区| 色婷婷av一区二区三区大白胸| 色婷婷综合久久久| 欧美亚洲尤物久久| 欧美日产在线观看| 91麻豆精品91久久久久同性| 欧美一区二区在线免费播放| 欧美一级理论性理论a| 日韩视频免费观看高清完整版| 日韩一区二区免费在线电影| 欧美一级黄色片| 久久亚洲私人国产精品va媚药| 国产日韩欧美a| 中文字幕亚洲区| 亚洲国产日韩在线一区模特| 天堂一区二区在线免费观看| 免费观看成人鲁鲁鲁鲁鲁视频| 久久99久久久久| 国产高清精品在线| 91免费版pro下载短视频| 欧美最猛性xxxxx直播| 欧美一区二区三区公司| 欧美精品一区二区三区视频| 国产精品网曝门| 亚洲黄色免费网站| 日韩av在线免费观看不卡| 久久99国产精品免费网站| 国产成人免费视频一区| 色综合久久久久综合体| 欧美美女网站色| 337p粉嫩大胆色噜噜噜噜亚洲| 国产精品久久99| 亚洲成人精品一区| 九九热在线视频观看这里只有精品| 国产精品白丝av| 色88888久久久久久影院按摩| 91精品国产综合久久久久久久| 久久久亚洲午夜电影| 亚洲另类在线制服丝袜| 日本91福利区|