diff options
| author | Mike Buland <mike@xagasoft.com> | 2012-07-09 13:57:37 -0600 | 
|---|---|---|
| committer | Mike Buland <mike@xagasoft.com> | 2012-07-09 13:57:37 -0600 | 
| commit | 673252f7eadc3aa0cfae3d826e1c7bbe2400df17 (patch) | |
| tree | fdb3a7f602ca9d91794f35e880017756d8487fa9 /src/neuron.h | |
| parent | 87dc10690035b02485067f2b0b77bcb0459da42b (diff) | |
| download | libneural-673252f7eadc3aa0cfae3d826e1c7bbe2400df17.tar.gz libneural-673252f7eadc3aa0cfae3d826e1c7bbe2400df17.tar.bz2 libneural-673252f7eadc3aa0cfae3d826e1c7bbe2400df17.tar.xz libneural-673252f7eadc3aa0cfae3d826e1c7bbe2400df17.zip | |
It generates pngs just like the java version.
Maybe even prettier.
Diffstat (limited to '')
| -rw-r--r-- | src/neuron.h | 20 | 
1 files changed, 19 insertions, 1 deletions
| diff --git a/src/neuron.h b/src/neuron.h index dc30471..2ad5cfb 100644 --- a/src/neuron.h +++ b/src/neuron.h | |||
| @@ -3,6 +3,9 @@ | |||
| 3 | 3 | ||
| 4 | #include "neural/node.h" | 4 | #include "neural/node.h" | 
| 5 | #include "neural/slope.h" | 5 | #include "neural/slope.h" | 
| 6 | #include "neural/slopestd.h" | ||
| 7 | |||
| 8 | #include <bu/sio.h> | ||
| 6 | 9 | ||
| 7 | namespace Neural | 10 | namespace Neural | 
| 8 | { | 11 | { | 
| @@ -14,7 +17,7 @@ namespace Neural | |||
| 14 | iInputs( 0 ), | 17 | iInputs( 0 ), | 
| 15 | aWeights( 0 ), | 18 | aWeights( 0 ), | 
| 16 | sBias( 0.0 ), | 19 | sBias( 0.0 ), | 
| 17 | pSlope( 0 ) | 20 | pSlope( new Neural::SlopeStd<sigtype>() ) | 
| 18 | { | 21 | { | 
| 19 | } | 22 | } | 
| 20 | 23 | ||
| @@ -30,6 +33,21 @@ namespace Neural | |||
| 30 | aWeights = new sigtype[iInputs]; | 33 | aWeights = new sigtype[iInputs]; | 
| 31 | } | 34 | } | 
| 32 | 35 | ||
| 36 | virtual int setWeights( const sigtype *pWeights ) | ||
| 37 | { | ||
| 38 | for( int j = 0; j < iInputs; j++ ) | ||
| 39 | aWeights[j] = pWeights[j]; | ||
| 40 | |||
| 41 | return iInputs; | ||
| 42 | } | ||
| 43 | |||
| 44 | virtual int setBiases( const sigtype *pBiases ) | ||
| 45 | { | ||
| 46 | sBias = *pBiases; | ||
| 47 | |||
| 48 | return 1; | ||
| 49 | } | ||
| 50 | |||
| 33 | virtual void process( sigtype *aInput, sigtype *aOutput ) | 51 | virtual void process( sigtype *aInput, sigtype *aOutput ) | 
| 34 | { | 52 | { | 
| 35 | sigtype sOutput = sBias; | 53 | sigtype sOutput = sBias; | 
