Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Update generator function documentation #398

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion aepsych/generators/acqf_thompson_sampler_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def gen(self, num_points: int, model: ModelProtocol, **gen_options) -> torch.Ten
num_points (int, optional): Number of points to query.
model (ModelProtocol): Fitted model of the data.
Returns:
np.ndarray: Next set of point(s) to evaluate, [num_points x dim].
torch.Tensor: Next set of point(s) to evaluate, with shape [num_points, dim]
or shape [num_points, dim, 2] if pairing is applied.
"""

if self.stimuli_per_trial == 2:
Expand Down
2 changes: 1 addition & 1 deletion aepsych/generators/manual_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def gen(
Args:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add type hint for return

num_points (int): Number of points to query.
Returns:
np.ndarray: Next set of point(s) to evaluate, [num_points x dim].
torch.Tensor: Next set of point(s) to evaluate, with shape [num_points, dim].
"""
if num_points > (len(self.points) - self._idx):
warnings.warn(
Expand Down
2 changes: 1 addition & 1 deletion aepsych/generators/monotonic_rejection_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def gen(
num_points (int, optional): Number of points to query.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add type hint for return

model (AEPsychMixin): Fitted model of the data.
Returns:
np.ndarray: Next set of point(s) to evaluate, [num_points x dim].
torch.Tensor: Next set of point(s) to evaluate, with shape [num_points, dim].
"""

options = self.model_gen_options or {}
Expand Down
2 changes: 1 addition & 1 deletion aepsych/generators/monotonic_thompson_sampler_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def gen(
num_points (int, optional): Number of points to query.
model (AEPsychMixin): Fitted model of the data.
Returns:
np.ndarray: Next set of point(s) to evaluate, [num_points x dim].
torch.Tensor: The next set of point(s) to evaluate, with shape [num_points, dim].
"""

# Generate the points at which to sample
Expand Down
3 changes: 2 additions & 1 deletion aepsych/generators/optimize_acqf_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ def gen(self, num_points: int, model: ModelProtocol, **gen_options) -> torch.Ten
num_points (int, optional): Number of points to query.
model (ModelProtocol): Fitted model of the data.
Returns:
np.ndarray: Next set of point(s) to evaluate, [num_points x dim].
torch.Tensor: Next set of point(s) to evaluate, with shape [num_points, dim]
or shape [num_points, dim, 2] if pairing is applied.
"""

if self.stimuli_per_trial == 2:
Expand Down
2 changes: 1 addition & 1 deletion aepsych/generators/random_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def gen(
Args:
num_points (int, optional): Number of points to query. Currently, only 1 point can be queried at a time.
Returns:
np.ndarray: Next set of point(s) to evaluate, [num_points x dim].
torch.Tensor: Next set of point(s) to evaluate, with shape [num_points, dim].
"""
X = self.bounds_[0] + torch.rand((num_points, self.bounds_.shape[1])) * (
self.bounds_[1] - self.bounds_[0]
Expand Down
3 changes: 2 additions & 1 deletion aepsych/generators/sobol_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def gen(
Args:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add type hint

num_points (int, optional): Number of points to query.
Returns:
np.ndarray: Next set of point(s) to evaluate, [num_points x dim].
torch.Tensor: Next set of point(s) to evaluate, with shape [num_points, dim]
or shape [num_points, dim , stimuli_per_trial] if `stimuli_per_trial` is greater than 1.
"""
grid = self.engine.draw(num_points)
grid = self.lb + (self.ub - self.lb) * grid
Expand Down
Loading