class InitSparseConnectivitySnippet::FixedProbability¶
Initialises connectivity with a fixed probability of a synapse existing between a pair of pre and postsynaptic neurons.
Whether a synapse exists between a pair of pre and a postsynaptic neurons can be modelled using a Bernoulli distribution. While this COULD br sampling directly by repeatedly drawing from the uniform distribution, this is innefficient. Instead we sample from the gemetric distribution which describes “the probability distribution of the number of Bernoulli trials needed to get one success” essentially the distribution of the ‘gaps’ between synapses. We do this using the “inversion method” described by Devroye (1986) essentially inverting the CDF of the equivalent continuous distribution (in this case the exponential distribution)
#include <initSparseConnectivitySnippet.h> class FixedProbability: public InitSparseConnectivitySnippet::FixedProbabilityBase { public: // methods DECLARE_SNIPPET( InitSparseConnectivitySnippet::FixedProbability, 1 ); SET_ROW_BUILD_CODE(); };
Inherited Members¶
public: // typedefs typedef std::vector<std::string> StringVec; typedef std::vector<EGP> EGPVec; typedef std::vector<ParamVal> ParamValVec; typedef std::vector<DerivedParam> DerivedParamVec; typedef std::function<unsigned int(unsigned int, unsigned int, const std::vector<double>&)> CalcMaxLengthFunc; // structs struct DerivedParam; struct EGP; struct ParamVal; // methods virtual ~Base(); virtual StringVec getParamNames() const; virtual DerivedParamVec getDerivedParams() const; virtual std::string getRowBuildCode() const; virtual ParamValVec getRowBuildStateVars() const; virtual CalcMaxLengthFunc getCalcMaxRowLengthFunc() const; virtual CalcMaxLengthFunc getCalcMaxColLengthFunc() const; virtual EGPVec getExtraGlobalParams() const; size_t getExtraGlobalParamIndex(const std::string& paramName) const; virtual std::string getRowBuildCode() const = 0; SET_ROW_BUILD_STATE_VARS({{"prevJ","int",-1}}); virtual StringVec getParamNames() const; virtual DerivedParamVec getDerivedParams() const; SET_CALC_MAX_ROW_LENGTH_FUNC((unsigned int numPre, unsigned int numPost, const std::vector<double>&pars){const double quantile=pow(0.9999, 1.0/(double) numPre);return binomialInverseCDF(quantile, numPost, pars[0]);}); SET_CALC_MAX_COL_LENGTH_FUNC((unsigned int numPre, unsigned int numPost, const std::vector<double>&pars){const double quantile=pow(0.9999, 1.0/(double) numPost);return binomialInverseCDF(quantile, numPre, pars[0]);});