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

Forbidden Relations of Disabled Hyperparameters #397

Merged
Merged
Changes from 1 commit
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
15 changes: 12 additions & 3 deletions src/ConfigSpace/forbidden.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,10 @@ def is_forbidden_vector(self, vector: Array[f64]) -> bool:
def is_forbidden_vector_array(self, arr: Array[f64]) -> Mask:
left = arr[self.vector_ids[0]]
right = arr[self.vector_ids[1]]
return self.left.to_value(left) < self.right.to_value(right)
mask = ~(np.isnan(left) | np.isnan(right))
out = np.zeros_like(mask)
out[mask] = self.left.to_value(left[mask]) < self.right.to_value(right[mask])
return out


class ForbiddenEqualsRelation(ForbiddenRelation):
Expand Down Expand Up @@ -686,7 +689,10 @@ def is_forbidden_vector(self, vector: Array[f64]) -> bool:
def is_forbidden_vector_array(self, arr: Array[f64]) -> Mask:
left = arr[self.vector_ids[0]]
right = arr[self.vector_ids[1]]
return self.left.to_value(left) == self.right.to_value(right) # type: ignore
mask = ~(np.isnan(left) | np.isnan(right))
out = np.zeros_like(mask)
out[mask] = self.left.to_value(left[mask]) == self.right.to_value(right[mask])
return out # type: ignore


class ForbiddenGreaterThanRelation(ForbiddenRelation):
Expand Down Expand Up @@ -751,7 +757,10 @@ def is_forbidden_vector(self, vector: Array[f64]) -> bool:
def is_forbidden_vector_array(self, arr: Array[f64]) -> Mask:
left = arr[self.vector_ids[0]]
right = arr[self.vector_ids[1]]
return self.left.to_value(left) > self.right.to_value(right)
mask = ~(np.isnan(left) | np.isnan(right))
out = np.zeros_like(mask)
out[mask] = self.left.to_value(left[mask]) > self.right.to_value(right[mask])
return out


ForbiddenLike = Union[
Expand Down
Loading