Method
__init__
(
self,
task_indices: Union[Tuple[int, int], int, np.ndarray],
index_dim: int,
variance=1.0,
name="task_domain",
)
Source from the content-addressed store, hash-verified
| 150 | """A kernel that is one iff the X-task corresponds to one of the `task_indices`.""" |
| 151 | |
| 152 | def __init__( |
| 153 | self, |
| 154 | task_indices: Union[Tuple[int, int], int, np.ndarray], |
| 155 | index_dim: int, |
| 156 | variance=1.0, |
| 157 | name="task_domain", |
| 158 | ): |
| 159 | super().__init__( |
| 160 | input_dim=1, |
| 161 | variance=variance, |
| 162 | active_dims=(index_dim,), |
| 163 | ARD=False, |
| 164 | name=name, |
| 165 | ) |
| 166 | self.task_indices = np.atleast_2d(np.asarray(task_indices, dtype=int)) |
| 167 | assert self.task_indices.size >= 1, "Need at least one task." |
| 168 | |
| 169 | def _phi(self, X: np.ndarray) -> np.ndarray: |
| 170 | # atol maps our floats to tasks |
Callers
nothing calls this directly
Tested by
no test coverage detected