{ "cells": [ { "cell_type": "markdown", "id": "0cedfd8f", "metadata": {}, "source": [ "Overview of the different settings possible\n", "===========================================\n", "\n", "1) Choosing `type_tree`\n", "\t- 'PMQRT' : train quantile regression trees (multi-quantile support). Use when you want direct quantile estimates.\n", "\t- 'RT' : standard regression tree with squared-error splitting (uses `RegressionTreeQuadratic`).\n", "\t- 'CRPS' : specialized tree optimized for CRPS (Continuous Ranked Probability Score) available in `CRPSRT/RegressionTree.py`.\n", "\n", "\n", "2) Choosing `type_conformal`\n", " - 'None' : in case you don't plan to use conformal prediction methods\n", " - 'split' : if you want to use split conformal prediction\n", "\n", "2) Conformalization `nested_set` options\n", "\t- 'CQR' / 'CQR-m' / 'CQR-r' : variants of Conformalized Quantile Regression implemented in `Conformalisation_CQR.py`. They require you pass `nominal_quantiles` to `conformalize` (see example below).\n", "\t- 'distributional' : distributional conformalization implemented in `Conformalisation_distributional.py`. It uses a list of nested low quantiles (param `list_distri_low_quantiles`) and supports group coverage.\n", "\n", "3) Group coverage\n", "\t- Set `group_coverage=True` when instantiating `UQ` to enable group-aware conformalization.\n", "\n", "4) Choose aggregation type\n", " - 'vr' : corresponds to quantile bagging: simple average of quantile obtained from single trees in the forest\n", " - 'vr-avg' : corresponds to distributional bagging: aggregates conditional CDF from all trees before querying the desired quantile\n", "\n", "4) Parameters:\n", " - 'nTrees' : number of trees to train\n", " - 'treeID2quantiles_train' : dict mapping tree IDs to quantiles to train for (used in PMQRT)\n", " - 'max_depth' : maximum depth passed to tree constructors\n", " - 'min_samples_split' : minimum samples to split passed to tree constructors\n", " - 'IG_biais_correction' : whether tree fit uses leave-one-out or Mallows correction of information gains\n", " - 'max_depth_group' : maximum depth for group coverage trees\n", " - 'list_distri_low_quantiles': list of lower quantiles for distributional conformal prediction\n", "\n", "5) Main methods:\n", " - Use `uq.train_trees(X_train, y_train)` to train a forest\n", "\n", " a) Query quantiles \n", "\t - Use `uq.get_quantile_estimate(trees, X_test, quantiles)` to query raw quantiles aggregated across trees.\n", " - Use `uq.compute_width_coverage(sample2predset, y_test)` to compute width and coverage if `sample2predset` contains confidence intervals for each test sample.\n", " \n", " b) Conformal prediction\n", "\t - Use `uq.conformalize(trees, X_calib, y_calib, alpha, nominal_quantiles=[2*alpha])` to conformalize the your forest. Note that `nominal_quantiles` is only needed if you trained PMQRTs.\n", " - Use `uq.predict_conformal_set(trees, X_test)` to predict the conformal sets on the test samples.\n", " - Use `uq.compute_width_coverage(sample2predset, y_test)` to get the width and coverage of your predictions if `sample2predset` contains the conformalized sets. Note that if you used PMQRTs, `sample2predset` actually contains different conformal sets based on the different nominal_quantiles you considered when conformalizing the method. In our example, you specify a single nominal quantile and those we would get access to the conformal sets on the test set using `sample2predset|0]`. Therefore, one should use `uq.compute_width_coverage(sample2predset[0], y_test)`. \n", "\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" } }, "nbformat": 4, "nbformat_minor": 5 }