You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cleaner code to imagine and render imaginary rollouts from custom states by splitting RLToyEnv.render() into 2 functions; improved naming of the image representation function to get_image_representation in ImageMultiDiscrete and ImageContinuous; made get_image_representation for the cont. 2-D toy env in ImageContinuous be applicable to an array of observations and render an epistemic uncertainty around the observation.
<codeclass="sig-name descname"><spanclass="pre">get_concatenated_image</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">continuous_obs</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/mdp_playground/spaces/image_continuous.html#ImageContinuous.get_concatenated_image"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink" href="#mdp_playground.spaces.image_continuous.ImageContinuous.get_concatenated_image" title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname"><spanclass="pre">get_image_representation</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">continuous_obs</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/mdp_playground/spaces/image_continuous.html#ImageContinuous.get_image_representation"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink" href="#mdp_playground.spaces.image_continuous.ImageContinuous.get_image_representation" title="Permalink to this definition">¶</a></dt>
470
470
<dd><p>Gets an image representation for a given feature space observation</p>
<td><p>Gets the “stitched together” image made from images corresponding to each continuous sub-space within the continuous space, concatenated along the X-axis.</p></td>
<codeclass="sig-name descname"><spanclass="pre">get_concatenated_image</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">obs</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/mdp_playground/spaces/image_continuous.html#ImageContinuous.get_concatenated_image"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink" href="#id0" title="Permalink to this definition">¶</a></dt>
588
+
<codeclass="sig-name descname"><spanclass="pre">get_image_representation</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">obs</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/mdp_playground/spaces/image_continuous.html#ImageContinuous.get_image_representation"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink" href="#id0" title="Permalink to this definition">¶</a></dt>
589
589
<dd><p>Gets the “stitched together” image made from images corresponding to
590
590
each continuous sub-space within the continuous space, concatenated
<p>A space that maps a (multi-)discrete space 1-to-1 to images so that the images may be used as representations for corresponding (multi-)discrete states. A MultiDiscrete space will have multiple dimensions. For each of these dimensions, there is a size that represents the number of categorical states that correspond to that dimension. For size = n, each of these categorical states is numbered from 0 to n-1. For each categorical state numbered n, we associate a polygon with n + 3 sides. This polygon is present in the image associated with this dimension. The images generated for all the dimensions are concatenated together by placing them side by side in the order of the dimensions in Space. Any of the transforms - rotate, flip, scale, shift - can be associated with an object of this class, to apply at random to polygons in the images whenever they are generated.</p>
<codeclass="sig-name descname"><spanclass="pre">get_concatenated_image</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">multi_discrete_state</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/mdp_playground/spaces/image_multi_discrete.html#ImageMultiDiscrete.get_concatenated_image"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink" href="#mdp_playground.spaces.image_multi_discrete.ImageMultiDiscrete.get_concatenated_image" title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname"><spanclass="pre">get_image_representation</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">multi_discrete_state</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/mdp_playground/spaces/image_multi_discrete.html#ImageMultiDiscrete.get_image_representation"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink" href="#mdp_playground.spaces.image_multi_discrete.ImageMultiDiscrete.get_image_representation" title="Permalink to this definition">¶</a></dt>
469
469
<dd><p>Gets an image representation for a given multi_discrete_state</p>
<td><p>Gets the “stitched together” image made from images corresponding to each discrete sub-space within the multidiscrete space, concatenated along the X-axis</p></td>
<codeclass="sig-name descname"><spanclass="pre">get_concatenated_image</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">multi_discrete_state</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/mdp_playground/spaces/image_multi_discrete.html#ImageMultiDiscrete.get_concatenated_image"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink" href="#id0" title="Permalink to this definition">¶</a></dt>
567
+
<codeclass="sig-name descname"><spanclass="pre">get_image_representation</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">multi_discrete_state</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/mdp_playground/spaces/image_multi_discrete.html#ImageMultiDiscrete.get_image_representation"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink" href="#id0" title="Permalink to this definition">¶</a></dt>
568
568
<dd><p>Gets the “stitched together” image made from images corresponding to each discrete sub-space within the multidiscrete space, concatenated along the X-axis</p>
<spanclass="k">for</span><spanclass="n">i</span><spanclass="ow">in</span><spanclass="nb">range</span><spanclass="p">(</span><spanclass="mi">1</span><spanclass="p">,</span><spanclass="bp">self</span><spanclass="o">.</span><spanclass="n">grid_shape</span><spanclass="p">[</span><spanclass="mi">0</span><spanclass="o">+</span><spanclass="n">offset</span><spanclass="p">]</span><spanclass="o">+</span><spanclass="mi">1</span><spanclass="p">):</span><spanclass="c1"># +1 because this is along</span>
558
558
<spanclass="c1"># concatentation dimension when stitching together images below in</span>
559
-
<spanclass="c1"># get_concatenated_image</span>
559
+
<spanclass="c1"># get_image_representation</span>
560
560
<spanclass="n">x_</span><spanclass="o">=</span><spanclass="n">i</span><spanclass="o">*</span><spanclass="bp">self</span><spanclass="o">.</span><spanclass="n">width</span><spanclass="o">//</span><spanclass="bp">self</span><spanclass="o">.</span><spanclass="n">grid_shape</span><spanclass="p">[</span><spanclass="mi">0</span><spanclass="o">+</span><spanclass="n">offset</span><spanclass="p">]</span><spanclass="o">-</span><spanclass="mi">1</span><spanclass="c1"># -1 to not go outside</span>
561
561
<spanclass="c1"># image size for the last line drawn</span>
<spanclass="k">return</span><spanclass="s2">"</span><spanclass="si">{}</span><spanclass="s2"> with continuous underlying space of shape: </span><spanclass="si">{}</span><spanclass="s2"> and "</span>\
0 commit comments