Skip to content

Commit ca035fb

Browse files
committed
documentation changes
1 parent ce55d3a commit ca035fb

File tree

2 files changed

+32
-37
lines changed

2 files changed

+32
-37
lines changed

src/examples/napi_sine/README.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,25 @@
22
The program `sine_napi` is an example of an app using the Network API tools
33
available in the htm.core library. In this example we generate a sine wave
44
with some noise as the input. This is passed to an encoder to turn that
5-
into SDR format. This is passed to two instances of SpatialPooler (SP),
6-
one is configured for local inhibition and one for global inhibition.
5+
into a quantized format. This is passed to an instance of SpatialPooler (SP).
76

8-
The output of the SP for global inhibition is passed on to the temporalMemory (TM)
9-
algorithm. The output of the TM can be written to a file so that it can be plotted.
7+
The output of the SP passed on to the temporalMemory (TM) algorithm. The
8+
output of the TM can be written to a file so that it can be plotted.
109

1110
```
1211
///////////////////////////////////////////////////////////////
1312
//
14-
// .------------------.
15-
// | encoder |
16-
// data--->| (RDSERegion) |
17-
// | |
18-
// `------------------'
19-
// | |
20-
// .------------------. .------------------.
21-
// | SP (local) | | SP (global) |
22-
// | (SPRegion) | | (SPRegion) |
23-
// | | | |
24-
// `------------------' `------------------'
13+
// .------------------.
14+
// | encoder |
15+
// data--->| (RDSERegion) |
16+
// | |
17+
// `------------------'
18+
// |
19+
// .------------------.
20+
// | SP (global) |
21+
// | (SPRegion) |
22+
// | |
23+
// `------------------'
2524
// |
2625
// .------------------.
2726
// | TM |

src/examples/napi_sine/napi_sine.cpp

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,12 @@ int main(int argc, char* argv[]) {
3838
std::ofstream ofs;
3939

4040
std::string encoder_params = "{size: " + std::to_string(DIM_INPUT) + ", activeBits: 4, radius: 0.5, seed: 2019 }";
41-
// std::string sp_local_params = "{columnCount: " + std::to_string(COLS) + "}";
4241
std::string sp_global_params = "{columnCount: " + std::to_string(COLS) + ", globalInhibition: true}";
4342
std::string tm_params = "{activationThreshold: 9, cellsPerColumn: " + std::to_string(CELLS) + "}";
4443

4544
// Runtime arguments: napi_sine [epochs [filename]]
4645
if(argc >= 2) {
47-
EPOCHS = std::stoi(argv[1]); // number of iterations (default 500)
46+
EPOCHS = std::stoi(argv[1]); // number of iterations (default 5000)
4847
}
4948
if (argc >= 3) {
5049
ofs.open(argv[2], std::ios::out); // output filename (for plotting)
@@ -58,36 +57,34 @@ int main(int argc, char* argv[]) {
5857

5958
// Declare the regions to use
6059
std::shared_ptr<Region> encoder = net.addRegion("encoder", "RDSERegion", encoder_params);
61-
// std::shared_ptr<Region> sp_local = net.addRegion("sp_local", "SPRegion", sp_local_params);
6260
std::shared_ptr<Region> sp_global = net.addRegion("sp_global", "SPRegion", sp_global_params);
6361
std::shared_ptr<Region> tm = net.addRegion("tm", "TMRegion", tm_params);
6462

6563
// Setup data flows between regions
66-
// net.link("encoder", "sp_local", "", "", "encoded", "bottomUpIn");
6764
net.link("encoder", "sp_global", "", "", "encoded", "bottomUpIn");
6865
net.link("sp_global", "tm", "", "", "bottomUpOut", "bottomUpIn");
6966

7067
net.initialize();
7168

7269
///////////////////////////////////////////////////////////////
7370
//
74-
// .------------------.
75-
// | encoder |
76-
// data--->| (RDSERegion) |
77-
// | |
78-
// `------------------'
79-
// | |
80-
// .------------------. .------------------.
81-
// | sp_local | | sp_global |
82-
// | (SPRegion) | | (SPRegion) |
83-
// | | | |
84-
// `------------------' `------------------'
85-
// |
86-
// .------------------.
87-
// | tm |
88-
// | (TMRegion) |
89-
// | |
90-
// `------------------'
71+
// .----------------.
72+
// | encoder |
73+
// data--->| (RDSERegion) |
74+
// | |
75+
// `-----------------'
76+
// |
77+
// .-----------------.
78+
// | sp_global |
79+
// | (SPRegion) |
80+
// | |
81+
// `-----------------'
82+
// |
83+
// .-----------------.
84+
// | tm |
85+
// | (TMRegion) |
86+
// | |
87+
// `-----------------'
9188
//
9289
//////////////////////////////////////////////////////////////////
9390

@@ -111,7 +108,6 @@ int main(int argc, char* argv[]) {
111108
VERBOSE << "Epoch = " << i << std::endl;
112109
VERBOSE << " Data = " << data << std::endl;
113110
VERBOSE << " Encoder out = " << encoder->getOutputData("encoded").getSDR();
114-
// VERBOSE << " SP (local) = " << sp_local->getOutputData("bottomUpOut").getSDR();
115111
VERBOSE << " SP (global) = " << sp_global->getOutputData("bottomUpOut").getSDR();
116112
VERBOSE << " TM output = " << tm->getOutputData("bottomUpOut").getSDR();
117113
VERBOSE << " ActiveCells = " << tm->getOutputData("activeCells").getSDR();

0 commit comments

Comments
 (0)