Skip to content
Back to skills

Bootstrapper

ASecurity

Compute the BootStrapper metric — provided by torchmetrics. Use when the user has predictions and ground-truth and needs to compute BootStrapper, or asks how to score with BootStrapper.

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 11, 2026
documentationpython

Security analysis

A100/100

Scanned September 11, 2026

npx -y skills add qhjqhj00/research-skills-pool --skill bootstrapper --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Bootstrapper?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Bootstrapper
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/qhjqhj00-bootstrapper/badge)](https://www.skillsdirectory.com/skills/qhjqhj00-bootstrapper)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: bootstrapper
description: Compute the BootStrapper metric — provided by torchmetrics. Use when the user has predictions and ground-truth and needs to compute BootStrapper, or asks how to score with BootStrapper.
metadata:
  skill_kind: metric
  source_lib: torchmetrics
  import_path: torchmetrics.BootStrapper
  source: library_introspection
---

# bootstrapper

> Metric `BootStrapper` from `torchmetrics` (torchmetrics.BootStrapper)

## When to invoke this skill

The user has predictions + ground truth and asks to evaluate with BootStrapper, or
mentions `torchmetrics.BootStrapper` directly, or wants the standard torchmetrics implementation.

## Reference signature

```python
from torchmetrics import BootStrapper

# BootStrapper(base_metric: torchmetrics.metric.Metric, num_bootstraps: int = 10, mean: bool = True, std: bool = True, quantile: Union[float, torch.Tensor, NoneType] = None, raw: bool = False, sampling_strategy: str = 'poisson', **kwargs: Any) -> None
```

## Library docstring

```
Using `Turn a Metric into a Bootstrapped`_.

That can automate the process of getting confidence intervals for metric values. This wrapper
class basically keeps multiple copies of the same base metric in memory and whenever ``update`` or
``forward`` is called, all input tensors are resampled (with replacement) along the first dimension.

Args:
    base_metric: base metric class to wrap
    num_bootstraps: number of copies to make of the base metric for bootstrapping
    mean: if ``True`` return the mean of the bootstraps
    std: if ``True`` return the standard deviation of the bootstraps
    quantile: if given, returns the quantile of the bootstraps. Can only be used with pytorch version 1.6 or higher
    raw: if ``True``, return all bootstrapped values
    sampling_strategy:
        Determines how to produce bootstrapped samplings. Either ``'poisson'`` or ``multinomial``.
        If ``'possion'`` is chosen, the number of times each sample will be included in the bootstrap
        will be given by :math:`n\sim Poisson(\lambda=1)`, which approximates the true bootstrap distribution
        when the number of samples is large. If ``'multinomial'`` is chosen, we will apply true bootstrapping
        at the batch level to approximate bootstrapping over the hole dataset.
    kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.

Example::
    >>> from pprint import pprint
    >>> from torch import randint
    >>> from torchmetrics.wrappers import BootStrapper
    >>> from torchmetrics.classification import MulticlassAccuracy
    >>> base_metric = MulticlassAccuracy(num_classes=5, average='micro')
    >>> bootstrap = BootStrapper(base_metric, num_bootstraps=20)
    >>> bootstrap.update(randint(5, (20,)), randint(5, (20,)))
    >>> output = bootstrap.compute()
    >>> pprint(output)
    {'mean': tensor(0.2089), 'std': tensor(0.0772)}
```

## Quick recipe

```python
import torchmetrics as _m
score = _m.BootStrapper(y_true, y_pred)
```

## Don'ts

- Don't reimplement when the library version handles edge cases (NaN, ties, empty inputs) better than a hand-rolled formula.
- Always check the library version's argument order — sklearn is `(y_true, y_pred)` while torchmetrics is `(preds, target)`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.