Skip to content

Commit

Permalink
docs: expand outputs docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
mortonne committed Feb 22, 2022
1 parent a6e01a5 commit 3b80cae
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/psifr/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ def outputs_masker(
output : int
Current output position.
Examples
--------
>>> from psifr import outputs
>>> pool_items = [1, 2, 3, 4]
>>> recall_items = [4, 2, 3, 1]
>>> masker = outputs.outputs_masker(
... pool_items, recall_items, pool_items, recall_items
... )
>>> for curr, poss, output in masker:
... print(curr, poss, output)
4 [1 2 3 4] 1
2 [1 2 3] 2
3 [1 3] 3
1 [1] 4
"""
pool_items = pool_items.copy()
pool_output = pool_output.copy()
Expand Down Expand Up @@ -139,6 +154,33 @@ def count_outputs(
count_unique : bool
If true, possible recalls with the same label will only be
counted once.
Returns
-------
actual : numpy.ndarray
[outputs x inputs] array of actual recall counts.
possible : numpy.ndarray
[outputs x inputs] array of possible recall counts.
Examples
--------
>>> from psifr import outputs
>>> pool_items = [[1, 2, 3, 4]]
>>> recall_items = [[4, 2, 3, 1]]
>>> actual, possible = outputs.count_outputs(
... 4, pool_items, recall_items, pool_items, recall_items
... )
>>> actual
array([[0, 0, 0, 1],
[0, 1, 0, 0],
[0, 0, 1, 0],
[1, 0, 0, 0]])
>>> possible
array([[1, 1, 1, 1],
[1, 1, 1, 0],
[1, 0, 1, 0],
[1, 0, 0, 0]])
"""
if pool_label is None:
pool_label = pool_items
Expand Down

0 comments on commit 3b80cae

Please sign in to comment.