Skip to content

Commit

Permalink
Add PushState method. Rebuild docs. (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
erp12 authored Apr 20, 2019
1 parent 1c8272b commit efff52e
Show file tree
Hide file tree
Showing 105 changed files with 11,896 additions and 1,637 deletions.
Binary file modified docs/doctrees/api/modules.doctree
Binary file not shown.
Binary file modified docs/doctrees/api/pyshgp.doctree
Binary file not shown.
Binary file modified docs/doctrees/api/pyshgp.gp.doctree
Binary file not shown.
Binary file modified docs/doctrees/api/pyshgp.push.doctree
Binary file not shown.
Binary file modified docs/doctrees/api/pyshgp.push.instructions.doctree
Binary file not shown.
Binary file modified docs/doctrees/api/pyshgp_cli.doctree
Binary file not shown.
Binary file modified docs/doctrees/core_instructions/v0_1_3_core_instructions.doctree
Binary file not shown.
Binary file not shown.
Binary file modified docs/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/doctrees/index.doctree
Binary file not shown.
Binary file modified docs/doctrees/instructions.doctree
Binary file not shown.
Binary file added docs/doctrees/push_types.doctree
Binary file not shown.
Binary file modified docs/doctrees/release_notes.doctree
Binary file not shown.
6 changes: 4 additions & 2 deletions docs/html/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@ <h1>All modules for which code is available</h1>
<li><a href="pyshgp/push/atoms.html">pyshgp.push.atoms</a></li>
<li><a href="pyshgp/push/instruction.html">pyshgp.push.instruction</a></li>
<li><a href="pyshgp/push/instruction_set.html">pyshgp.push.instruction_set</a></li>
<li><a href="pyshgp/push/instructions/code.html">pyshgp.push.instructions.code</a></li>
<li><a href="pyshgp/push/instructions.html">pyshgp.push.instructions</a></li>
<ul><li><a href="pyshgp/push/instructions/code.html">pyshgp.push.instructions.code</a></li>
<li><a href="pyshgp/push/instructions/common.html">pyshgp.push.instructions.common</a></li>
<li><a href="pyshgp/push/instructions/io.html">pyshgp.push.instructions.io</a></li>
<li><a href="pyshgp/push/instructions/logical.html">pyshgp.push.instructions.logical</a></li>
<li><a href="pyshgp/push/instructions/numeric.html">pyshgp.push.instructions.numeric</a></li>
<li><a href="pyshgp/push/instructions/text.html">pyshgp.push.instructions.text</a></li>
<li><a href="pyshgp/push/interpreter.html">pyshgp.push.interpreter</a></li>
</ul><li><a href="pyshgp/push/interpreter.html">pyshgp.push.interpreter</a></li>
<li><a href="pyshgp/push/stack.html">pyshgp.push.stack</a></li>
<li><a href="pyshgp/push/state.html">pyshgp.push.state</a></li>
<li><a href="pyshgp/push/type_library.html">pyshgp.push.type_library</a></li>
<li><a href="pyshgp/push/types.html">pyshgp.push.types</a></li>
<li><a href="pyshgp/utils.html">pyshgp.utils</a></li>
<li><a href="pyshgp/validation.html">pyshgp.validation</a></li>
Expand Down
41 changes: 21 additions & 20 deletions docs/html/_modules/pyshgp/gp/estimators.html

Large diffs are not rendered by default.

33 changes: 14 additions & 19 deletions docs/html/_modules/pyshgp/gp/evaluation.html

Large diffs are not rendered by default.

68 changes: 39 additions & 29 deletions docs/html/_modules/pyshgp/gp/genome.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/html/_modules/pyshgp/gp/individual.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ <h1>Source code for pyshgp.gp.individual</h1><div class="highlight"><pre>
<span class="kn">from</span> <span class="nn">pyshgp.gp.genome</span> <span class="k">import</span> <span class="n">Genome</span>


<div class="viewcode-block" id="Individual"><a class="viewcode-back" href="../../../api/pyshgp.gp.individual.html#pyshgp.gp.individual.Individual">[docs]</a><span class="k">class</span> <span class="nc">Individual</span><span class="p">:</span>
<div class="viewcode-block" id="Individual"><a class="viewcode-back" href="../../../api/pyshgp.gp.html#pyshgp.gp.individual.Individual">[docs]</a><span class="k">class</span> <span class="nc">Individual</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;An individual in an evolutionary population.</span>

<span class="sd"> Attributes</span>
Expand Down
20 changes: 10 additions & 10 deletions docs/html/_modules/pyshgp/gp/population.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ <h1>Source code for pyshgp.gp.population</h1><div class="highlight"><pre>
<span class="kn">from</span> <span class="nn">pyshgp.gp.evaluation</span> <span class="k">import</span> <span class="n">Evaluator</span>


<div class="viewcode-block" id="Population"><a class="viewcode-back" href="../../../api/pyshgp.gp.population.html#pyshgp.gp.population.Population">[docs]</a><span class="k">class</span> <span class="nc">Population</span><span class="p">(</span><span class="n">Sequence</span><span class="p">):</span>
<div class="viewcode-block" id="Population"><a class="viewcode-back" href="../../../api/pyshgp.gp.html#pyshgp.gp.population.Population">[docs]</a><span class="k">class</span> <span class="nc">Population</span><span class="p">(</span><span class="n">Sequence</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;A sequence of Individuals kept in sorted order, with respect to their total errors.&quot;&quot;&quot;</span>

<span class="vm">__slots__</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;unevaluated&quot;</span><span class="p">,</span> <span class="s2">&quot;evaluated&quot;</span><span class="p">]</span>
Expand All @@ -69,46 +69,46 @@ <h1>Source code for pyshgp.gp.population</h1><div class="highlight"><pre>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">evaluated</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">unevaluated</span><span class="p">[</span><span class="n">key</span> <span class="o">-</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">evaluated</span><span class="p">)]</span>

<div class="viewcode-block" id="Population.add"><a class="viewcode-back" href="../../../api/pyshgp.gp.population.html#pyshgp.gp.population.Population.add">[docs]</a> <span class="k">def</span> <span class="nf">add</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">individual</span><span class="p">:</span> <span class="n">Individual</span><span class="p">):</span>
<div class="viewcode-block" id="Population.add"><a class="viewcode-back" href="../../../api/pyshgp.gp.html#pyshgp.gp.population.Population.add">[docs]</a> <span class="k">def</span> <span class="nf">add</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">individual</span><span class="p">:</span> <span class="n">Individual</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Add an Individaul to the population.&quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">individual</span><span class="o">.</span><span class="n">total_error</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">unevaluated</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">individual</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">insort_left</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">evaluated</span><span class="p">,</span> <span class="n">individual</span><span class="p">)</span>
<span class="k">return</span> <span class="bp">self</span></div>

<div class="viewcode-block" id="Population.best"><a class="viewcode-back" href="../../../api/pyshgp.gp.population.html#pyshgp.gp.population.Population.best">[docs]</a> <span class="k">def</span> <span class="nf">best</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<div class="viewcode-block" id="Population.best"><a class="viewcode-back" href="../../../api/pyshgp.gp.html#pyshgp.gp.population.Population.best">[docs]</a> <span class="k">def</span> <span class="nf">best</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return the best n individual in the population.&quot;&quot;&quot;</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">evaluated</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span></div>

<div class="viewcode-block" id="Population.best_n"><a class="viewcode-back" href="../../../api/pyshgp.gp.population.html#pyshgp.gp.population.Population.best_n">[docs]</a> <span class="k">def</span> <span class="nf">best_n</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">n</span><span class="p">:</span> <span class="nb">int</span><span class="p">):</span>
<div class="viewcode-block" id="Population.best_n"><a class="viewcode-back" href="../../../api/pyshgp.gp.html#pyshgp.gp.population.Population.best_n">[docs]</a> <span class="k">def</span> <span class="nf">best_n</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">n</span><span class="p">:</span> <span class="nb">int</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return the best n individuals in the population.&quot;&quot;&quot;</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">evaluated</span><span class="p">[:</span><span class="n">n</span><span class="p">]</span></div>

<div class="viewcode-block" id="Population.evaluate"><a class="viewcode-back" href="../../../api/pyshgp.gp.population.html#pyshgp.gp.population.Population.evaluate">[docs]</a> <span class="k">def</span> <span class="nf">evaluate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evaluator</span><span class="p">:</span> <span class="n">Evaluator</span><span class="p">):</span>
<div class="viewcode-block" id="Population.evaluate"><a class="viewcode-back" href="../../../api/pyshgp.gp.html#pyshgp.gp.population.Population.evaluate">[docs]</a> <span class="k">def</span> <span class="nf">evaluate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evaluator</span><span class="p">:</span> <span class="n">Evaluator</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Evaluate all unevaluated individuals in the population.&quot;&quot;&quot;</span>
<span class="k">for</span> <span class="n">individual</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">unevaluated</span><span class="p">:</span>
<span class="n">individual</span><span class="o">.</span><span class="n">error_vector</span> <span class="o">=</span> <span class="n">evaluator</span><span class="o">.</span><span class="n">evaluate</span><span class="p">(</span><span class="n">individual</span><span class="o">.</span><span class="n">program</span><span class="p">)</span>
<span class="n">insort_left</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">evaluated</span><span class="p">,</span> <span class="n">individual</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">unevaluated</span> <span class="o">=</span> <span class="p">[]</span></div>

