-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
64 lines (61 loc) · 1.66 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from indomee import bootstrap_sample, bootstrap
from rich import print
# Bootstrapping a sample
result = bootstrap_sample(
preds=[["a", "b"], ["c", "d"], ["e", "f"]],
labels=[["a", "b"], ["c", "d"], ["e", "f"]],
sample_size=10,
metrics=["recall"],
k=[1, 2, 3],
)
print("Bootstrap Sample Metrics:", result.sample_metrics)
# {
# "recall@1": BootstrapMetric(
# name="recall@1",
# value=np.float64(0.5),
# ci_lower=np.float64(0.5),
# ci_upper=np.float64(0.5),
# ),
# "recall@2": BootstrapMetric(
# name="recall@2",
# value=np.float64(1.0),
# ci_lower=np.float64(1.0),
# ci_upper=np.float64(1.0),
# ),
# "recall@3": BootstrapMetric(
# name="recall@3",
# value=np.float64(1.0),
# ci_lower=np.float64(1.0),
# ci_upper=np.float64(1.0),
# ),
# }
# Bootstrapping multiple samples
result = bootstrap(
preds=[["a", "b"], ["c", "d"], ["e", "f"]],
labels=[["a", "b"], ["c", "d"], ["e", "f"]],
n_samples=10,
sample_size=2,
metrics=["recall"],
k=[1, 2, 3],
)
print("Bootstrap Metrics:", result.sample_metrics)
# {
# "recall@1": BootstrapMetric(
# name="recall@1",
# value=np.float64(0.5),
# ci_lower=np.float64(0.5),
# ci_upper=np.float64(0.5),
# ),
# "recall@2": BootstrapMetric(
# name="recall@2",
# value=np.float64(1.0),
# ci_lower=np.float64(1.0),
# ci_upper=np.float64(1.0),
# ),
# "recall@3": BootstrapMetric(
# name="recall@3",
# value=np.float64(1.0),
# ci_lower=np.float64(1.0),
# ci_upper=np.float64(1.0),
# ),
# }