SNABSuite  0.x
Spiking Neural Architecture Benchmark Suite
activation_curve.hpp
Go to the documentation of this file.
1 /*
2  * SNABSuite -- Spiking Neural Architecture Benchmark Suite
3  * Copyright (C) 2018 Christoph Ostrau
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #pragma once
20 
21 #ifndef SNABSUITE_SNABS_ACTIVATION_CURVE_HPP
22 #define SNABSUITE_SNABS_ACTIVATION_CURVE_HPP
23 
24 #include <cypress/cypress.hpp>
25 
26 #include "common/snab_base.hpp"
27 
28 namespace SNAB {
36 protected:
37  cypress::PopulationBase m_pop;
38  std::vector<cypress::Population<cypress::SpikeSourceArray>> m_pop_source;
39  cypress::Real m_offset = 10.0; // ms; gobal offset
41  20; // Give the first neuron, that receives input at the same time
42  size_t m_num_steps =
43  0; // Stores the number of steps required to test all weights
44  virtual std::vector<std::vector<cypress::Real>> binned_spike_counts();
46  std::string name, std::string backend,
47  std::initializer_list<std::string> indicator_names,
48  std::initializer_list<std::string> indicator_types,
49  std::initializer_list<std::string> indicator_measures,
50  std::initializer_list<std::string> indicator_units,
51  std::initializer_list<std::string> required_parameters,
52  size_t bench_index);
53 
54 public:
55  WeightDependentActivation(const std::string backend, size_t bench_index);
56  cypress::Network &build_netw(cypress::Network &netw) override;
57  void run_netw(cypress::Network &netw) override;
58  std::vector<std::array<cypress::Real, 4>> evaluate() override;
59  virtual std::shared_ptr<SNABBase> clone() override
60  {
61  return std::make_shared<WeightDependentActivation>(m_backend,
63  }
64 };
65 
74 protected:
75  std::vector<std::vector<cypress::Real>> binned_spike_counts() override;
76  cypress::Real fraction_pres_time =
77  0.5; // Fraction of presentation time used to calculate frequency
78 public:
79  RateBasedWeightDependentActivation(const std::string backend,
80  size_t bench_index);
81  cypress::Network &build_netw(cypress::Network &netw) override;
82  void run_netw(cypress::Network &netw) override;
83  std::shared_ptr<SNABBase> clone() override
84  {
85  return std::make_shared<RateBasedWeightDependentActivation>(
87  }
88 };
89 
90 } // namespace SNAB
91 #endif /* SNABSUITE_SNABS_ACTIVATION_CURVE_HPP */
void run_netw(cypress::Network &netw) override
cypress::Network & build_netw(cypress::Network &netw) override
Building the neural network for benchmarking. If you want to use an external network, you should use the first version of building (and the corresponding run function), for the member network use the second function. The implementation is contained in the first one.
std::string m_backend
String which contains the name of the simulation backend.
Definition: snab_base.hpp:210
cypress::PopulationBase m_pop
virtual std::shared_ptr< SNABBase > clone() override
Virtual method cloning the SNAB without knowing which SNAB it is.
Virtual Base class for SNABs(Benchmarks). All SNABs should have seperate building of networks...
Definition: snab_base.hpp:33
const std::vector< std::string > & indicator_measures() const
Getter for SNABSSuite::m_indicator_measures.
Definition: snab_base.hpp:128
std::vector< std::array< cypress::Real, 4 > > evaluate() override
This should contain the evaluation process and return the result in order of those in names()...
const std::vector< std::string > & indicator_names() const
Getter for SNABSSuite::m_indicator_names.
Definition: snab_base.hpp:106
const std::vector< std::string > & indicator_types() const
Getter for SNABSSuite::m_indicator_types.
Definition: snab_base.hpp:117
std::shared_ptr< SNABBase > clone() override
Virtual method cloning the SNAB without knowing which SNAB it is.
std::vector< cypress::Population< cypress::SpikeSourceArray > > m_pop_source
const size_t m_bench_index
Definition: snab_base.hpp:260
WeightDependentActivation(std::string name, std::string backend, std::initializer_list< std::string > indicator_names, std::initializer_list< std::string > indicator_types, std::initializer_list< std::string > indicator_measures, std::initializer_list< std::string > indicator_units, std::initializer_list< std::string > required_parameters, size_t bench_index)
virtual std::vector< std::vector< cypress::Real > > binned_spike_counts()