You can use BaggingClassifier :
bag = BaggingClassifier(base_estimator=your_estimator, n_estimators=100, max_samples=1.0, bootstrap=True, n_jobs=-1) bag.fit(X, y) recalls = [] for estimator, samples in zip(bag.estimators_, bag.estimators_samples_): # compute predictions on out-of-bag samples mask = ~samples y_pred = estimator.predict(X[mask]) # compute some statistic recalls.append(recall(y[mask], y_pred)) # Do something with stats, eg find confidence interval print(np.percentile(recalls, [2.5, 97.5]))
Daverz
source share