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

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

?? art2.c

?? 各種神經網絡C源代碼。包括: CPN、BPN、ART1、ART2
?? C
?? 第 1 頁 / 共 2 頁
字號:
/**************************************************************************
 **************************************************************************
 ***									***
 ***				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];

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产福利在线观看| 国产美女精品在线| 欧美性色欧美a在线播放| 亚洲精品成人少妇| 色激情天天射综合网| 最新国产精品久久精品| 99久久国产综合精品女不卡| 亚洲视频免费观看| 欧美日韩一级视频| 另类的小说在线视频另类成人小视频在线 | 日本一区二区久久| 成人黄色小视频| 亚洲精选在线视频| 日韩视频在线你懂得| 国产精华液一区二区三区| 中文字幕一区二区5566日韩| 欧美视频在线一区二区三区| 精品一区二区三区影院在线午夜 | 成人激情综合网站| 亚洲在线免费播放| 日韩欧美成人一区二区| 国产成人在线网站| 亚洲一区日韩精品中文字幕| 亚洲国产精品自拍| 欧美成人一区二区三区| av一本久道久久综合久久鬼色| 亚洲丰满少妇videoshd| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 亚洲第四色夜色| 国产日韩欧美在线一区| 欧美日韩国产一二三| 成人永久免费视频| 日本亚洲天堂网| 亚洲丝袜另类动漫二区| 精品国产欧美一区二区| 91福利视频久久久久| 国产精品1024| 免费高清成人在线| 亚洲自拍偷拍综合| 国产精品久久久久天堂| 日韩视频免费观看高清在线视频| 99re热视频精品| 国产呦精品一区二区三区网站| 午夜视频在线观看一区| 国产精品家庭影院| 亚洲精品一区二区三区影院| 欧美喷水一区二区| 99re热这里只有精品免费视频 | 国产精品系列在线播放| 亚洲成年人影院| 日韩毛片一二三区| 亚洲国产精品成人综合色在线婷婷 | 国产精品美女久久久久av爽李琼 | 亚洲日本在线看| 精品欧美一区二区久久| 欧美日韩国产在线观看| 91影院在线免费观看| 国产91精品在线观看| 精品一区二区三区免费毛片爱| 亚洲一二三级电影| 亚洲裸体在线观看| 综合分类小说区另类春色亚洲小说欧美| 精品日韩在线观看| 日韩视频免费观看高清完整版| 欧美在线短视频| 日本久久电影网| 91影院在线观看| 91丨九色丨尤物| 91麻豆精品在线观看| 不卡免费追剧大全电视剧网站| 国产一区二区按摩在线观看| 国产在线日韩欧美| 黄页视频在线91| 国产成人免费高清| 国产成人免费xxxxxxxx| 国产69精品久久久久777| 国产精品一区在线观看你懂的| 黑人巨大精品欧美黑白配亚洲| 精品一区二区免费视频| 国内精品不卡在线| 国产成人综合亚洲网站| 国产成人av电影在线| 成人污污视频在线观看| 成人黄色国产精品网站大全在线免费观看| 国产成人免费9x9x人网站视频| 成人免费视频视频在线观看免费| av男人天堂一区| 91浏览器打开| 欧美日韩久久一区| 日韩午夜电影av| 欧美韩国日本不卡| 亚洲男人的天堂一区二区| 亚洲一区在线看| 激情小说欧美图片| 丁香婷婷综合网| 色88888久久久久久影院按摩| 欧美三级电影精品| 日韩欧美久久久| 国产女人aaa级久久久级| 亚洲色图在线看| 三级欧美在线一区| 国产一区二区三区国产| 99久久亚洲一区二区三区青草| 在线影视一区二区三区| 日韩欧美电影一二三| 国产精品美女久久久久久久久 | 2023国产精品| 亚洲乱码国产乱码精品精小说 | 紧缚捆绑精品一区二区| 成人夜色视频网站在线观看| 色婷婷av一区二区三区之一色屋| 欧美日韩dvd在线观看| 欧美不卡一区二区三区四区| 亚洲国产岛国毛片在线| 亚洲图片有声小说| 国产专区综合网| 在线精品国精品国产尤物884a| 日韩精品一区二区三区在线观看| 久久久蜜桃精品| 一区二区三区免费网站| 精品一区二区成人精品| 91免费精品国自产拍在线不卡| 91精品久久久久久蜜臀| 国产精品卡一卡二卡三| 视频一区在线视频| aa级大片欧美| 精品日韩欧美在线| 一区二区三国产精华液| 国产一区二三区| 欧美日韩国产三级| 欧美国产97人人爽人人喊| 日韩和欧美一区二区三区| 成人综合在线观看| 日韩一区二区影院| 夜夜爽夜夜爽精品视频| 国产伦精品一区二区三区在线观看| 欧美性一二三区| 国产精品久久久久四虎| 极品少妇一区二区三区精品视频| 色综合一个色综合亚洲| 国产欧美一区二区精品婷婷| 强制捆绑调教一区二区| 欧美午夜精品免费| 国产精品国产三级国产三级人妇| 久久精品国产999大香线蕉| 欧美色综合天天久久综合精品| 中文字幕亚洲电影| 粉嫩一区二区三区在线看| 精品国产麻豆免费人成网站| 日日夜夜免费精品| 欧美日韩国产精选| 亚洲男人的天堂av| aaa欧美色吧激情视频| 国产农村妇女毛片精品久久麻豆| 六月婷婷色综合| 91精品欧美久久久久久动漫| 亚洲第一福利一区| 在线观看网站黄不卡| 亚洲日本在线a| 色狠狠桃花综合| 亚洲欧美日韩成人高清在线一区| 成人国产在线观看| 国产精品视频线看| 成人晚上爱看视频| 国产精品午夜免费| 波多野结衣的一区二区三区| 蜜臀av性久久久久av蜜臀妖精| 91精品黄色片免费大全| 日韩国产精品大片| 欧美一区二区三区公司| 理论电影国产精品| 久久久亚洲午夜电影| 国产精品自拍三区| 中文字幕成人网| 91丨九色丨尤物| 亚洲第一精品在线| 日韩免费视频线观看| 国内成人自拍视频| 国产精品国产三级国产普通话蜜臀 | 自拍偷拍亚洲综合| 91黄色在线观看| 丝瓜av网站精品一区二区| 欧美一区二区三区人| 国产乱码精品一区二区三区忘忧草 | 久久综合九色综合97婷婷女人| 国产一区二区三区电影在线观看| 久久精品视频免费| av午夜一区麻豆| 亚洲成人激情自拍| 欧美成人性战久久| 东方欧美亚洲色图在线| 亚洲最新视频在线播放| 欧美日韩精品系列| 黄色精品一二区| 中文字幕日本乱码精品影院| 欧美日韩中文一区| 国产精品一区在线观看乱码| 99在线精品观看| 亚洲一区中文日韩| 久久精品一区二区三区av|