(self, X)
| 268 | for column in columns) |
| 269 | |
| 270 | def predict(self, X): |
| 271 | if(hasattr(self.pipelines[0], 'decision_function') and |
| 272 | is_classifier(self.pipelines[0])): |
| 273 | thresh = 0 |
| 274 | else: |
| 275 | thresh = 0.5 |
| 276 | |
| 277 | n_samples = X['count'].shape[0] |
| 278 | if self.label_binarizer.y_type_ == 'multiclass': |
| 279 | maxima = np.empty(n_samples, dtype=float) |
| 280 | maxima.fill(-np.inf) |
| 281 | argmaxima = np.zeros(n_samples, dtype=int) |
| 282 | for i, p in enumerate(self.pipelines): |
| 283 | pred = _predict_binary(p, X) |
| 284 | np.maximum(maxima, pred, out=maxima) |
| 285 | argmaxima[maxima == pred] = i |
| 286 | return self.classes[np.array(argmaxima.T)] |
| 287 | else: |
| 288 | indices = array.array('i') |
| 289 | indptr = array.array('i', [0]) |
| 290 | for p in self.pipelines: |
| 291 | indices.extend(np.where(_predict_binary(p, X) > thresh)[0]) |
| 292 | indptr.append(len(indices)) |
| 293 | data = np.ones(len(indices), dtype=int) |
| 294 | indicator = csc_matrix((data, indices, indptr), |
| 295 | shape=(n_samples, len(self.pipelines))) |
| 296 | return self.label_binarizer.inverse_transform(indicator) |
| 297 | |
| 298 | class Classifier(): |
| 299 |
no test coverage detected