home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / source / luschsrc.sit / neural.c.bin < prev    next >
MacBinary  |  1990-05-23  |  4.3 KB  |  [TEXT/KAHL]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: neural.c.bin

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert AMOS Picture Packer (image/amosPicturePacker) ext Supported
1% dexvert Debian floppy split (archive/debianFloppySplit) ext Unsupported
1% dexvert Sound Images sound sample (audio/soundImagesSoundSample) ext Unsupported
1% dexvert DESI-III drawing (image/desiIIIDrawing) ext Unsupported
1% dexvert MS-DOS PMODE extender executable (executable/msdosPMODEExtenderExecutable) ext Unsupported
1% dexvert Alien Trilogytextures (other/alienTrilogyTextures) ext Unsupported
1% dexvert APT cache data (other/aptCacheData) ext Unsupported
1% dexvert CorelTRACE configuration (other/corelTRACEConfiguration) ext Unsupported
1% dexvert Dreamcast Disc (other/dreamcastDisc) ext Unsupported
1% dexvert EST flat binary (other/estFlatBinary) ext Unsupported
1% dexvert Finale Enigma Binary Format (other/finaleEnigmaBinaryFormat) ext Unsupported
1% dexvert Sega Genesis/Megadrive/32x ROM (other/genesisROM) ext Unsupported
1% dexvert Myth: The Fallen Lords game archive (other/mythTheFallenLordsGameArchive) ext Unsupported
1% dexvert Sound Images Sound Driver (other/soundImagesSoundDriver) ext Unsupported
1% dexvert Symantec/Norton Config (other/symantecNortonConfig) ext Unsupported
1% dexvert Vectrex ROM (other/vectrexROM) ext Unsupported
1% dexvert BIS raP encoded format (other/bisraPEncoded) ext Unsupported
1% dexvert Pascal Script binary (other/pascalScriptBinary) ext Unsupported
1% dexvert 7th Level game data archive (other/seventhLevelGameDataArchive) ext Unsupported
1% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Binary Text (image/binaryText) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary, Thu Jul 20 04:02:14 1989, modified Fri Jan 26 14:43:32 1990, creator Think C, type ASCII, 4130 bytes "neural.c" default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 1 default (weak)
100% lsar MacBinary default
100% gt2 MAC Bilddatei default (weak)


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[KAHL]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 6e 65 75 72 61 6c | 2e 63 00 00 00 00 00 00 |..neural|.c......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4b 41 48 | 4c 00 00 00 00 00 00 00 |.TEXTKAH|L.......|
|00000050| 00 00 00 00 00 10 22 00 | 00 00 00 a0 eb 37 86 a1 |......".|.....7..|
|00000060| e6 58 e4 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.X......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000080| 2f 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |/*******|********|
|00000090| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000000a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000000b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000000c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000000d0| 2a 0d 20 2a 09 6e 65 75 | 72 61 6c 2e 63 0d 20 2a |*. *.neu|ral.c. *|
|000000e0| 0d 20 2a 09 4e 65 75 72 | 61 6c 20 4e 65 74 77 6f |. *.Neur|al Netwo|
|000000f0| 72 6b 20 50 61 63 6b 61 | 67 65 0d 20 2a 0d 20 2a |rk Packa|ge. *. *|
|00000100| 09 57 72 69 74 74 65 6e | 20 62 79 20 50 61 63 6f |.Written| by Paco|
|00000110| 20 58 61 6e 64 65 72 20 | 4e 61 74 68 61 6e 0d 20 | Xander |Nathan. |
|00000120| 2a 09 a9 31 39 39 30 2c | 20 4d 6f 74 6f 72 6f 6c |*..1990,| Motorol|
|00000130| 61 20 49 6e 63 2e 20 20 | 50 75 62 6c 69 63 20 64 |a Inc. |Public d|
|00000140| 6f 6d 61 69 6e 20 73 6f | 75 72 63 65 20 63 6f 64 |omain so|urce cod|
|00000150| 65 2e 0d 20 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |e.. ****|********|
|00000160| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000170| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000180| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000190| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000001a0| 2a 2a 2a 2a 2f 0d 0d 23 | 69 6e 63 6c 75 64 65 20 |****/..#|include |
|000001b0| 22 61 70 70 6c 69 63 2e | 68 22 0d 23 69 6e 63 6c |"applic.|h".#incl|
|000001c0| 75 64 65 20 22 6e 65 75 | 72 61 6c 2e 68 22 0d 0d |ude "neu|ral.h"..|
|000001d0| 0d 23 64 65 66 69 6e 65 | 20 4e 4e 5f 49 4e 50 55 |.#define| NN_INPU|
|000001e0| 54 09 31 38 31 0d 23 64 | 65 66 69 6e 65 20 4e 4e |T.181.#d|efine NN|
|000001f0| 5f 48 49 44 44 45 4e 09 | 33 38 0d 23 64 65 66 69 |_HIDDEN.|38.#defi|
|00000200| 6e 65 20 4e 4e 5f 4f 55 | 54 50 55 54 09 31 0d 0d |ne NN_OU|TPUT.1..|
|00000210| 0d 74 79 70 65 64 65 66 | 20 65 6e 75 6d 20 7b 0d |.typedef| enum {.|
|00000220| 09 6e 6e 4c 61 79 65 72 | 49 6e 70 75 74 20 3d 20 |.nnLayer|Input = |
|00000230| 30 2c 20 6e 6e 4c 61 79 | 65 72 48 69 64 64 65 6e |0, nnLay|erHidden|
|00000240| 2c 20 6e 6e 4c 61 79 65 | 72 4f 75 74 70 75 74 0d |, nnLaye|rOutput.|
|00000250| 7d 20 4e 4e 4c 61 79 65 | 72 56 61 6c 75 65 73 3b |} NNLaye|rValues;|
|00000260| 0d 0d 0d 2f 2a 20 45 78 | 74 65 72 6e 61 6c 20 44 |.../* Ex|ternal D|
|00000270| 61 74 61 20 53 74 72 75 | 63 74 75 72 65 73 0d 20 |ata Stru|ctures. |
|00000280| 2a 2f 0d 66 6c 6f 61 74 | 0d 09 6e 6e 43 65 72 74 |*/.float|..nnCert|
|00000290| 61 69 6e 74 79 20 3d 20 | 30 2e 30 2c 0d 09 6e 6e |ainty = |0.0,..nn|
|000002a0| 4f 75 74 70 75 74 20 3d | 20 30 2e 30 3b 0d 0d 42 |Output =| 0.0;..B|
|000002b0| 6f 6f 6c 65 61 6e 0d 09 | 6e 6e 43 6c 75 73 74 65 |oolean..|nnCluste|
|000002c0| 72 46 6c 61 67 20 3d 20 | 54 52 55 45 3b 0d 0d 0d |rFlag = |TRUE;...|
|000002d0| 2f 2a 20 4c 6f 63 61 6c | 20 44 61 74 61 20 53 74 |/* Local| Data St|
|000002e0| 72 75 63 74 75 72 65 73 | 0d 20 2a 2f 0d 73 74 61 |ructures|. */.sta|
|000002f0| 74 69 63 20 66 6c 6f 61 | 74 0d 09 6e 6e 48 69 64 |tic floa|t..nnHid|
|00000300| 4c 61 79 65 72 5b 4e 4e | 5f 48 49 44 44 45 4e 5d |Layer[NN|_HIDDEN]|
|00000310| 2c 0d 09 6e 6e 4f 75 74 | 4c 61 79 65 72 5b 4e 4e |,..nnOut|Layer[NN|
|00000320| 5f 4f 55 54 50 55 54 5d | 2c 0d 09 6e 6e 49 6e 57 |_OUTPUT]|,..nnInW|
|00000330| 65 69 67 68 74 5b 4e 4e | 5f 49 4e 50 55 54 5d 5b |eight[NN|_INPUT][|
|00000340| 4e 4e 5f 48 49 44 44 45 | 4e 5d 2c 0d 09 6e 6e 4f |NN_HIDDE|N],..nnO|
|00000350| 75 74 57 65 69 67 68 74 | 5b 4e 4e 5f 48 49 44 44 |utWeight|[NN_HIDD|
|00000360| 45 4e 5d 5b 4e 4e 5f 4f | 55 54 50 55 54 5d 3b 0d |EN][NN_O|UTPUT];.|
|00000370| 0d 0d 2f 2a 20 49 6e 69 | 74 69 61 6c 69 7a 65 20 |../* Ini|tialize |
|00000380| 74 68 65 20 6e 65 74 77 | 6f 72 6b 0d 20 2a 2f 0d |the netw|ork. */.|
|00000390| 76 6f 69 64 0d 4e 4e 49 | 6e 69 74 20 28 29 0d 7b |void.NNI|nit ().{|
|000003a0| 0d 09 2f 2a 20 53 65 74 | 20 64 65 66 61 75 6c 74 |../* Set| default|
|000003b0| 20 76 61 6c 75 65 73 0d | 09 20 2a 2f 0d 09 6e 6e | values.|. */..nn|
|000003c0| 43 65 72 74 61 69 6e 74 | 79 20 3d 20 30 2e 30 3b |Certaint|y = 0.0;|
|000003d0| 0d 09 6e 6e 43 6c 75 73 | 74 65 72 46 6c 61 67 20 |..nnClus|terFlag |
|000003e0| 3d 20 54 52 55 45 3b 0d | 09 4e 4e 53 65 74 41 6c |= TRUE;.|.NNSetAl|
|000003f0| 6c 57 65 69 67 68 74 73 | 28 30 2e 30 29 3b 0d 7d |lWeights|(0.0);.}|
|00000400| 0d 0d 0d 2f 2a 20 53 65 | 74 73 20 74 68 65 20 77 |.../* Se|ts the w|
|00000410| 65 69 67 68 74 20 6f 66 | 20 61 6c 6c 20 63 6f 6e |eight of| all con|
|00000420| 6e 65 63 74 69 6f 6e 73 | 20 62 65 74 77 65 65 6e |nections| between|
|00000430| 20 61 6c 6c 20 6e 65 75 | 72 6f 6e 73 20 69 6e 20 | all neu|rons in |
|00000440| 61 6c 6c 20 6c 61 79 65 | 72 73 20 0d 20 2a 20 74 |all laye|rs . * t|
|00000450| 6f 20 74 68 65 20 67 69 | 76 65 6e 20 76 61 6c 75 |o the gi|ven valu|
|00000460| 65 0d 20 2a 2f 0d 76 6f | 69 64 0d 4e 4e 53 65 74 |e. */.vo|id.NNSet|
|00000470| 41 6c 6c 57 65 69 67 68 | 74 73 20 28 76 61 6c 75 |AllWeigh|ts (valu|
|00000480| 65 29 0d 09 72 65 67 69 | 73 74 65 72 20 66 6c 6f |e)..regi|ster flo|
|00000490| 61 74 20 76 61 6c 75 65 | 3b 0d 7b 0d 09 72 65 67 |at value|;.{..reg|
|000004a0| 69 73 74 65 72 20 73 68 | 6f 72 74 20 69 2c 20 6a |ister sh|ort i, j|
|000004b0| 3b 20 0d 20 0d 09 2f 2a | 20 57 65 69 67 68 74 73 |; . ../*| Weights|
|000004c0| 20 62 65 74 77 65 65 6e | 20 69 6e 70 75 74 20 61 | between| input a|
|000004d0| 6e 64 20 68 69 64 64 65 | 6e 0d 09 20 2a 2f 0d 09 |nd hidde|n.. */..|
|000004e0| 66 6f 72 20 28 69 20 3d | 20 30 3b 20 69 20 3c 20 |for (i =| 0; i < |
|000004f0| 4e 4e 5f 49 4e 50 55 54 | 3b 20 69 2b 2b 29 0d 09 |NN_INPUT|; i++)..|
|00000500| 09 66 6f 72 20 28 6a 20 | 3d 20 30 3b 20 6a 20 3c |.for (j |= 0; j <|
|00000510| 20 4e 4e 5f 48 49 44 44 | 45 4e 3b 20 6a 2b 2b 29 | NN_HIDD|EN; j++)|
|00000520| 0d 09 09 09 6e 6e 49 6e | 57 65 69 67 68 74 5b 69 |....nnIn|Weight[i|
|00000530| 5d 5b 6a 5d 20 3d 20 76 | 61 6c 75 65 3b 0d 20 0d |][j] = v|alue;. .|
|00000540| 09 2f 2a 20 57 65 69 67 | 68 74 73 20 62 65 74 77 |./* Weig|hts betw|
|00000550| 65 65 6e 20 68 69 64 64 | 65 6e 20 61 6e 64 20 6f |een hidd|en and o|
|00000560| 75 74 70 75 74 0d 09 20 | 2a 2f 0d 09 66 6f 72 20 |utput.. |*/..for |
|00000570| 28 69 20 3d 20 30 3b 20 | 69 20 3c 20 4e 4e 5f 48 |(i = 0; |i < NN_H|
|00000580| 49 44 44 45 4e 3b 20 69 | 2b 2b 29 0d 09 09 66 6f |IDDEN; i|++)...fo|
|00000590| 72 20 28 6a 20 3d 20 30 | 3b 20 6a 20 3c 20 4e 4e |r (j = 0|; j < NN|
|000005a0| 5f 4f 55 54 50 55 54 3b | 20 6a 2b 2b 29 0d 09 09 |_OUTPUT;| j++)...|
|000005b0| 09 6e 6e 4f 75 74 57 65 | 69 67 68 74 5b 69 5d 5b |.nnOutWe|ight[i][|
|000005c0| 6a 5d 20 3d 20 76 61 6c | 75 65 3b 0d 7d 0d 0d 0d |j] = val|ue;.}...|
|000005d0| 2f 2a 20 53 65 74 73 20 | 74 68 65 20 77 65 69 67 |/* Sets |the weig|
|000005e0| 68 74 20 62 65 74 77 65 | 65 6e 20 74 6f 20 6e 65 |ht betwe|en to ne|
|000005f0| 75 72 6f 6e 73 20 74 6f | 20 61 20 67 69 76 65 6e |urons to| a given|
|00000600| 20 76 61 6c 75 65 0d 20 | 2a 2f 0d 76 6f 69 64 0d | value. |*/.void.|
|00000610| 4e 4e 53 65 74 57 65 69 | 67 68 74 20 28 66 72 6f |NNSetWei|ght (fro|
|00000620| 6d 2c 20 74 6f 2c 20 6c | 61 79 65 72 2c 20 76 61 |m, to, l|ayer, va|
|00000630| 6c 75 65 29 0d 09 72 65 | 67 69 73 74 65 72 20 73 |lue)..re|gister s|
|00000640| 68 6f 72 74 20 66 72 6f | 6d 2c 20 74 6f 2c 20 6c |hort fro|m, to, l|
|00000650| 61 79 65 72 3b 0d 09 72 | 65 67 69 73 74 65 72 20 |ayer;..r|egister |
|00000660| 66 6c 6f 61 74 20 76 61 | 6c 75 65 3b 0d 7b 0d 09 |float va|lue;.{..|
|00000670| 73 77 69 74 63 68 20 28 | 6c 61 79 65 72 29 20 7b |switch (|layer) {|
|00000680| 0d 09 63 61 73 65 20 6e | 6e 4c 61 79 65 72 48 69 |..case n|nLayerHi|
|00000690| 64 64 65 6e 3a 0d 09 09 | 69 66 20 28 28 66 72 6f |dden:...|if ((fro|
|000006a0| 6d 20 3c 3d 20 4e 4e 5f | 49 4e 50 55 54 29 20 26 |m <= NN_|INPUT) &|
|000006b0| 26 20 28 74 6f 20 3c 3d | 20 4e 4e 5f 48 49 44 44 |& (to <=| NN_HIDD|
|000006c0| 45 4e 29 29 0d 09 09 09 | 6e 6e 49 6e 57 65 69 67 |EN))....|nnInWeig|
|000006d0| 68 74 5b 66 72 6f 6d 5d | 5b 74 6f 5d 20 3d 20 76 |ht[from]|[to] = v|
|000006e0| 61 6c 75 65 3b 0d 0d 09 | 09 62 72 65 61 6b 3b 0d |alue;...|.break;.|
|000006f0| 0d 09 63 61 73 65 20 6e | 6e 4c 61 79 65 72 4f 75 |..case n|nLayerOu|
|00000700| 74 70 75 74 3a 0d 09 09 | 69 66 20 28 28 66 72 6f |tput:...|if ((fro|
|00000710| 6d 20 3c 3d 20 4e 4e 5f | 48 49 44 44 45 4e 29 20 |m <= NN_|HIDDEN) |
|00000720| 26 26 20 28 74 6f 20 3c | 3d 20 4e 4e 5f 4f 55 54 |&& (to <|= NN_OUT|
|00000730| 50 55 54 29 29 0d 09 09 | 09 6e 6e 4f 75 74 57 65 |PUT))...|.nnOutWe|
|00000740| 69 67 68 74 5b 66 72 6f | 6d 5d 5b 74 6f 5d 20 3d |ight[fro|m][to] =|
|00000750| 20 76 61 6c 75 65 3b 0d | 0d 09 09 62 72 65 61 6b | value;.|...break|
|00000760| 3b 0d 0d 09 64 65 66 61 | 75 6c 74 3a 0d 09 09 62 |;...defa|ult:...b|
|00000770| 72 65 61 6b 3b 0d 09 7d | 0d 7d 0d 0d 0d 2f 2a 20 |reak;..}|.}.../* |
|00000780| 54 65 61 63 68 20 74 68 | 65 20 6e 65 74 20 61 20 |Teach th|e net a |
|00000790| 74 68 69 6e 67 20 6f 72 | 20 74 77 6f 0d 20 2a 2f |thing or| two. */|
|000007a0| 0d 76 6f 69 64 0d 4e 4e | 4c 65 61 72 6e 20 28 62 |.void.NN|Learn (b|
|000007b0| 69 74 2c 20 6e 42 69 74 | 73 2c 20 74 68 65 4f 75 |it, nBit|s, theOu|
|000007c0| 74 70 75 74 29 0d 09 72 | 65 67 69 73 74 65 72 20 |tput)..r|egister |
|000007d0| 42 6f 6f 6c 65 61 6e 20 | 2a 62 69 74 3b 0d 09 72 |Boolean |*bit;..r|
|000007e0| 65 67 69 73 74 65 72 20 | 57 4f 52 44 20 6e 42 69 |egister |WORD nBi|
|000007f0| 74 73 3b 0d 09 72 65 67 | 69 73 74 65 72 20 57 4f |ts;..reg|ister WO|
|00000800| 52 44 20 74 68 65 4f 75 | 74 70 75 74 3b 0d 7b 0d |RD theOu|tput;.{.|
|00000810| 09 72 65 67 69 73 74 65 | 72 20 57 4f 52 44 20 74 |.registe|r WORD t|
|00000820| 68 65 42 69 74 2c 20 73 | 75 6d 42 69 74 73 3b 0d |heBit, s|umBits;.|
|00000830| 09 72 65 67 69 73 74 65 | 72 20 66 6c 6f 61 74 20 |.registe|r float |
|00000840| 64 69 73 74 57 65 69 67 | 68 74 20 3d 20 31 2e 30 |distWeig|ht = 1.0|
|00000850| 3b 0d 0d 09 2f 2a 20 55 | 73 65 20 74 68 65 20 64 |;.../* U|se the d|
|00000860| 69 73 74 72 69 62 75 74 | 65 64 20 77 65 69 67 68 |istribut|ed weigh|
|00000870| 74 20 6f 66 20 74 68 65 | 20 69 6e 70 75 74 20 76 |t of the| input v|
|00000880| 65 63 74 6f 72 20 74 6f | 20 73 65 74 75 70 20 0d |ector to| setup .|
|00000890| 09 20 2a 20 74 68 65 20 | 68 69 64 64 65 6e 20 6c |. * the |hidden l|
|000008a0| 61 79 65 72 0d 09 20 2a | 2f 0d 09 66 6f 72 20 28 |ayer.. *|/..for (|
|000008b0| 74 68 65 42 69 74 20 3d | 20 30 2c 20 73 75 6d 42 |theBit =| 0, sumB|
|000008c0| 69 74 73 20 3d 20 30 3b | 20 74 68 65 42 69 74 20 |its = 0;| theBit |
|000008d0| 3c 20 6e 42 69 74 73 3b | 20 74 68 65 42 69 74 2b |< nBits;| theBit+|
|000008e0| 2b 29 0d 09 09 73 75 6d | 42 69 74 73 20 2b 3d 20 |+)...sum|Bits += |
|000008f0| 62 69 74 5b 74 68 65 42 | 69 74 5d 3b 0d 0d 09 69 |bit[theB|it];...i|
|00000900| 66 20 28 73 75 6d 42 69 | 74 73 20 3e 20 30 29 0d |f (sumBi|ts > 0).|
|00000910| 09 09 64 69 73 74 57 65 | 69 67 68 74 20 3d 20 31 |..distWe|ight = 1|
|00000920| 2e 30 20 2f 20 73 75 6d | 42 69 74 73 3b 0d 09 0d |.0 / sum|Bits;...|
|00000930| 09 41 70 70 6c 53 70 69 | 6e 43 75 72 73 28 46 41 |.ApplSpi|nCurs(FA|
|00000940| 4c 53 45 29 3b 0d 09 0d | 09 66 6f 72 20 28 74 68 |LSE);...|.for (th|
|00000950| 65 42 69 74 20 3d 20 30 | 3b 20 74 68 65 42 69 74 |eBit = 0|; theBit|
|00000960| 20 3c 20 6e 42 69 74 73 | 3b 20 74 68 65 42 69 74 | < nBits|; theBit|
|00000970| 2b 2b 29 0d 09 09 69 66 | 20 28 62 69 74 5b 74 68 |++)...if| (bit[th|
|00000980| 65 42 69 74 5d 29 0d 09 | 09 09 4e 4e 53 65 74 57 |eBit])..|..NNSetW|
|00000990| 65 69 67 68 74 28 74 68 | 65 42 69 74 2c 20 74 68 |eight(th|eBit, th|
|000009a0| 65 4f 75 74 70 75 74 2c | 20 6e 6e 4c 61 79 65 72 |eOutput,| nnLayer|
|000009b0| 48 69 64 64 65 6e 2c 20 | 64 69 73 74 57 65 69 67 |Hidden, |distWeig|
|000009c0| 68 74 29 3b 0d 0d 09 2f | 2a 20 53 65 74 75 70 20 |ht);.../|* Setup |
|000009d0| 74 68 65 20 6f 75 74 70 | 75 74 20 6c 61 79 65 72 |the outp|ut layer|
|000009e0| 0d 09 20 2a 2f 0d 09 4e | 4e 53 65 74 57 65 69 67 |.. */..N|NSetWeig|
|000009f0| 68 74 28 74 68 65 4f 75 | 74 70 75 74 2c 20 30 2c |ht(theOu|tput, 0,|
|00000a00| 20 6e 6e 4c 61 79 65 72 | 4f 75 74 70 75 74 2c 20 | nnLayer|Output, |
|00000a10| 28 66 6c 6f 61 74 29 20 | 74 68 65 4f 75 74 70 75 |(float) |theOutpu|
|00000a20| 74 29 3b 0d 7d 0d 0d 0d | 2f 2a 20 53 65 74 73 20 |t);.}...|/* Sets |
|00000a30| 61 20 6e 65 75 72 61 6c | 20 6e 65 74 77 6f 72 6b |a neural| network|
|00000a40| 20 69 6e 20 6d 6f 74 69 | 6f 6e 20 62 79 20 73 65 | in moti|on by se|
|00000a50| 71 75 65 6e 74 69 61 6c | 6c 79 20 61 63 74 69 76 |quential|ly activ|
|00000a60| 61 74 69 6e 67 20 65 61 | 63 68 20 6e 65 75 72 6f |ating ea|ch neuro|
|00000a70| 6e 0d 20 2a 2f 0d 76 6f | 69 64 0d 4e 4e 41 63 74 |n. */.vo|id.NNAct|
|00000a80| 69 76 61 74 65 20 28 62 | 69 74 2c 20 6e 42 69 74 |ivate (b|it, nBit|
|00000a90| 73 29 0d 09 72 65 67 69 | 73 74 65 72 20 42 6f 6f |s)..regi|ster Boo|
|00000aa0| 6c 65 61 6e 20 2a 62 69 | 74 3b 0d 09 72 65 67 69 |lean *bi|t;..regi|
|00000ab0| 73 74 65 72 20 57 4f 52 | 44 20 6e 42 69 74 73 3b |ster WOR|D nBits;|
|00000ac0| 0d 7b 0d 09 72 65 67 69 | 73 74 65 72 20 66 6c 6f |.{..regi|ster flo|
|00000ad0| 61 74 20 73 75 6d 2c 20 | 68 69 67 68 65 73 74 20 |at sum, |highest |
|00000ae0| 3d 20 30 2e 30 3b 0d 09 | 72 65 67 69 73 74 65 72 |= 0.0;..|register|
|00000af0| 20 57 4f 52 44 20 69 2c | 20 6a 2c 20 63 6c 6f 73 | WORD i,| j, clos|
|00000b00| 65 73 74 20 3d 20 2d 31 | 3b 0d 20 0d 09 2f 2a 20 |est = -1|;. ../* |
|00000b10| 41 63 74 69 76 61 74 65 | 20 68 69 64 64 65 6e 20 |Activate| hidden |
|00000b20| 6c 61 79 65 72 0d 09 20 | 2a 2f 0d 09 66 6f 72 20 |layer.. |*/..for |
|00000b30| 28 69 20 3d 20 30 3b 20 | 69 20 3c 20 4e 4e 5f 48 |(i = 0; |i < NN_H|
|00000b40| 49 44 44 45 4e 3b 20 69 | 2b 2b 29 20 7b 0d 09 09 |IDDEN; i|++) {...|
|00000b50| 66 6f 72 20 28 6a 20 3d | 20 30 2c 20 73 75 6d 20 |for (j =| 0, sum |
|00000b60| 3d 20 30 2e 30 3b 20 6a | 20 3c 20 6e 42 69 74 73 |= 0.0; j| < nBits|
|00000b70| 3b 20 6a 2b 2b 29 0d 09 | 09 09 73 75 6d 20 2b 3d |; j++)..|..sum +=|
|00000b80| 20 62 69 74 5b 6a 5d 20 | 2a 20 6e 6e 49 6e 57 65 | bit[j] |* nnInWe|
|00000b90| 69 67 68 74 5b 6a 5d 5b | 69 5d 3b 0d 0d 09 09 6e |ight[j][|i];....n|
|00000ba0| 6e 48 69 64 4c 61 79 65 | 72 5b 69 5d 20 3d 20 73 |nHidLaye|r[i] = s|
|00000bb0| 75 6d 3b 0d 09 09 41 70 | 70 6c 53 70 69 6e 43 75 |um;...Ap|plSpinCu|
|00000bc0| 72 73 28 46 41 4c 53 45 | 29 3b 0d 09 7d 0d 0d 09 |rs(FALSE|);..}...|
|00000bd0| 2f 2a 20 50 65 72 66 6f | 72 6d 73 20 61 20 63 6c |/* Perfo|rms a cl|
|00000be0| 75 73 74 65 72 20 66 75 | 6e 63 74 69 6f 6e 2e 20 |uster fu|nction. |
|00000bf0| 20 49 74 20 69 6e 68 69 | 62 69 74 73 20 28 73 65 | It inhi|bits (se|
|00000c00| 74 73 20 74 6f 20 30 29 | 20 61 6c 6c 20 6e 65 75 |ts to 0)| all neu|
|00000c10| 72 6f 6e 73 20 69 6e 20 | 74 68 65 20 63 6c 75 73 |rons in |the clus|
|00000c20| 74 65 72 0d 09 20 2a 20 | 65 78 63 65 70 74 20 74 |ter.. * |except t|
|00000c30| 68 65 20 6f 6e 65 20 77 | 68 69 63 68 20 69 73 20 |he one w|hich is |
|00000c40| 63 6c 6f 73 65 73 74 20 | 74 6f 20 74 68 65 20 76 |closest |to the v|
|00000c50| 61 6c 75 65 20 31 2e 30 | 2e 20 20 54 68 69 73 20 |alue 1.0|. This |
|00000c60| 6e 65 75 72 6f 6e 20 69 | 73 20 73 65 74 20 74 6f |neuron i|s set to|
|00000c70| 20 31 2e 30 2e 20 20 54 | 68 65 20 0d 09 20 2a 20 | 1.0. T|he .. * |
|00000c80| 6e 65 74 27 73 20 63 65 | 72 74 61 69 6e 74 79 20 |net's ce|rtainty |
|00000c90| 76 61 6c 75 65 20 69 73 | 20 61 73 73 69 67 6e 65 |value is| assigne|
|00000ca0| 64 20 74 68 65 20 63 65 | 72 74 61 69 6e 74 79 20 |d the ce|rtainty |
|00000cb0| 74 6f 20 77 68 69 63 68 | 20 74 68 65 20 63 6c 6f |to which| the clo|
|00000cc0| 73 65 73 74 20 6e 65 75 | 72 6f 6e 20 66 65 6c 74 |sest neu|ron felt|
|00000cd0| 20 69 74 20 0d 09 20 2a | 20 6d 61 74 63 68 65 64 | it .. *| matched|
|00000ce0| 20 74 68 65 20 70 61 74 | 74 65 72 6e 2e 0d 09 20 | the pat|tern... |
|00000cf0| 2a 2f 0d 09 69 66 20 28 | 6e 6e 43 6c 75 73 74 65 |*/..if (|nnCluste|
|00000d00| 72 46 6c 61 67 29 20 7b | 0d 09 09 66 6f 72 20 28 |rFlag) {|...for (|
|00000d10| 69 20 3d 20 30 3b 20 69 | 20 3c 20 4e 4e 5f 48 49 |i = 0; i| < NN_HI|
|00000d20| 44 44 45 4e 3b 20 69 2b | 2b 29 20 0d 09 09 09 20 |DDEN; i+|+) .... |
|00000d30| 69 66 20 28 6e 6e 48 69 | 64 4c 61 79 65 72 5b 69 |if (nnHi|dLayer[i|
|00000d40| 5d 20 3e 20 68 69 67 68 | 65 73 74 29 20 7b 0d 09 |] > high|est) {..|
|00000d50| 09 09 20 09 20 63 6c 6f | 73 65 73 74 20 3d 20 69 |.. . clo|sest = i|
|00000d60| 3b 0d 09 09 09 20 09 20 | 68 69 67 68 65 73 74 20 |;.... . |highest |
|00000d70| 3d 20 6e 6e 48 69 64 4c | 61 79 65 72 5b 69 5d 3b |= nnHidL|ayer[i];|
|00000d80| 0d 09 09 09 20 7d 0d 09 | 0d 09 09 2f 2a 20 41 6c |.... }..|.../* Al|
|00000d90| 6c 20 61 72 65 20 65 71 | 75 61 6c 6c 79 20 6c 69 |l are eq|ually li|
|00000da0| 6b 65 6c 79 20 2d 20 63 | 68 6f 6f 73 65 20 74 68 |kely - c|hoose th|
|00000db0| 65 20 66 69 72 73 74 0d | 09 09 20 2a 2f 0d 09 09 |e first.|.. */...|
|00000dc0| 69 66 20 28 63 6c 6f 73 | 65 73 74 20 3d 3d 20 2d |if (clos|est == -|
|00000dd0| 31 29 20 20 20 09 0d 09 | 09 09 63 6c 6f 73 65 73 |1) ...|..closes|
|00000de0| 74 20 3d 20 30 3b 0d 09 | 0d 09 09 6e 6e 43 65 72 |t = 0;..|...nnCer|
|00000df0| 74 61 69 6e 74 79 20 3d | 20 6e 6e 48 69 64 4c 61 |tainty =| nnHidLa|
|00000e00| 79 65 72 5b 63 6c 6f 73 | 65 73 74 5d 20 2a 20 31 |yer[clos|est] * 1|
|00000e10| 30 30 2e 30 3b 0d 09 09 | 0d 09 09 2f 2a 20 43 61 |00.0;...|.../* Ca|
|00000e20| 75 73 65 20 6a 75 73 74 | 20 65 6e 6f 75 67 68 20 |use just| enough |
|00000e30| 66 65 65 64 62 61 63 6b | 20 74 6f 20 74 68 65 20 |feedback| to the |
|00000e40| 6e 65 75 72 6f 6e 20 77 | 68 69 63 68 20 69 73 20 |neuron w|hich is |
|00000e50| 63 6c 6f 73 65 73 74 20 | 74 6f 20 62 65 69 6e 67 |closest |to being|
|00000e60| 20 22 6f 6e 22 2e 0d 09 | 09 20 2a 20 54 68 61 74 | "on"...|. * That|
|00000e70| 20 69 73 2c 20 73 65 74 | 20 69 74 20 22 6f 6e 22 | is, set| it "on"|
|00000e80| 2e 20 20 41 6c 6c 20 6f | 74 68 65 72 73 20 61 72 |. All o|thers ar|
|00000e90| 65 20 67 69 76 65 6e 20 | 6e 65 67 61 74 69 76 65 |e given |negative|
|00000ea0| 20 66 65 65 64 62 61 63 | 6b 20 74 6f 20 66 6f 72 | feedbac|k to for|
|00000eb0| 63 65 20 0d 09 09 20 2a | 20 74 68 65 6d 20 74 6f |ce ... *| them to|
|00000ec0| 20 7a 65 72 6f 2e 20 20 | 28 53 65 74 20 74 68 65 | zero. |(Set the|
|00000ed0| 6d 20 74 6f 20 7a 65 72 | 6f 29 2e 0d 09 09 20 2a |m to zer|o).... *|
|00000ee0| 2f 0d 09 09 66 6f 72 20 | 28 69 20 3d 20 30 3b 20 |/...for |(i = 0; |
|00000ef0| 69 20 3c 20 4e 4e 5f 48 | 49 44 44 45 4e 3b 20 69 |i < NN_H|IDDEN; i|
|00000f00| 2b 2b 29 0d 09 09 09 69 | 66 20 28 69 20 3d 3d 20 |++)....i|f (i == |
|00000f10| 63 6c 6f 73 65 73 74 29 | 0d 09 09 09 09 6e 6e 48 |closest)|.....nnH|
|00000f20| 69 64 4c 61 79 65 72 5b | 69 5d 20 3d 20 31 2e 30 |idLayer[|i] = 1.0|
|00000f30| 3b 0d 09 09 09 65 6c 73 | 65 0d 09 09 09 09 6e 6e |;....els|e.....nn|
|00000f40| 48 69 64 4c 61 79 65 72 | 5b 69 5d 20 3d 20 30 2e |HidLayer|[i] = 0.|
|00000f50| 30 3b 0d 09 7d 0d 20 0d | 09 2f 2a 20 41 63 74 69 |0;..}. .|./* Acti|
|00000f60| 76 61 74 65 20 6f 75 74 | 70 75 74 20 6c 61 79 65 |vate out|put laye|
|00000f70| 72 0d 09 20 2a 2f 0d 09 | 66 6f 72 20 28 69 20 3d |r.. */..|for (i =|
|00000f80| 20 30 2c 20 73 75 6d 20 | 3d 20 30 2e 30 3b 20 69 | 0, sum |= 0.0; i|
|00000f90| 20 3c 20 4e 4e 5f 4f 55 | 54 50 55 54 3b 20 69 2b | < NN_OU|TPUT; i+|
|00000fa0| 2b 29 20 7b 0d 09 09 66 | 6f 72 20 28 6a 20 3d 20 |+) {...f|or (j = |
|00000fb0| 30 3b 20 6a 20 3c 20 4e | 4e 5f 48 49 44 44 45 4e |0; j < N|N_HIDDEN|
|00000fc0| 3b 20 6a 2b 2b 29 20 7b | 0d 09 09 09 73 75 6d 20 |; j++) {|....sum |
|00000fd0| 2b 3d 20 6e 6e 48 69 64 | 4c 61 79 65 72 5b 6a 5d |+= nnHid|Layer[j]|
|00000fe0| 20 2a 20 6e 6e 4f 75 74 | 57 65 69 67 68 74 5b 6a | * nnOut|Weight[j|
|00000ff0| 5d 5b 69 5d 3b 0d 09 09 | 09 41 70 70 6c 53 70 69 |][i];...|.ApplSpi|
|00001000| 6e 43 75 72 73 28 46 41 | 4c 53 45 29 3b 0d 09 09 |nCurs(FA|LSE);...|
|00001010| 7d 0d 0d 09 09 6e 6e 4f | 75 74 4c 61 79 65 72 5b |}....nnO|utLayer[|
|00001020| 69 5d 20 3d 20 73 75 6d | 3b 0d 09 7d 0d 09 0d 09 |i] = sum|;..}....|
|00001030| 2f 2a 20 46 6f 72 20 74 | 68 65 20 70 75 72 70 6f |/* For t|he purpo|
|00001040| 73 65 73 20 6f 66 20 74 | 68 69 73 20 61 70 70 6c |ses of t|his appl|
|00001050| 69 63 61 74 69 6f 6e 2c | 20 77 65 20 6f 6e 6c 79 |ication,| we only|
|00001060| 20 6e 65 65 64 20 6f 6e | 65 20 0d 09 20 2a 20 70 | need on|e .. * p|
|00001070| 75 62 6c 69 63 20 6f 75 | 74 70 75 74 2e 2e 2e 0d |ublic ou|tput....|
|00001080| 09 20 2a 2f 0d 09 6e 6e | 4f 75 74 70 75 74 20 3d |. */..nn|Output =|
|00001090| 20 6e 6e 4f 75 74 4c 61 | 79 65 72 5b 30 5d 3b 0d | nnOutLa|yer[0];.|
|000010a0| 7d 0d 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |}.......|........|
|000010b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000010c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000010d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000010e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000010f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+