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

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

?? cluster2.c

?? 聚類算法全集以及內附數據集
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*----------------------------------------------------------------------  File    : cluster2.c  Contents: cluster and cluster set management (update functions)  Author  : Christian Borgelt  History : 05.09.2001 file created as cluster1.c            12.09.2001 function cls_init completed            15.09.2001 first version of fuzzy c-means completed            16.09.2001 hard c-means algorithm added (msexp <= 0)            09.09.2002 neural network update methods added            29.01.2003 some cleanup of neural network methods            31.01.2003 initialization for resilient method changed            18.02.2003 multiple init. in mode CLS_POINTS removed            07.06.2003 cluster size adaptation added            29.10.2003 bug in function cls_init fixed (CLS_POINTS)            22.02.2004 size computation for spherical clusters modified            23.02.2004 bug in function _quick fixed            29.02.2004 some bugs in cluster size computation fixed            01.03.2004 update functions moved to this file            02.03.2004 shape and size regularization added            19.03.2004 weight/prior regularization added            12.04.2004 competitive learning function completed            13.04.2004 regularization adapted for competitive learning            14.04.2004 treatment of (almost) empty clusters improved            15.04.2004 update function improved (loop moved)            23.04.2004 some numeric problems with high-dim. data solved            26.04.2004 more numeric problems with high-dim. data solved            27.04.2004 upper learning rate bound added (alt. est. step)            30.04.2004 rescaling removed from parameter est. functions            13.07.2004 normalization of center vectors added            15.07.2004 bug in center normalization for _complrn fixed            28.07.2004 update of centers only added to cls_update            14.08.2004 bug in initialization with CLS_POINTS fixed            18.08.2004 first version of backpropagation functions added----------------------------------------------------------------------*/#include <stdlib.h>#include <float.h>#include <math.h>#include <assert.h>#include "cluster.h"/*----------------------------------------------------------------------  Preprocessor Definitions----------------------------------------------------------------------*/#define MINVAR       1e-12      /* minimal variance */#define MAXVAR       1e+12      /* maximal variance */#define MINDET       1e-48      /* minimal determinant */#define MAXDET       1e+48      /* maximal determinant */#define MINWEIGHT    1e-6       /* minimal cluster weight *//*----------------------------------------------------------------------  Type Definitions----------------------------------------------------------------------*/typedef MATRIX* MATADDFN (MATRIX *mat, const double *vec, double wgt);typedef double  UPDATEFN (CLSET* clset, double grd, double *prv,                          double *chg);/*----------------------------------------------------------------------  Auxiliary Functions----------------------------------------------------------------------*/static double _decom (CLUSTER *p){                               /* --- decompose covariance matrix */  int    i;                     /* loop variables */  double t;                     /* buffer fro shift value */  for (t = MINVAR, i = 40; --i >= 0; t += t) {    if (mat_chdecom(p->inv, p->smp) == 0) break;    mat_diaadds(p->smp, t);     /* decompose the covariance matrix */  }                             /* and on failure shift eigenvalues */  if (i < 0) {                  /* if decomposition fails totally */    mat_init(p->smp, MAT_UNIT|MAT_NOTBUF, NULL);    mat_init(p->inv, MAT_UNIT|MAT_NOTBUF, NULL);  }                             /* set a unit covariance matrix */  return mat_chdet(p->inv);     /* return the determinant */}  /* _decom() *//*--------------------------------------------------------------------*/static void _normctr (CLSET *clset, int sum){                               /* --- normalize center vectors */  int     i, k;                 /* loop variables */  CLUSTER *p;                   /* to traverse the clusters */  double  *c;                   /* to traverse the center vector */  double  len;                  /* length of a center vector */    assert(clset);                /* check the function argument */  for (p = clset->cls +(i = clset->clscnt); --i >= 0; ) {    if ((--p)->d2 < 0) continue;/* traverse marked clusters */    c = (sum) ? p->sum : p->ctr;/* get the vector to normalize */    len = 0;                    /* initialize the length */    for (c += k = clset->incnt; --k >= 0; ) {      --c; len += *c * *c; }    /* sum the squared coordinates */    len = sqrt(len);            /* compute the vector length */    len = (len > 0)             /* and the normalization factor */        ? (sum ? mat_weight(p->smp) : 1.0) /len : 1;    if (fabs(1.0 -len) < 1e-12) continue;    for (c += k = clset->incnt; --k >= 0; )      *--c *= len;              /* normalize the center vectors */  }                             /* to unit length */}  /* _normctr() *//*--------------------------------------------------------------------*/static void _zeroctr (CLSET *clset, int sum){                               /* --- set center vectors to origin */  int     i, k;                 /* loop variables */  CLUSTER *p;                   /* to traverse the clusters */  double  *c;                   /* to traverse the center vector */  assert(clset);                /* check the function argument */  for (p = clset->cls +(i = clset->clscnt); --i >= 0; ) {    if ((--p)->d2 < 0) continue;/* traverse marked clusters */    c = (sum) ? p->sum : p->ctr;/* get the vector to zero */    for (c += k = clset->incnt; --k >= 0; )      *--c = 0;                 /* set all coordinates to zero */  }                             /* (move vector to origin) */}  /* _zeroctr() *//*----------------------------------------------------------------------  Gradient Function----------------------------------------------------------------------*/static void _gradient (CLSET *clset){                               /* --- gradient based update */  /* ... to be done ... */}  /* _gradient() *//*----------------------------------------------------------------------  Alternating Optimization Function----------------------------------------------------------------------*/static void _altopt (CLSET *clset){                               /* --- alternating optimization */  int     n;                    /* loop variable */  int     type;                 /* cluster type flags */  CLUSTER *p;                   /* to traverse the clusters */  double  det;                  /* determinant of covariance matrix */  assert(clset);                /* check the function argument */  if (clset->method & CLS_ORIGIN)  /* if cluster centers at origin, */    _zeroctr(clset, 1);            /* zero the center vectors */  if (clset->method & CLS_UNIT)    /* if centers on unit sphere, */    _normctr(clset, 1);            /* normalize the center vectors */  type = clset->type;           /* get the cluster type flags */  for (p = clset->cls +(n = clset->clscnt); --n >= 0; ) {    (--p)->nw *= clset->msd[1]; /* normalize cluster weights to sum 1 */    if (p->d2 < 0) continue;    /* skip clusters not to be updated */    if (type & CLS_COVARS) {    /* -- if adaptable covariances */      mat_covar(p->smp, p->smp, 1); /* compute new covariances */      det    = _decom(p);           /* and decompose the matrix */      p->msd = ((det >= MINDET) && (det <= MAXDET))             ? pow(det,            1.0/clset->incnt)             : exp(mat_chlogd(p->inv) /clset->incnt); }    else if (type & CLS_VARS) { /* -- if adaptable variances */      mat_var(p->smp, p->smp, 1);   /* compute new variances */      det    = mat_diaprod(p->smp); /* and the new determinant */      p->msd = ((det >= MINDET) && (det <= MAXDET))             ? pow(det,            1.0/clset->incnt)             : exp(mat_dialog(p->smp) /clset->incnt); }    else if (type & CLS_SIZE)   /* -- if adaptable isotropic variance */      p->msd = mat_isovar(p->sum, p->smp, 1);    else {                      /* -- if fixed isotropic variance */      mat_mean(p->sum, p->smp); /* compute only the mean values */      p->msd = p->var;          /* (i.e. a new cluster center) */    }                           /* copy the old isotropic variance */    if      (p->msd < MINVAR) p->msd = MINVAR;    else if (p->msd > MAXVAR) p->msd = MAXVAR;  }                             /* clamp the variance */}  /* _altopt() *//*----------------------------------------------------------------------  Competitive Learning Function----------------------------------------------------------------------*/static void _complrn (CLSET *clset){                               /* --- competitive learning */  int     i, n;                 /* loop variables */  int     type;                 /* cluster type flags */  CLUSTER *p;                   /* to traverse the clusters */  double  *s, *c;               /* to access the vectors */  double  lrc, lrv = 0, lrw = 0;/* learning rates */  double  eta, dec;             /* learning rate derivates */  double  t, d;                 /* temporary buffers */  assert(clset);                /* check the function argument */  /* --- compute learning rates --- */  t   = clset->decays[0];       /* get the decay parameter and */  lrc = clset->lrates[0];       /* compute the next learning rate */  if ((t > 0) && (t < 1)) lrc *= pow(t, clset->steps);  else if        (t < 0)  lrc *= pow(clset->steps+1, t);  type = clset->type;           /* get the cluster type flags */  if (type & (CLS_COVARS|CLS_VARS|CLS_SIZE)) {    t   = clset->decays[1];     /* get the decay parameter and */    lrv = clset->lrates[1];     /* compute the next learning rate */    if ((t > 0) && (t < 1)) lrv *= pow(t, clset->steps);    else if        (t < 0)  lrv *= pow(clset->steps+1, t);  }                             /* (learning rate for (co)variances) */  if (type & CLS_WEIGHT) {      /* if adaptable weights */    t   = clset->decays[2];     /* get the decay parameter and */    lrw = clset->lrates[2];     /* compute the next learning rate */    if ((t > 0) && (t < 1)) lrw *= pow(t, clset->steps);    else if        (t < 0)  lrw *= pow(clset->steps+1, t);  }                             /* (learning rate for weights) */  clset->steps++;               /* count the update step */  /* --- compute new parameters --- */  for (p = clset->cls +(n = clset->clscnt); --n >= 0; ) {    (--p)->nw *= clset->msd[1]; /* normalize cluster weights to sum 1 */    if (type & CLS_WEIGHT)      /* and compute new cluster weights */      p->nw = (1 -lrw) *p->wgt +lrw *p->nw;    if (p->d2 < 0) continue;    /* skip clusters not to be updated */    t = mat_weight(p->smp);     /* get the aggregation weight and */    eta = (t < 1) ? lrc : lrc/t;/* compute the learning rate and */    s = p->sum; c = p->ctr;     /* get aggregation vector and center */    for (i = clset->incnt; --i >= 0; )      s[i] = c[i] +eta *s[i];   /* compute new center coordinates */    /* Here p->sum is the aggregate of the difference vectors to the */    /* cluster centers and *not* the aggregate of the data vectors   */    /* as for alternating estimation/fuzzy clustering. Hence there   */    /* is no decay factor for the old cluster center p->ctr.         */    if (t < 1) { eta = lrv;   dec = 1 -lrv*t; }    else       { eta = lrv/t; dec = 1 -lrv;   }    dec *= p->scl;              /* compute learning rate and compl. */    if (type & CLS_COVARS) {    /* -- if adaptable covariances */      mat_trmuls(p->smp, p->smp, MAT_UPPER, eta);      if (dec > 0) mat_addx(p->smp, p->smp, dec, p->cov, MAT_UPPER);      d      = _decom(p);       /* update the covariance matrix */      p->msd = ((d >= MINDET) && (d <= MAXDET))             ? pow(d,              1.0/clset->incnt)             : exp(mat_chlogd(p->inv) /clset->incnt); }    else if (type & CLS_VARS) { /* -- if adaptable variances */      for (d = 1, i = clset->incnt; --i >= 0; ) {        t = ((dec > 0) ? dec *mat_get(p->cov, i, i) : 0)                       + eta *mat_get(p->smp, i, i);        if      (t < MINVAR) t = MINVAR;        else if (t > MAXVAR) t = MAXVAR;        d *= mat_set(p->smp, i, i, t);      }                         /* update the covariance matrix */      p->msd = ((d >= MINDET) && (d <= MAXDET))             ? pow(d,              1.0/clset->incnt)             : exp(mat_dialog(p->smp) /clset->incnt); }    else if (type & CLS_SIZE) { /* -- if adaptable isotropic var. */      d = mat_diaprod(p->smp);  /* update the isotropic variance */      t = ((d >= MINDET) && (d <= MAXDET))        ? pow(d,              1.0/clset->incnt)        : exp(mat_dialog(p->smp) /clset->incnt);      p->msd = ((dec > 0) ? dec *p->var : 0) +eta *t; }    else p->msd = p->var;       /* copy the isotropic variance */    if      (p->msd < MINVAR) p->msd = MINVAR;    else if (p->msd > MAXVAR) p->msd = MAXVAR;  }                             /* clamp the variance */  if (clset->method & CLS_ORIGIN)  /* if cluster centers at origin, */    _zeroctr(clset, 1);            /* zero the center vectors */  if (clset->method & CLS_UNIT)    /* if centers on unit sphere, */    _normctr(clset, 1);            /* normalize the center vectors */}  /* _complrn() *//*----------------------------------------------------------------------  Error Backpropagation Function----------------------------------------------------------------------*/static void _backprop (CLSET *clset){                               /* --- error backpropagation */  int     i, n;                 /* loop variables */  int     type;                 /* cluster type flags */  CLUSTER *p;                   /* to traverse the clusters */  double  *s, *c;               /* to access the vectors */  double  lrc, lrv, d, t;       /* learning rates, buffers */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人免费黄色大片| 久久久九九九九| 91麻豆国产福利在线观看| 国内外精品视频| 激情另类小说区图片区视频区| 午夜精品一区二区三区三上悠亚| 一级特黄大欧美久久久| 一区二区三区四区不卡在线| 亚洲午夜免费电影| 亚洲国产精品一区二区www| 国产二区国产一区在线观看| 国产精品一区二区免费不卡 | 国产综合久久久久影院| 日本视频一区二区三区| 久久超碰97中文字幕| 国产精品一区二区三区网站| 成人av小说网| 在线观看不卡视频| 欧美一区二区在线观看| 久久日一线二线三线suv| 亚洲国产精品精华液ab| 一卡二卡欧美日韩| 麻豆91精品91久久久的内涵| 久久精品久久99精品久久| 国产盗摄精品一区二区三区在线 | 男男视频亚洲欧美| 国产一区二区在线免费观看| 波多野结衣在线一区| 在线观看成人小视频| 精品理论电影在线| 亚洲日本在线a| 日本中文一区二区三区| www.亚洲精品| 欧美一区二区在线视频| 国产精品久久久久精k8| 午夜日韩在线电影| 国产电影精品久久禁18| 欧美日韩亚洲另类| 国产精品网曝门| 日本伊人午夜精品| 9人人澡人人爽人人精品| 日韩视频免费观看高清在线视频| 中文字幕在线观看不卡| 日韩在线一二三区| 91麻豆成人久久精品二区三区| 日韩精品专区在线| 一区二区三区精品在线观看| 国产精品中文字幕日韩精品| 欧美中文字幕不卡| 亚洲欧洲日产国码二区| 国产在线精品一区二区| 欧美日韩国产精选| 亚洲欧美精品午睡沙发| 国产高清在线观看免费不卡| 日韩视频123| 夜夜精品浪潮av一区二区三区| 麻豆91精品视频| 欧美精品九九99久久| 中文字幕av一区二区三区免费看| 久久国内精品视频| 欧美精品在线视频| 亚洲电影一区二区| 波多野结衣中文字幕一区| 国产日韩欧美精品一区| 婷婷综合久久一区二区三区| 欧美亚洲高清一区二区三区不卡| 一色桃子久久精品亚洲| 波多野结衣一区二区三区| 日本一区二区三级电影在线观看 | youjizz久久| 久久精品人人做人人爽人人| 国内精品自线一区二区三区视频| 亚洲一二三级电影| 在线免费一区三区| 亚洲午夜一区二区三区| 欧美日本韩国一区二区三区视频 | 91精品福利在线一区二区三区| 一个色在线综合| 欧美午夜精品久久久| 中文字幕一区二区三| 色综合色狠狠天天综合色| 亚洲少妇30p| 91成人在线观看喷潮| 一区二区免费在线| 欧美日韩国产一区| 蜜桃久久久久久| 久久精品夜色噜噜亚洲aⅴ| 国产精品影音先锋| 中文字幕一区二区三区在线不卡| 91日韩在线专区| 亚洲成av人片观看| 日韩精品一二三区| 精品88久久久久88久久久| 国产成人高清在线| 一区二区三区在线视频免费 | 福利一区二区在线| 国产精品免费久久| 欧美日韩亚州综合| 日韩欧美一级二级| 福利91精品一区二区三区| 亚洲黄色av一区| 日韩一区二区免费在线电影| 国产精品一区二区在线观看不卡| 日韩理论片中文av| 欧美一二三区精品| 成人开心网精品视频| 亚洲电影欧美电影有声小说| 26uuu成人网一区二区三区| 白白色亚洲国产精品| 欧美综合色免费| 国产美女精品一区二区三区| 亚洲欧美国产高清| 精品国产乱码久久久久久影片| 99久久伊人久久99| 美女脱光内衣内裤视频久久影院| 中文字幕不卡在线观看| 日韩亚洲欧美一区二区三区| av中文字幕亚洲| 日韩av成人高清| 亚洲女同ⅹxx女同tv| 国产在线精品国自产拍免费| 一区二区国产视频| 国产精品毛片久久久久久久| 日韩一级成人av| 欧美吻胸吃奶大尺度电影 | 久久99国产乱子伦精品免费| 亚洲三级小视频| 国产农村妇女精品| 麻豆久久久久久| 亚洲综合999| 中文字幕在线一区二区三区| 精品国产三级a在线观看| 欧美日韩精品免费观看视频| 91在线一区二区| 夫妻av一区二区| 国产91精品免费| 国产高清成人在线| 久久精品国产99| 奇米777欧美一区二区| 亚洲成人午夜影院| 欧美视频一区在线观看| 99国产麻豆精品| 国产成人久久精品77777最新版本| 日本成人超碰在线观看| 午夜国产精品影院在线观看| 一区二区三区中文字幕在线观看| 1区2区3区欧美| 1024国产精品| 一区二区三区在线影院| 亚洲丝袜精品丝袜在线| 亚洲欧美日韩中文播放 | 国产精品卡一卡二| 国产天堂亚洲国产碰碰| 国产性天天综合网| 国产日本欧洲亚洲| 国产精品久久久久影院色老大| 国产日韩欧美高清在线| 国产精品视频一二三区| 中文字幕一区av| 亚洲欧美色综合| 亚洲成年人影院| 国内久久精品视频| 国产高清成人在线| 色综合咪咪久久| 欧美日本国产视频| 26uuu色噜噜精品一区二区| 久久久午夜电影| 亚洲欧洲一区二区在线播放| 亚洲另类色综合网站| 亚洲精品videosex极品| 午夜av区久久| 国产美女精品人人做人人爽| caoporen国产精品视频| 欧美日韩一级二级| 日韩欧美一区二区不卡| 国产精品视频免费| 亚洲国产日韩一级| 精品一区二区三区蜜桃| 成人国产一区二区三区精品| 在线免费观看一区| 精品国内二区三区| 国产精品久久99| 丝袜美腿亚洲色图| 国产成人免费在线观看不卡| 91黄色免费看| 久久先锋影音av鲁色资源| 亚洲乱码国产乱码精品精的特点| 免费成人你懂的| 成人av在线看| 欧美一级理论性理论a| 亚洲欧美影音先锋| 理论电影国产精品| 91久久香蕉国产日韩欧美9色| 欧美va天堂va视频va在线| 亚洲天堂a在线| 国产裸体歌舞团一区二区| 欧美视频在线一区二区三区| 国产欧美精品区一区二区三区| 无码av免费一区二区三区试看| 国产91富婆露脸刺激对白|