/// <summary> /// Defines a data field that can then be used in input fields or output fields. /// The normalizer instance binds to the data field type. /// Specifying the same type name on different data fields causes the data fields to be grouped under /// one instance of the normalizer. /// </summary> /// <param name="name">Field name</param> /// <param name="type">Field type</param> /// <param name="normReserveRatio">Reserve held by the normalizer to cover cases where future data exceeds a known range of sample data.</param> /// <param name="dataStandardization">Specifies whether to apply data standardization</param> /// <param name="fixedMin">Normalizer fixed min</param> /// <param name="fixedMax">Normalizer fixed max</param> public void DefineField(string name, string type, double normReserveRatio, bool dataStandardization, double fixedMin = double.NaN, double fixedMax = double.NaN) { if (_outputFieldAdjustmentSwitches != null) { throw new Exception($"Can't define field, structure is finalized."); } if (IsFieldDefined(name)) { throw new ArgumentException($"Field {name} is already defined", "name"); } if (!_fieldTypeIniNormalizerCollection.ContainsKey(type)) { Normalizer iniNormalizer = new Normalizer(NormRange, normReserveRatio, dataStandardization); if (fixedMin.IsValid()) { iniNormalizer.Adjust(fixedMin); } if (fixedMax.IsValid()) { iniNormalizer.Adjust(fixedMax); } _fieldTypeIniNormalizerCollection.Add(type, iniNormalizer); _fieldTypeNormalizerCollection.Add(type, new Normalizer(iniNormalizer)); } _fieldNameTypeCollection.Add(name, type); _fieldNameCollection.Add(name); return; }
//Static constructor static FiringRate() { _sumOfSpikeValues = 0; _spikeValueCache = new decimal[SpikeBuffLength]; for (int i = 0; i < SpikeBuffLength; i++) { decimal val = (decimal)Math.Exp(-i); _spikeValueCache[i] = val; _sumOfSpikeValues += val; } _outputNormalizer = new Normalizer(new Interval(-1, 1), 0, false); _outputNormalizer.Adjust(0); _outputNormalizer.Adjust(1); return; }