You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: dev/quick_tour/notebook.jl
+118-76
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,14 @@ using InteractiveUtils
7
7
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
8
8
macrobind(def, element)
9
9
quote
10
-
local iv =try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b ->missing; end
println("Coverage per fold: $(round.(model_evaluation.per_fold[1], digits=3))")
231
260
end
232
261
233
262
# ╔═╡ f742440b-258e-488a-9c8b-c9267cf1fb99
234
263
begin
235
-
ncal =Int(conf_model.train_ratio * data_specs.N)
236
-
Markdown.parse("""
237
-
The empirical coverage rate should be close to the desired level of coverage. In most cases it will be slightly higher, since ``(1-\\alpha)`` is a lower bound.
238
-
239
-
> Found an empirical coverage rate that is slightly lower than desired? The coverage property is "marginal" in the sense that the probability averaged over the randomness in the data. For most purposes a large enough calibration set size (``n>1000``) mitigates that randomness enough. Depending on your choices above, the calibration set may be quite small (currently $ncal), which can lead to **coverage slack** (see Section 3 in the [tutorial](https://arxiv.org/pdf/2107.07511.pdf)).
240
-
241
-
### *So what's happening under the hood?*
242
-
243
-
Inductive Conformal Prediction (also referred to as Split Conformal Prediction) broadly speaking works as follows:
244
-
245
-
1. Partition the training into a proper training set and a separate calibration set
246
-
2. Train the machine learning model on the proper training set.
247
-
3. Using some heuristic notion of uncertainty (e.g. absolute error in the regression case) compute nonconformity scores using the calibration data and the fitted model.
248
-
4. For the given coverage ratio compute the corresponding quantile of the empirical distribution of nonconformity scores.
249
-
5. For the given quantile and test sample ``X_{\\text{test}}``, form the corresponding conformal prediction set like so: ``C(X_{\\text{test}})=\\{y:s(X_{\\text{test}},y) \\le \\hat{q}\\}``
250
-
""")
264
+
ncal =Int(conf_model.train_ratio * data_specs.N)
265
+
Markdown.parse(
266
+
"""
267
+
The empirical coverage rate should be close to the desired level of coverage. In most cases it will be slightly higher, since ``(1-\\alpha)`` is a lower bound.
268
+
269
+
> Found an empirical coverage rate that is slightly lower than desired? The coverage property is "marginal" in the sense that the probability averaged over the randomness in the data. For most purposes a large enough calibration set size (``n>1000``) mitigates that randomness enough. Depending on your choices above, the calibration set may be quite small (currently $ncal), which can lead to **coverage slack** (see Section 3 in the [tutorial](https://arxiv.org/pdf/2107.07511.pdf)).
270
+
271
+
### *So what's happening under the hood?*
272
+
273
+
Inductive Conformal Prediction (also referred to as Split Conformal Prediction) broadly speaking works as follows:
274
+
275
+
1. Partition the training into a proper training set and a separate calibration set
276
+
2. Train the machine learning model on the proper training set.
277
+
3. Using some heuristic notion of uncertainty (e.g. absolute error in the regression case) compute nonconformity scores using the calibration data and the fitted model.
278
+
4. For the given coverage ratio compute the corresponding quantile of the empirical distribution of nonconformity scores.
279
+
5. For the given quantile and test sample ``X_{\\text{test}}``, form the corresponding conformal prediction set like so: ``C(X_{\\text{test}})=\\{y:s(X_{\\text{test}},y) \\le \\hat{q}\\}``
280
+
""",
281
+
)
251
282
end
252
283
253
284
# ╔═╡ 74444c01-1a0a-47a7-9b14-749946614f07
@@ -267,14 +298,25 @@ Quite cool, right? Using a single API call we are able to generate rigorous pred
0 commit comments