Skip to content

Commit

Permalink
Miscellaneous Fixes (#447)
Browse files Browse the repository at this point in the history
## Description

<!-- Provide a brief description of the PR's purpose here. -->

Random fixes across documentation.

## TODO

<!-- Notable points that this PR has either accomplished or will
accomplish. -->

- [x] Fix ArchiveDataframe link in visualize docstrings
- [x] Refer to solution correctly in dqd tutorial visualization
- [x] Remove unused variables in dqd tutorial
- [x] Fix import in mnist training
- [x] Pin Brax to 0.9.3 due to mujoco-mjx installation issues

## Status

- [x] I have read the guidelines in

[CONTRIBUTING.md](https://github.com/icaros-usc/pyribs/blob/master/CONTRIBUTING.md)
- [x] I have formatted my code using `yapf`
- [x] I have tested my code by running `pytest`
- [x] I have linted my code with `pylint`
- [N/A] I have added a one-line description of my change to the
changelog in
      `HISTORY.md`
- [x] This PR is ready to go
  • Loading branch information
btjanaka committed Jan 23, 2024
1 parent 7e08f3a commit 7ba4c21
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ jobs:
- name: Test visualize extra
run: pytest tests/visualize
- name: Install QDax
run: pip install qdax
# Brax 0.9.4 fails with Python 3.8 due to mujoco-mjx
run: pip install qdax brax==0.9.3
- name: Test visualize extra for QDax
run: pytest tests/visualize_qdax
- name: Install cma dep
Expand Down
8 changes: 4 additions & 4 deletions ribs/visualize/_cvt_archive_3d_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ def cvt_archive_3d_plot(
this argument instead of the data currently in the archive. This
data can be obtained by, for instance, calling
:meth:`ribs.archives.ArchiveBase.data` with ``return_type="pandas"``
and modifying the resulting :class:`ArchiveDataFrame`. Note that, at
a minimum, the data must contain columns for index, objective, and
measures. To display a custom metric, replace the "objective"
column.
and modifying the resulting
:class:`~ribs.archives.ArchiveDataFrame`. Note that, at a minimum,
the data must contain columns for index, objective, and measures. To
display a custom metric, replace the "objective" column.
measure_order (array-like of int): Specifies the axes order for plotting
the measures. By default, the first measure (measure 0) in the
archive appears on the x-axis, the second (measure 1) on y-axis, and
Expand Down
8 changes: 4 additions & 4 deletions ribs/visualize/_cvt_archive_heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ def cvt_archive_heatmap(archive,
this argument instead of the data currently in the archive. This
data can be obtained by, for instance, calling
:meth:`ribs.archives.ArchiveBase.data` with ``return_type="pandas"``
and modifying the resulting :class:`ArchiveDataFrame`. Note that, at
a minimum, the data must contain columns for index, objective, and
measures. To display a custom metric, replace the "objective"
column.
and modifying the resulting
:class:`~ribs.archives.ArchiveDataFrame`. Note that, at a minimum,
the data must contain columns for index, objective, and measures. To
display a custom metric, replace the "objective" column.
transpose_measures (bool): By default, the first measure in the archive
will appear along the x-axis, and the second will be along the
y-axis. To switch this behavior (i.e. to transpose the axes), set
Expand Down
8 changes: 4 additions & 4 deletions ribs/visualize/_grid_archive_heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ def grid_archive_heatmap(archive,
this argument instead of the data currently in the archive. This
data can be obtained by, for instance, calling
:meth:`ribs.archives.ArchiveBase.data` with ``return_type="pandas"``
and modifying the resulting :class:`ArchiveDataFrame`. Note that, at
a minimum, the data must contain columns for index, objective, and
measures. To display a custom metric, replace the "objective"
column.
and modifying the resulting
:class:`~ribs.archives.ArchiveDataFrame`. Note that, at a minimum,
the data must contain columns for index, objective, and measures. To
display a custom metric, replace the "objective" column.
transpose_measures (bool): By default, the first measure in the archive
will appear along the x-axis, and the second will be along the
y-axis. To switch this behavior (i.e. to transpose the axes), set
Expand Down
8 changes: 4 additions & 4 deletions ribs/visualize/_parallel_axes_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ def parallel_axes_plot(archive,
this argument instead of the data currently in the archive. This
data can be obtained by, for instance, calling
:meth:`ribs.archives.ArchiveBase.data` with ``return_type="pandas"``
and modifying the resulting :class:`ArchiveDataFrame`. Note that, at
a minimum, the data must contain columns for index, objective, and
measures. To display a custom metric, replace the "objective"
column.
and modifying the resulting
:class:`~ribs.archives.ArchiveDataFrame`. Note that, at a minimum,
the data must contain columns for index, objective, and measures. To
display a custom metric, replace the "objective" column.
measure_order (list of int or list of (int, str)): If this is a list
of ints, it specifies the axes order for measures (e.g. ``[2, 0,
1]``). If this is a list of tuples, each tuple takes the form
Expand Down
8 changes: 4 additions & 4 deletions ribs/visualize/_sliding_boundaries_archive_heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ def sliding_boundaries_archive_heatmap(archive,
this argument instead of the data currently in the archive. This
data can be obtained by, for instance, calling
:meth:`ribs.archives.ArchiveBase.data` with ``return_type="pandas"``
and modifying the resulting :class:`ArchiveDataFrame`. Note that, at
a minimum, the data must contain columns for index, objective, and
measures. To display a custom metric, replace the "objective"
column.
and modifying the resulting
:class:`~ribs.archives.ArchiveDataFrame`. Note that, at a minimum,
the data must contain columns for index, objective, and measures. To
display a custom metric, replace the "objective" column.
transpose_measures (bool): By default, the first measure in the archive
will appear along the x-axis, and the second will be along the
y-axis. To switch this behavior (i.e. to transpose the axes), set
Expand Down
2 changes: 1 addition & 1 deletion tutorials/mnist/train_mnist_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import sys

import torch
import torch.nn as nn
import torchvision
from torch import nn

MEAN_TRANSFORM = 0.1307
STD_DEV_TRANSFORM = 0.3081
Expand Down
9 changes: 4 additions & 5 deletions tutorials/tom_cruise_dqd.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,10 @@
" if not df_box.empty:\n",
" # Select the solution with highest objective in the box.\n",
" max_obj_idx = df_box['objective'].argmax()\n",
" sol = df_box.loc[:, \"solution_0\":].iloc[max_obj_idx]\n",
" # StyleGAN solutions have 7,168 dimensions, so the final solution col\n",
" # is solution_7167.\n",
" sol = df_box.loc[:, \"solution_0\":\"solution_7167\"].iloc[max_obj_idx]\n",
"\n",
"\n",
" # Convert the latent vector solution to an image.\n",
" img = classifier.generate_image(np.array(sol))[0].cpu().detach()\n",
Expand Down Expand Up @@ -996,11 +999,7 @@
],
"source": [
"def create_archive_tick_labels(measure_range, num_ticks):\n",
" low_pos = measure_range[0]\n",
" high_pos = measure_range[1]\n",
"\n",
" delta = (measure_range[1]-measure_range[0])/num_ticks\n",
"\n",
" ticklabels = [\n",
" round( delta*p + measure_range[0], 3)\n",
" for p in range(num_ticks+1)\n",
Expand Down

0 comments on commit 7ba4c21

Please sign in to comment.