<div class="viewcode-block" id="Population.all_error_vectors"><a class="viewcode-back" href="../../../api/pyshgp.gp.population.html#pyshgp.gp.population.Population.all_error_vectors">[docs]</a> <span class="k">def</span> <span class="nf">all_error_vectors</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<div class="viewcode-block" id="Population.all_error_vectors"><a class="viewcode-back" href="../../../api/pyshgp.gp.html#pyshgp.gp.population.Population.all_error_vectors">[docs]</a> <span class="k">def</span> <span class="nf">all_error_vectors</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;2D array containing all Individuals&#39; error vectors.&quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="n">i</span><span class="o">.</span><span class="n">error_vector</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">evaluated</span><span class="p">])</span></div>

<div class="viewcode-block" id="Population.all_total_errors"><a class="viewcode-back" href="../../../api/pyshgp.gp.population.html#pyshgp.gp.population.Population.all_total_errors">[docs]</a> <span class="k">def</span> <span class="nf">all_total_errors</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<div class="viewcode-block" id="Population.all_total_errors"><a class="viewcode-back" href="../../../api/pyshgp.gp.html#pyshgp.gp.population.Population.all_total_errors">[docs]</a> <span class="k">def</span> <span class="nf">all_total_errors</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;1D array containing all Individuals&#39; total errors.&quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="n">i</span><span class="o">.</span><span class="n">total_error</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">evaluated</span><span class="p">])</span></div>

