Skip to content

Commit

Permalink
improve documents and instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
atenagm1375 committed Apr 2, 2021
1 parent 5fb5c5b commit 9958a38
Show file tree
Hide file tree
Showing 16 changed files with 164 additions and 16 deletions.
32 changes: 32 additions & 0 deletions cnsproject/decision/decision.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,35 @@ def update(self, **kwargs) -> None:
"""
pass


class WinnerTakeAllDecision(AbstractDecision):
"""
The k-Winner-Take-All decision mechanism.
You will have to define a constructor and specify the required \
attributes, including k, the number of winners.
"""

def compute(self, **kwargs) -> None:
"""
Infer the decision to be made.
Returns
-------
None
It should return the decision result.
"""
pass

def update(self, **kwargs) -> None:
"""
Update the variables after making the decision.
Returns
-------
None
"""
pass
12 changes: 10 additions & 2 deletions docs/Phase10.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@
<li class="toctree-l2"><a class="reference internal" href="Phase7.html">Phase 7</a></li>
<li class="toctree-l2"><a class="reference internal" href="Phase8.html">Phase 8</a></li>
<li class="toctree-l2"><a class="reference internal" href="Phase9.html">Phase 9</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Phase 10</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Phase 10</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#code-manual">Code Manual</a></li>
</ul>
</li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -176,7 +179,12 @@ <h1>Phase 10<a class="headerlink" href="#phase-10" title="Permalink to this head
<embed>
<iframe src="_downloads/Project-10.pdf" width="100%" height="1000px">
</iframe>
</embed></div>
</embed><div class="section" id="code-manual">
<h2>Code Manual<a class="headerlink" href="#code-manual" title="Permalink to this headline"></a></h2>
<p>Complete <strong>WinnerTakeAllDecision</strong> class in <cite>cnsproject.decision.decision module</cite>. You should also implement lateral inhibition mechanism. It is suggested to place it in <cite>utils.py</cite> but you can implement it in any other file you like. You will need to use <strong>InputPopulation</strong> for first layer to feed the filtered image into the network. You may also need to modify network to handle the decision object and computations.</p>
<p>In case you have not implemented any visualization utility for plotting the convolutional weights, you will need to do so in this phase represent the extracted features.</p>
</div>
</div>


</div>
Expand Down
3 changes: 2 additions & 1 deletion docs/Phase4.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ <h1>Phase 4<a class="headerlink" href="#phase-4" title="Permalink to this headli
</iframe>
</embed><div class="section" id="code-manual">
<h2>Code Manual<a class="headerlink" href="#code-manual" title="Permalink to this headline"></a></h2>
<p>To complete this project, you will have to make modifications in <strong>DenseConnection</strong> and <strong>RandomConnection</strong> in <cite>cnsproject.network.connections module</cite>. Make sure to read the documentation provided in <strong>AbstractConnection</strong> beforehand. You can also define more modules inheriting <strong>AbstractConnection</strong> and defining different patterns of connectivity, if desired. Furthermore, you might need to modify <em>forward</em> method of your neural populations to be able to handle input from other populations. In other words, you will need to consider how to convert pre-synaptic spikes into current or make changes to support spike as input to <em>forward</em>.</p>
<p>To complete this project, you will have to make modifications in <strong>DenseConnection</strong> and <strong>RandomConnection</strong> in <cite>cnsproject.network.connections module</cite>. Make sure to read the documentation provided in <strong>AbstractConnection</strong> beforehand. You can also define more modules inheriting <strong>AbstractConnection</strong> and defining different patterns of connectivity, if desired. You may ignore <em>update</em> method as it will be required in case of learning.</p>
<p>Furthermore, you might need to modify <em>forward</em> method of your neural populations to be able to handle input from other populations. In other words, you will need to consider how to convert pre-synaptic spikes into current or make changes to support spike as input to <em>forward</em>.</p>
<p>A simple network is constructed from the components you are already familiar with, i.e. neural populations, the connections among them, and monitor objects. So, instead of writing a long script everytime to run a simulation, you can implement <em>run</em> method of <strong>Network</strong> in <cite>cnsproject.network.network module</cite>. Read the documentation provided in <strong>Network</strong> class and see how it can reduce the amount of code you will have to write everytime. You will need to complete this method in future to include other computations as well.</p>
<p>Do not forget to implement the required visualization functions/classes. Use monitor to record the desired variables.</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/Phase6.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ <h1>Phase 6<a class="headerlink" href="#phase-6" title="Permalink to this headli
</embed><div class="section" id="code-manual">
<h2>Code Manual<a class="headerlink" href="#code-manual" title="Permalink to this headline"></a></h2>
<p>You will need to complete the body of <strong>STDP</strong> and <strong>FlatSTDP</strong> classes in <cite>cnsproject.learning.learning_rules module</cite>. Read the documentation provided in <strong>LearningRule</strong> before getting started.</p>
<p>To move further in the project, you will have to make a dense connection between an instance of <strong>InputPopulation</strong> and an instance of one of the neural populations you have implemented in phases 1 and 2. The <strong>InputPopulation</strong> will take care of input spikes and you will not need to modify unless you wish it to have a different behavior. You can also add other modules and functions if you like. You will also need to modify <em>run</em> method of <strong>Network</strong> accordingly.</p>
<p>To move further in the project, you will have to make a dense connection between an instance of <strong>InputPopulation</strong> and an instance of one of the neural populations you have implemented in phases 1 and 2. The <strong>InputPopulation</strong> will take care of input spikes and you will not need to modify unless you wish it to have a different behavior. You can also add other modules and functions if you like. You will also need to modify <em>run</em> method of <strong>Network</strong> accordingly. Also do not forget to complete <em>update</em> and <em>compute</em> in <strong>Connection classes</strong> in case you left them intact or incomplete in previous projects.</p>
</div>
</div>

Expand Down
12 changes: 10 additions & 2 deletions docs/Phase8.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@
<li class="toctree-l2"><a class="reference internal" href="Phase5.html">Phase 5</a></li>
<li class="toctree-l2"><a class="reference internal" href="Phase6.html">Phase 6</a></li>
<li class="toctree-l2"><a class="reference internal" href="Phase7.html">Phase 7</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Phase 8</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Phase 8</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#code-manual">Code Manual</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="Phase9.html">Phase 9</a></li>
<li class="toctree-l2"><a class="reference internal" href="Phase10.html">Phase 10</a></li>
</ul>
Expand Down Expand Up @@ -176,7 +179,12 @@ <h1>Phase 8<a class="headerlink" href="#phase-8" title="Permalink to this headli
<embed>
<iframe src="_downloads/Project-08.pdf" width="100%" height="1000px">
</iframe>
</embed></div>
</embed><div class="section" id="code-manual">
<h2>Code Manual<a class="headerlink" href="#code-manual" title="Permalink to this headline"></a></h2>
<p>In this project, you will need to implement Difference of Gaussian and Gabor filters. You can define them anywhere and anyhow you wish. Yet, it is recommended to implement them in the form of classes with an abstract base class <strong>Filter</strong>. You can either create a new package (e.g. <em>image_processing</em> or <em>filters</em>) or implement them in the <cite>utils.py</cite> file or somewhere in <cite>cnsproject.encoding package</cite>.</p>
<p>You will have to use your previously written encoders. You may also want to add some visualization functions.</p>
</div>
</div>


</div>
Expand Down
11 changes: 9 additions & 2 deletions docs/Phase9.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@
<li class="toctree-l2"><a class="reference internal" href="Phase6.html">Phase 6</a></li>
<li class="toctree-l2"><a class="reference internal" href="Phase7.html">Phase 7</a></li>
<li class="toctree-l2"><a class="reference internal" href="Phase8.html">Phase 8</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Phase 9</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Phase 9</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#code-manual">Code Manual</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="Phase10.html">Phase 10</a></li>
</ul>
</li>
Expand Down Expand Up @@ -176,7 +179,11 @@ <h1>Phase 9<a class="headerlink" href="#phase-9" title="Permalink to this headli
<embed>
<iframe src="_downloads/Project-09.pdf" width="100%" height="1000px">
</iframe>
</embed></div>
</embed><div class="section" id="code-manual">
<h2>Code Manual<a class="headerlink" href="#code-manual" title="Permalink to this headline"></a></h2>
<p>You will have to fill in the <strong>ConvolutionalConnection</strong> and <strong>PoolingConnection</strong> classes in <cite>cnsproject.network.connection module</cite>. In <strong>PoolingConnection</strong>, it said to consider an attribute for specifying type of pooling (i.e. max pool or average pool). You may ignore that and only implement the max pooling functionality. You will also add an attribute in <strong>ConvolutionalConnection</strong> to specify the filter and use the functions/classes from previous phase. You might need to reconsider <em>update</em> of your learning rules.</p>
</div>
</div>


</div>
Expand Down
11 changes: 11 additions & 0 deletions docs/_sources/Phase10.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,14 @@ Phase 10
<iframe src="_downloads/Project-10.pdf" width="100%" height="1000px">
</iframe>
</embed>


Code Manual
-----------
Complete **WinnerTakeAllDecision** class in `cnsproject.decision.decision module`. You should also implement lateral \
inhibition mechanism. It is suggested to place it in `utils.py` but you can implement it in any other file you like. \
You will need to use **InputPopulation** for first layer to feed the filtered image into the network. You may also \
need to modify network to handle the decision object and computations.

In case you have not implemented any visualization utility for plotting the convolutional weights, you will need to \
do so in this phase represent the extracted features.
8 changes: 5 additions & 3 deletions docs/_sources/Phase4.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ Code Manual
To complete this project, you will have to make modifications in **DenseConnection** and **RandomConnection** in \
`cnsproject.network.connections module`. Make sure to read the documentation provided in **AbstractConnection** \
beforehand. You can also define more modules inheriting **AbstractConnection** and defining different patterns \
of connectivity, if desired. Furthermore, you might need to modify *forward* method of your neural populations to \
be able to handle input from other populations. In other words, you will need to consider how to convert pre-synaptic \
spikes into current or make changes to support spike as input to *forward*.
of connectivity, if desired. You may ignore *update* method as it will be required in case of learning.

Furthermore, you might need to modify *forward* method of your neural populations to be able to handle input from \
other populations. In other words, you will need to consider how to convert pre-synaptic spikes into current or make \
changes to support spike as input to *forward*.

A simple network is constructed from the components you are already familiar with, i.e. neural populations, \
the connections among them, and monitor objects. So, instead of writing a long script everytime to run a simulation, \
Expand Down
4 changes: 3 additions & 1 deletion docs/_sources/Phase6.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ Read the documentation provided in **LearningRule** before getting started.
To move further in the project, you will have to make a dense connection between an instance of **InputPopulation** \
and an instance of one of the neural populations you have implemented in phases 1 and 2. The **InputPopulation** will \
take care of input spikes and you will not need to modify unless you wish it to have a different behavior. You can \
also add other modules and functions if you like. You will also need to modify *run* method of **Network** accordingly.
also add other modules and functions if you like. You will also need to modify *run* method of **Network** accordingly. \
Also do not forget to complete *update* and *compute* in **Connection classes** in case you left them intact or \
incomplete in previous projects.
10 changes: 10 additions & 0 deletions docs/_sources/Phase8.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,13 @@ Phase 8
<iframe src="_downloads/Project-08.pdf" width="100%" height="1000px">
</iframe>
</embed>


Code Manual
-----------
In this project, you will need to implement Difference of Gaussian and Gabor filters. You can define them anywhere \
and anyhow you wish. Yet, it is recommended to implement them in the form of classes with an abstract base class \
**Filter**. You can either create a new package (e.g. *image_processing* or *filters*) or implement them in the \
`utils.py` file or somewhere in `cnsproject.encoding package`.

You will have to use your previously written encoders. You may also want to add some visualization functions.
9 changes: 9 additions & 0 deletions docs/_sources/Phase9.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,12 @@ Phase 9
<iframe src="_downloads/Project-09.pdf" width="100%" height="1000px">
</iframe>
</embed>


Code Manual
-----------
You will have to fill in the **ConvolutionalConnection** and **PoolingConnection** classes in `cnsproject.network.conne\
ction module`. In **PoolingConnection**, it said to consider an attribute for specifying type of pooling (i.e. max pool \
or average pool). You may ignore that and only implement the max pooling functionality. You will also add an attribute \
in **ConvolutionalConnection** to specify the filter and use the functions/classes from previous phase. You might \
need to reconsider *update* of your learning rules.
36 changes: 36 additions & 0 deletions docs/cnsproject.decision.html
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,42 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

</dd></dl>

<dl class="py class">
<dt id="cnsproject.decision.decision.WinnerTakeAllDecision">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">cnsproject.decision.decision.</span></code><code class="sig-name descname"><span class="pre">WinnerTakeAllDecision</span></code><a class="headerlink" href="#cnsproject.decision.decision.WinnerTakeAllDecision" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#cnsproject.decision.decision.AbstractDecision" title="cnsproject.decision.decision.AbstractDecision"><code class="xref py py-class docutils literal notranslate"><span class="pre">cnsproject.decision.decision.AbstractDecision</span></code></a></p>
<p>The k-Winner-Take-All decision mechanism.</p>
<p>You will have to define a constructor and specify the required attributes, including k, the number of winners.</p>
<dl class="py method">
<dt id="cnsproject.decision.decision.WinnerTakeAllDecision.compute">
<code class="sig-name descname"><span class="pre">compute</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> &#x2192; <span class="pre">None</span><a class="headerlink" href="#cnsproject.decision.decision.WinnerTakeAllDecision.compute" title="Permalink to this definition"></a></dt>
<dd><p>Infer the decision to be made.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>It should return the decision result.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>None</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="cnsproject.decision.decision.WinnerTakeAllDecision.update">
<code class="sig-name descname"><span class="pre">update</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> &#x2192; <span class="pre">None</span><a class="headerlink" href="#cnsproject.decision.decision.WinnerTakeAllDecision.update" title="Permalink to this definition"></a></dt>
<dd><p>Update the variables after making the decision.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p></p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>None</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-cnsproject.decision">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-cnsproject.decision" title="Permalink to this headline"></a></h2>
Expand Down
13 changes: 13 additions & 0 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ <h1 id="index">Index</h1>
| <a href="#S"><strong>S</strong></a>
| <a href="#T"><strong>T</strong></a>
| <a href="#U"><strong>U</strong></a>
| <a href="#W"><strong>W</strong></a>

</div>
<h2 id="A">A</h2>
Expand Down Expand Up @@ -318,6 +319,8 @@ <h2 id="C">C</h2>
<li><a href="cnsproject.decision.html#cnsproject.decision.decision.AbstractDecision.compute">compute() (cnsproject.decision.decision.AbstractDecision method)</a>

<ul>
<li><a href="cnsproject.decision.html#cnsproject.decision.decision.WinnerTakeAllDecision.compute">(cnsproject.decision.decision.WinnerTakeAllDecision method)</a>
</li>
<li><a href="cnsproject.learning.html#cnsproject.learning.rewards.AbstractReward.compute">(cnsproject.learning.rewards.AbstractReward method)</a>
</li>
<li><a href="cnsproject.network.html#cnsproject.network.connections.AbstractConnection.compute">(cnsproject.network.connections.AbstractConnection method)</a>
Expand Down Expand Up @@ -609,6 +612,8 @@ <h2 id="U">U</h2>
<li><a href="cnsproject.decision.html#cnsproject.decision.decision.AbstractDecision.update">update() (cnsproject.decision.decision.AbstractDecision method)</a>

<ul>
<li><a href="cnsproject.decision.html#cnsproject.decision.decision.WinnerTakeAllDecision.update">(cnsproject.decision.decision.WinnerTakeAllDecision method)</a>
</li>
<li><a href="cnsproject.learning.html#cnsproject.learning.learning_rules.FlatRSTDP.update">(cnsproject.learning.learning_rules.FlatRSTDP method)</a>
</li>
<li><a href="cnsproject.learning.html#cnsproject.learning.learning_rules.FlatSTDP.update">(cnsproject.learning.learning_rules.FlatSTDP method)</a>
Expand Down Expand Up @@ -637,6 +642,14 @@ <h2 id="U">U</h2>
</ul></td>
</tr></table>

<h2 id="W">W</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="cnsproject.decision.html#cnsproject.decision.decision.WinnerTakeAllDecision">WinnerTakeAllDecision (class in cnsproject.decision.decision)</a>
</li>
</ul></td>
</tr></table>



</div>
Expand Down
Binary file modified docs/objects.inv
Binary file not shown.
Loading

0 comments on commit 9958a38

Please sign in to comment.