📄 demogng.java
字号:
// ========================================================================== ;// ;// Copyright (1996-1998) Hartmut S. Loos ;// ;// Institut f"ur Neuroinformatik ND 03 ;// Ruhr-Universit"at Bochum ;// 44780 Bochum ;// ;// Tel : +49 234 7007845 ;// Email: Hartmut.Loos@neuroinformatik.ruhr-uni-bochum.de ;// ;// Version 1.5 (19.10.1998) ==> DGNG_VERSION (computeGNG.java) ;// ;// ========================================================================== ;// ;// Possible values for the <param>-tag: ;// algorithm: ;// - nothing => start applet with GNG ;// - name=algorithm value="GG" \ ;// - name=algorithm value="GNG" \ ;// - name=algorithm value="GNG-U" \ ;// - name=algorithm value="HCL" \ Start applet with ;// - name=algorithm value="NG" > algorithm named ;// - name=algorithm value="NGwCHL" / in value. ;// - name=algorithm value="CHL" / ;// - name=algorithm value="LBG" / ;// - name=algorithm value="LBG-U" / ;// - name=algorithm value="SOM" / ;// distribution: ;// - nothing => Rectangle ;// - name=distribution value="Discrete" \ ;// - name=distribution value="Rectangle" \ ;// - name=distribution value="Circle" \ ;// - name=distribution value="Ring" \ ;// - name=distribution value="UNI" \ Start with ;// - name=distribution value="Small Spirals" \ distribution ;// - name=distribution value="Large Spirals" / named in ;// - name=distribution value="HiLo Density" / value. ;// - name=distribution value="UNIT" / ;// - name=distribution value="Move & Jump" / ;// - name=distribution value="Move" / ;// - name=distribution value="Jump" / ;// - name=distribution value="Right MouseB" / ;// ;// ========================================================================== ;// ;// Copyright 1996-1998 Hartmut S. Loos ;// ;// This program is free software; you can redistribute it and/or modify ;// it under the terms of the GNU General Public License as published by ;// the Free Software Foundation; either version 1, or (at your option) ;// any later version. ;// ;// This program is distributed in the hope that it will be useful, ;// but WITHOUT ANY WARRANTY; without even the implied warranty of ;// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;// GNU General Public License for more details. ;// ;// You should have received a copy of the GNU General Public License ;// along with this program; if not, write to the Free Software ;// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ;// ;// ========================================================================== ;import java.applet.*;import java.awt.*;/** * A class drawing the GUI and interact with the user. * */public class DemoGNG extends Applet { final static int GNG_C = 5; final static int HCL_C = 1; final static int NG_C = 2; final static int NGwCHL_C = 4; final static int CHL_C = 3; final static int LBG_C = 0; final static int GG_C = 7; final static int SOM_C = 6; /** * The name of the first algorithm. */ protected final static String ALGO_0 = "Growing Neural Gas / GNG-U"; /** * The abbreviation of the first algorithm. */ protected final static String ALGO_ABBREV_0 = "GNG"; /** * The abbreviation of the utility version of the first algorithm. */ protected final static String ALGO_ABBREV_0_U = "GNG-U"; /** * The name of the second algorithm. */ protected final static String ALGO_1 = "Hard Competitive Learning"; /** * The abbreviation of the second algorithm. */ protected final static String ALGO_ABBREV_1 = "HCL"; /** * The name of the third algorithm. */ protected final static String ALGO_2 = "Neural Gas"; /** * The abbreviation of the third algorithm. */ protected final static String ALGO_ABBREV_2 = "NG"; /** * The name of the fourth algorithm. */ protected final static String ALGO_3 = "Neural Gas with CHL"; /** * The abbreviation of the fourth algorithm. */ protected final static String ALGO_ABBREV_3 = "NGwCHL"; /** * The name of the fifth algorithm. */ protected final static String ALGO_4 = "Competitive Hebbian Learning"; /** * The abbreviation of the fifth algorithm. */ protected final static String ALGO_ABBREV_4 = "CHL"; /** * The name of the sixth algorithm. */ protected final static String ALGO_5 = "LBG / LBG-U"; /** * The abbreviation of the sixth algorithm. */ protected final static String ALGO_ABBREV_5 = "LBG"; /** * The abbreviation of the utility version of the sixth algorithm. */ protected final static String ALGO_ABBREV_5_U = "LBG-U"; /** * The name of the seventh algorithm. */ protected final static String ALGO_6 = "Growing Grid"; /** * The abbreviation of the seventh algorithm. */ protected final static String ALGO_ABBREV_6 = "GG"; /** * The name of the eighth algorithm. */ protected final static String ALGO_7 = "Self-Organizing Map"; /** * The abbreviation of the eighth algorithm. */ protected final static String ALGO_ABBREV_7 = "SOM"; /** * The name of the first distribution. */ protected final static String DISTRIB_0 = "Rectangle"; /** * The name of the second distribution. */ protected final static String DISTRIB_1 = "Circle"; /** * The name of the third distribution. */ protected final static String DISTRIB_2 = "Ring"; /** * The name of the fourth distribution. */ protected final static String DISTRIB_3 = "UNI"; /** * The name of the fifth distribution. */ protected final static String DISTRIB_4 = "Small Spirals"; /** * The name of the sixth distribution. */ protected final static String DISTRIB_5 = "Large Spirals"; /** * The name of the seventh distribution. */ protected final static String DISTRIB_6 = "HiLo Density"; /** * The name of the eighth distribution. */ protected final static String DISTRIB_7 = "Discrete"; /** * The name of the ninth distribution. */ protected final static String DISTRIB_8 = "UNIT"; /** * The name of the tenth distribution. */ protected final static String DISTRIB_9 = "Move & Jump"; /** * The name of the eleventh distribution. */ protected final static String DISTRIB_10 = "Move"; /** * The name of the twelfth distribution. */ protected final static String DISTRIB_11 = "Jump"; /** * The name of the 13th distribution. */ protected final static String DISTRIB_12 = "Right MouseB"; /** * The name of the start button. */ protected final static String BUTTON_0 = "Start"; /** * The name of the stop button. */ protected final static String BUTTON_1 = "Stop"; /** * The name of the reset button. */ protected final static String BUTTON_3 = "Reset"; /** * The name of the signal checkbox. */ protected final static String SIGNALS = " Signals"; /** * The name of the no_new_nodes checkbox. */ protected final static String NO_NEW_NODES = " No new Nodes"; /** * The name of the utility checkbox. */ protected final static String UTILITY_GNG = " Utility ="; /** * The name of the LBG-U checkbox. */ protected final static String LBG_U = " LBG-U"; /** * The name of the sound checkbox. */ protected final static String SOUND = " Sound"; /** * The name of the hardcopy checkbox. */ protected final static String WHITE = " White"; /** * The name of the random-init checkbox. */ protected final static String RNDINIT = " Random Init"; /** * The name of the teach checkbox. */ protected final static String TEACH = " Teach"; /** * The name of the variable checkbox (HCL). */ protected final static String VARIABLE = " Variable"; /** * The name of the edges checkbox. */ protected final static String EDGES = " Edges"; /** * The name of the nodes checkbox. */ protected final static String NODES = " Nodes"; /** * The name of the error graph checkbox. */ protected final static String ERRORGRAPH = " Error Graph"; /** * The name of the Voronoi checkbox. */ protected final static String VORONOI = " Voronoi"; /** * The name of the Delaunay checkbox. */ protected final static String DELAUNAY = " Delaunay"; ComputeGNG compute; Panel cards; Panel p11; Panel p71; Label epsilonHCL_lbl; Label epsiloniHCL_lbl; Label epsilonfHCL_lbl; Label tmaxHCL_lbl; Label nodes_lbl; Checkbox noNodes_cb; Checkbox utilityGNG_cb; Checkbox LBG_U_cb; Checkbox variable_cb; Checkbox errorGraph_cb; Choice algo_choice; Choice distrib_choice; Choice stepSize_choice; Choice speed_choice; Choice nodes_choice; Choice newNodeGNG_choice; Choice delEdgeGNG_choice; Choice epsilonGNG1_choice; Choice epsilonGNG2_choice; Choice alphaGNG_choice; Choice betaGNG_choice; Choice utilityGNG_choice; Choice epsilonHCL_choice; Choice epsiloniHCL_choice; Choice epsilonfHCL_choice; Choice tmaxHCL_choice; Choice lambdaiNG_choice; Choice lambdafNG_choice; Choice epsiloniNG_choice; Choice epsilonfNG_choice; Choice tmaxNG_choice; Choice lambdaiCHL_choice; Choice lambdafCHL_choice; Choice epsiloniCHL_choice; Choice epsilonfCHL_choice; Choice tmaxCHL_choice; Choice edgeiCHL_choice; Choice edgefCHL_choice; Choice discreteNumSignalsLBG_choice; Choice lambdagGG_choice; Choice lambdafGG_choice; Choice epsiloniGG_choice; Choice epsilonfGG_choice; Choice sigmaGG_choice; Choice epsiloniSOM_choice; Choice epsilonfSOM_choice; Choice sigmaiSOM_choice; Choice sigmafSOM_choice; Choice tmaxSOM_choice; Choice sizeSOM_choice; int sizeSOM_index = 0; Button start_b; Button stop_b; Button restart_b; /** * The array for the stepsize. * To add or delete values to the choice, only this array must be changed. */ protected int stepSize_Ai[] = {50, 1, 2, 5, 10, 20, 40, 80, 100, 150, compute.MAX_STEPSIZE}; /** * The array for the machine speed. * To add or delete values to the choice, change this array and speed_As[]. */ protected int speed_Ai[] = {150, 10, 20, 50, 100, 200, 300, 400}; /** * The array for the machine speed names. * To add or delete values to the choice, change this array and speed_Ai. */ protected String speed_As[] = {"Normal", "Lightning", "Very fast", "Fast", "Medium fast", "Medium slow", "Slow", "Very slow"}; /** * The array for the maximum number of nodes. * To add or delete values to the choice, only this array must be changed. */ protected int nodes_Ai[] = {100, 1, 2, 3, 4, 5, 10, 20, 50, 150, 200, compute.MAX_NODES}; /** * The array for the maximum age of an edge. * To add or delete values to the choice, only this array must be changed. */ protected int delEdgeGNG_Ai[] = {88, 10, 20, 50, 100, 200, 400, 800};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -