(self, *, y)
| 204 | self.R_func = sum |
| 205 | |
| 206 | def _validate_params(self, *, y): |
| 207 | _validate_type(self.n_components, int, "n_components") |
| 208 | if hasattr(self, "cov_est"): |
| 209 | _validate_type(self.cov_est, str, "cov_est") |
| 210 | _check_option("cov_est", self.cov_est, ("concat", "epoch")) |
| 211 | if hasattr(self, "norm_trace"): |
| 212 | _validate_type(self.norm_trace, bool, "norm_trace") |
| 213 | _check_option( |
| 214 | "transform_into", self.transform_into, ["average_power", "csp_space"] |
| 215 | ) |
| 216 | if self.transform_into == "average_power": |
| 217 | _validate_type( |
| 218 | self.log, |
| 219 | (bool, None), |
| 220 | "log", |
| 221 | extra="when transform_into is 'average_power'", |
| 222 | ) |
| 223 | else: |
| 224 | _validate_type( |
| 225 | self.log, None, "log", extra="when transform_into is 'csp_space'" |
| 226 | ) |
| 227 | _check_option( |
| 228 | "component_order", self.component_order, ("mutual_info", "alternate") |
| 229 | ) |
| 230 | self.classes_ = np.unique(y) |
| 231 | n_classes = len(self.classes_) |
| 232 | if n_classes < 2: |
| 233 | raise ValueError( |
| 234 | "y should be a 1d array with more than two classes, " |
| 235 | f"but got {n_classes} class from {y}" |
| 236 | ) |
| 237 | elif n_classes > 2 and self.component_order == "alternate": |
| 238 | raise ValueError( |
| 239 | "component_order='alternate' requires two classes, but data contains " |
| 240 | f"{n_classes} classes; use component_order='mutual_info' instead." |
| 241 | ) |
| 242 | _validate_type(self.rank, (dict, None, str), "rank") |
| 243 | _validate_type(self.info, (Info, None), "info") |
| 244 | _validate_type(self.cov_method_params, (abc.Mapping, None), "cov_method_params") |
| 245 | |
| 246 | def fit(self, X, y): |
| 247 | """Estimate the CSP decomposition on epochs. |
no test coverage detected