📄 artmap.cpp
字号:
/**
* \file
* artmap.cpp - Implementation of Distributed ARTMAP
*
* Copyleft (C) - Boston University CELEST Technology Laboratory
*/
/*!@mainpage ARTMAP Module Documentation
These pages describe the implementation of the ARTMAP algorithm (see
<a href="http://profusion.bu.edu/techlab/modules/mydownloads/viewcat.php?op=&cid=2">articles here</a>)
used in <a href="http://profusion.bu.edu/techlab/modules/mydownloads/viewcat.php?op=&cid=49">Classer</a>.
The code implements the Distributed ARTMAP model, but with the appropriate RunModeType setting, it also implements the
Fuzzy ARTMAP, default ARTMAP and instance-counting ARTMAP models. More specifically, it unifies the algorithms
published in:\n\n
<TABLE border="0"><TR><TD><a href="http://profusion.bu.edu/techlab/modules/mydownloads/visit.php?cid=2&lid=25">
Default ARTMAP</a></TD><TD> Carpenter, G.A. (2003). Default ARTMAP. Proceedings of the International Joint
Conference on Neural Networks (IJCNN'03), Portland, Oregon. </TD></TR>
<TR><TD><a href="http://profusion.bu.edu/techlab/modules/mydownloads/visit.php?cid=2&lid=16">
Distributed ARTMAP</a></TD><TD> Carpenter, G.A., Milenova, B., & Noeske, B. (1998). dARTMAP: A neural network
for fast distributed supervised learning. Neural Networks, 11, 793-813</TD></TR>
</TABLE>
\image html "ARTMAP Notation.png" "ARTMAP Notation"
The four available ARTMAP models differ in whether their category representation during
training and testing is winner-take-all (wta) or distributed, as well as in whether or not categories
are weighted by the number of training samples they encode (instance counting). These differences
are summarized by the following table:\n\n
<CENTER>
<TABLE border="0"><TR><TD></TD><TD><b>Training</b></TD><TD><b>Testing</b></TD><TD><b>Instance Counting</b></TD></TR>
<TR><TD><b>Fuzzy</b></TD><TD>wta</TD><TD>wta</TD><TD><CENTER>N</CENTER></TD></TR>
<TR><TD><b>Default</b></TD><TD>wta</TD><TD>distributed</TD><TD><CENTER>N</CENTER></TD></TR>
<TR><TD><b>IC</b></TD><TD>wta</TD><TD>distributed</TD><TD><CENTER>Y</CENTER></TD></TR>
<TR><TD><b>Distributed</b></TD><TD>distributed</TD><TD>distributed</TD><TD><CENTER>Y</CENTER></TD></TR>
</TABLE></CENTER>\n
Based on which of the four models is chosen, different paths are taken through the implementation
and different predictive results are obtained when evaluating data sets. Flowcharts documenting the
implementations are shown in the documentation for the train() and test() methods of the artmap class.
@section LicensingSection Licensing Policy
The ARTMAP implementation described here has been developed by Siegfried Martens,
working in the CELEST Technology Laboratory, in the Department of Cognitive and Neural Systems
at Boston University, Boston, Massachusetts, USA.\n\n
It is made available to the general public under the terms of Copyleft, as defined by the
<a href="http://www.fsf.org/">Free Software Foundation</a> (see discussion
<a href="http://www.gnu.org/copyleft/copyleft.html">here</a> for example).
As such, it is available free of charge, and may be copied, redistributed, or modified,
as long as any resulting work is distributed under the same terms of Copyleft.
*/
#include <iostream>
#include <math.h>
#include <string>
#include "util.h"
#include "artmap.h"
using namespace std;
const float default_RhoBar = 0.0f; /**< Default training vigilance */
const float default_RhoBarTest = 0.0f; /**< Default test vigilance */
const float default_Alpha = 0.01f; /**< Default training vigilance */
const float default_Beta = 1.0f; /**< Default choice law parameter */
const float default_Eps = -0.001f; /**< Default match tracking increment */
const float default_P = 1.0f; /**< Default increased-gradient power law parameter */
const artmap::RunModeType default_NetworkType = artmap::DEFAULT; /**< Default for ARTMAP model type */
const int default_initNumNodes = 20000; /**< Number of potential F2 nodes */
const float default_F2growthRate = 2.0; /**< Not currently in use */
static bool isFromTie; /**< Tracks whether winner was chosen at random due to a tie */
/**
Trains the artmap network: Given input vector a, predict target class K.
@param a - Input values 0..M-1, each in [0, 1]
@param K - Target class, in 0..L-1
The code implements the logic shown in the following flowchart.
- Only the distributed model uses the left-hand branches (labeled 'distrib').
The Fuzzy, Default and IC models all use the right-hand 'wta' branches.
- The path via the 揘ew Node
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -