Changeset 72 for cpp/gdk/neuroimpl.cpp


Ignore:
Timestamp:
12/16/11 21:35:18 (13 years ago)
Author:
Maciej Komosinski
Message:

neural noise parameter in neurons

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/gdk/neuroimpl.cpp

    r69 r72  
    55#include "neuroimpl.h"
    66#include "neurofactory.h"
     7#include "rndutil.h"
    78#ifndef GDK_WITHOUT_FRAMS
    89#include "creature.h"
     
    2223static ParamEntry nncfg_paramtab[]=
    2324{
    24 {"Creature: Neurons",1,2,"nnsim",},
    25 {"randinit",1,0,"Random initialization","f 0 10 0.01",FIELD(randominit),"Allowed range for initializing all neuron states with uniform distribution random numbers and zero mean. Set 0 for deterministic initialization."},
     25{"Creature: Neurons",1,3,"nnsim",},
     26{"randinit",1,0,"Random initialization","f 0 10 0.01",FIELD(randominit),"Allowed range for initializing all neuron states with uniform distribution random numbers and zero mean. Set to 0 for deterministic initialization."},
     27{"nnoise",1,0,"Noise","f 0 1 0",FIELD(nnoise),"Gaussian neural noise: a random value is added to each neural output in each simulation step. Set standard deviation here to add random noise, or 0 for deterministic simulation."},
    2628{"touchrange",1,0,"T receptor range","f 0 100 1",FIELD(touchrange),},
    2729{0,0,0,},
     
    3234        :par(nncfg_paramtab,this),
    3335         randominit(0.01),
     36         nnoise(0),
    3437         touchrange(1)
    3538{}
     
    197200                chstate=chnewstate;
    198201        neuro->state=newstate;
     202        if (NeuroNetConfig::globalconfig.nnoise>0.0)
     203                {
     204                neuro->state+=RndGen.GaussStd()*NeuroNetConfig::globalconfig.nnoise;
     205                if (channels>1)
     206                        for(int i=0;i<chstate.size();i++)
     207                                chstate(0)+=RndGen.GaussStd()*NeuroNetConfig::globalconfig.nnoise;
     208                }
    199209        }
    200210}
     
    290300{"getInputStateChannel",0,0,"Get input signal from channel","p f(d input,d channel)",PROCEDURE(p_getchan),},
    291301{"getWeightedInputStateChannel",0,0,"Get weighted input signal from channel","p f(d input,d channel)",PROCEDURE(p_getwchan),},
    292 {"state",0,0,"Neuron state (channel 0)","f",GETSET(state),"When read, returns the current neuron state.\nWhen written, sets the next neuron state (for use in the neuron definition)"},
     302{"state",0,0,"Neuron state (channel 0)","f",GETSET(state),"When read, returns the current neuron state.\nWhen written, sets the 'internal' neuron state that will become current in the next step.\nTypically you should use this field, and not currState."},
    293303{"channelCount",0,0,"Number of output channels","d",GETSET(channels),},
    294 {"getStateChannel",0,0,"Get output state for channel","p f(d channel)",PROCEDURE(p_getstate),},
    295 {"setStateChannel",0,0,"Set output state for channel","p(d channel,f value)",PROCEDURE(p_setstate),},
     304{"getStateChannel",0,0,"Get state for channel","p f(d channel)",PROCEDURE(p_getstate),},
     305{"setStateChannel",0,0,"Set state for channel","p(d channel,f value)",PROCEDURE(p_setstate),},
    296306{"hold",0,0,"Hold state","d 0 1",GETSET(hold),"\"Holding\" means keeping the neuron state as is, blocking the regular neuron operation. This is useful when your script needs to inject some control signals into the NN. Without \"holding\", live neurons would be constantly overwriting your changes, and the rest of the NN could see inconsistent states, depending on the connections. Setting hold=1 ensures the neuron state will be only set by you, and not by the neuron. The enforced signal value can be set using Neuro.currState before or after setting hold=1. Set hold=0 to resume normal operation.",},
    297 {"currState",0,0,"Neuron state (channel 0)","f",GETSET(cstate),"The only difference from the \"state\" field is that currState, when written, changes the internal neuron state immediately (which disturbs the regular synchronous NN operation). This feature should only be used while controlling the neuron 'from outside' (like a neuro probe) and not in the neuron definition. See also: Neuro.hold",},
    298 {"setCurrStateChannel",0,0,"Set neuron for channel","p(d channel,f value)",PROCEDURE(p_setcstate),"Analogous to \"currState\"."},
     307{"currState",0,0,"Current neuron state (channel 0)","f",GETSET(cstate),"When read, it behaves just like the 'state' field.\nWhen written, changes the current neuron state immediately, which disturbs the regular synchronous NN operation.\nThis feature should only be used while controlling the neuron 'from outside' (like a neuro probe) and not in the neuron definition. See also: Neuro.hold",},
     308{"setCurrStateChannel",0,0,"Set current neuron state for channel","p(d channel,f value)",PROCEDURE(p_setcstate),"Analogous to \"currState\"."},
    299309{"position_x",0,0,"Position x","f",GETONLY(position_x),},
    300310{"position_y",0,0,"Position y","f",GETONLY(position_y),},
Note: See TracChangeset for help on using the changeset viewer.