<div class="viewcode-block" id="Population.median_error"><a class="viewcode-back" href="../../../api/pyshgp.gp.population.html#pyshgp.gp.population.Population.median_error">[docs]</a> <span class="k">def</span> <span class="nf">median_error</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<div class="viewcode-block" id="Population.median_error"><a class="viewcode-back" href="../../../api/pyshgp.gp.html#pyshgp.gp.population.Population.median_error">[docs]</a> <span class="k">def</span> <span class="nf">median_error</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Median total error in the population.&quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">median</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">all_total_errors</span><span class="p">())</span></div>

<div class="viewcode-block" id="Population.error_diversity"><a class="viewcode-back" href="../../../api/pyshgp.gp.population.html#pyshgp.gp.population.Population.error_diversity">[docs]</a> <span class="k">def</span> <span class="nf">error_diversity</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<div class="viewcode-block" id="Population.error_diversity"><a class="viewcode-back" href="../../../api/pyshgp.gp.html#pyshgp.gp.population.Population.error_diversity">[docs]</a> <span class="k">def</span> <span class="nf">error_diversity</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Proportion of unique error vectors.&quot;&quot;&quot;</span>
<span class="k">return</span> <span class="nb">len</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">unique</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">all_error_vectors</span><span class="p">(),</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">))</span> <span class="o">/</span> <span class="nb">float</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="p">))</span></div>

<div class="viewcode-block" id="Population.genome_diversity"><a class="viewcode-back" href="../../../api/pyshgp.gp.population.html#pyshgp.gp.population.Population.genome_diversity">[docs]</a> <span class="k">def</span> <span class="nf">genome_diversity</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<div class="viewcode-block" id="Population.genome_diversity"><a class="viewcode-back" href="../../../api/pyshgp.gp.html#pyshgp.gp.population.Population.genome_diversity">[docs]</a> <span class="k">def</span> <span class="nf">genome_diversity</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Proportion of unique genomes.&quot;&quot;&quot;</span>
<span class="n">unq</span> <span class="o">=</span> <span class="nb">set</span><span class="p">([</span><span class="n">i</span><span class="o">.</span><span class="n">genome</span><span class="o">.</span><span class="n">jsonify</span><span class="p">()</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="bp">self</span><span class="p">])</span>
<span class="k">return</span> <span class="nb">len</span><span class="p">(</span><span class="n">unq</span><span class="p">)</span> <span class="o">/</span> <span class="nb">float</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="p">))</span></div></div>
Expand Down
Loading

0 comments on commit efff52e

Please sign in to comment.