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

📄 art_def.h

📁 自适应共振神经网络可以实现自动学习与分类具有自适应的功能
💻 H
字号:
/**
 *  \file Art_Def.h
 *  预定义头文件
 *  这个文件包含了ART算法需要的宏定义和结构体。
 *  
 *  \author     Wang Dasheng
 *  \version    1.0
 *  \date       2004.03.23
 */

#ifndef __ART_DEF_H__
#define __ART_DEF_H__

#ifndef TRUE
#define TRUE              1
#endif
#ifndef FALSE
#define FALSE             0
#endif

#define ALPHA             0.1
#define ART               0
#define ARTA              1
#define ARTB              2
#define ARTMAP            1
#define ART_TYPE_NONE           0       /**< ART网络类型的一种,表示该网络没有被使用。 */
#define ART_TYPE_ART1           1       /**< ART网络类型的一种,表示该网络为ART1网络。 */
#define ART_TYPE_FUZZYART       2       /**< ART网络类型的一种,表示该网络为FuzzyART网络。 */
#define ART_STYLE_NONE          0       /**< ART网络风格的一种,表示使用默认方式的风格。 */
#define ART_STYLE_COMPLIMENT    1       /**< ART网络风格的一种,表示使用推荐方式的风格。该风格使用了镜像补充数据的方式,有利于训练网络趋于稳定,同时需要2倍的输入点的空间 */
#define NODE_NONE               0       /**< 节点类型的一种,表示没有节点。 */
#define NODE_BINARY             1       /**< 节点类型的一种,表示二值量作为节点。 */
#define NODE_ANALOG             2       /**< 节点类型的一种,表示模拟量作为节点。 */

#define MAX               25


/** 
 * \struct ART网络的数据结构
 * 描述了包括ART1或Fuzzy ART两种网络的数据结构
 */
typedef struct {
    int     type;           /**< 网络类型 ART_TYPE_NONE ART_TYPE_ART1 ART_TYPE_FUZZYART  */
    int     style;          /**< 网络风格 ART_STYLE_NONE ART_STYLE_COMPLIMENT */
    int     num_inputs;     /**< 网络的输入节点数 */
    int     nodes_used;     /**< 当前使用的输出类型的节点数 */
    int     max_nodes;      /**< 当前已经分配的最大的输出类型的节点数 */

    float   beta;           /* Recoding rate.  No recoding (default) when 1    */
    float   vigil;          /* Current vigilence level                         */

    int     num_reset;      /* Number of resets during last input presentation */
    int     win_cat;        /* Winning category for last input presenation     */

    float   *cat;           /* 当前激活的节点   (size max_nodes) */
    float   *elig;          /* Eligibility of category node   (size max_nodes) */
    int     *commit;        /* Commitment  of category node   (size max_nodes) */
    float   **weight;       /* Weights intput->cat (size num_inputs*max_nodes) */
    float   *sum_weights;   /* Sum of weights for each nodes  (size max_nodes) */
    float   *sum_IW;        /* Intesection weights and inputs (size max_nodes) */

} artTYPE, *artPTR;

/*---------------------------------------------------------------------------*/
/*                        ArtMap Network Structure                           */
/*---------------------------------------------------------------------------*/
typedef struct {
    float   vigil;          /* Current mapfield vigilence level                */
    float   base_vigil;     /* Base vigilence level for the ArtA Network       */

    int     num_mismatch;   /* Number of mismatches during an presentation     */

    artTYPE artA;           /* ArtA - Input art network                        */
    artTYPE artB;           /* ArtB - Output art network                       */

    int     maxA_nodes;     /* Maximum number of allocated ArtA nodes          */
    int     maxB_nodes;     /* Maximum number of allocated ArtB nodes          */

    float   *map;           /* Activation values of the mapfield (size B)      */
    float   **map_weight;   /* weights from A nodes to mapfield  (size A x B)  */

} mapTYPE, *mapPTR;

/*---------------------------------------------------------------------------*/
/*                       General Network Structure                           */
/*---------------------------------------------------------------------------*/
typedef struct {
    int     initB;          /* Has the network been initialized - BOOLEAN    */
    int     checkB;         /* Has the net been tested against the set       */
    int     doneB;          /* Is the network done with recent training      */
    int     type;           /* ART, ARTMAP                                   */
    int     num_inputs;     /* Number of inputs to the network               */
    int     num_outputs;    /* Number of outputs from the network            */
    artTYPE art;            /* Art Network   - only used if type ART         */
    mapTYPE map;            /* Mapping Field - only used if type ARTMAP      */

    /* Some history about network training */
    int     num_patterns;   /* Number of training presentations so far       */
    int     num_epochs;     /* Number of training epochs so far              */

} netTYPE, *netPTR;


/* ========================================================================= */
/*                            Pattern Structure                              */
/* ========================================================================= */

/*---------------------------------------------------------------------------*/
/*                         Single Pattern Structure                          */
/*---------------------------------------------------------------------------*/
typedef struct {
    float       *input;     /* Vector of input patterns   (size num_inputs)  */
    float       *output;    /* Vector out output patterns (size num_outputs) */
} patTYPE,    *patPTR;

/*---------------------------------------------------------------------------*/
/*                           Pattern Set Structure                           */
/*---------------------------------------------------------------------------*/
typedef struct {
    int         initB;            /* 是否已经被初始化 */
    int         checkB;           /* Has the set been tested against the net */
    int         max_num_patterns; /* Total space allocated for patterns      */
    int         num_patterns;     /* Current number of patterns in the set   */
    int         num_inputs;       /* Size of input patterns                  */
    int         type_inputs;      /* NODE_BINARY or NODE_ANALOG                        */
    int         style_inputs;     /* Are inputs currently compliment coded   */
    int         num_outputs;      /* Size of output patterns                 */
    int         type_outputs;     /* NODE_BINARY, NODE_ANALOG or NODE_NONE                  */
    int         style_outputs;    /* Are inputs currently compliment coded   */
    patTYPE     *pattern;         /* Individual patterns (size max_num_pat)  */
} setTYPE, *setPTR;

#endif

⌨️ 快捷键说明

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