Exchangeability Testing¶
Tests and monitoring tools for assessing exchangeability.
See Exchangeability Tests for conceptual background and guidance on selecting a test.
High-level Interfaces¶
mapie.exchangeability_testing.FixedDatasetExchangeabilityTest
¶
FixedDatasetExchangeabilityTest(
method_names: Union[
FixedDatasetTestMethods,
Literal["all"],
List[FixedDatasetTestMethods],
] = "all",
method_params: Optional[MethodParams] = None,
test_level: float = 0.05,
warn: bool = False,
)
Run one or several exchangeability tests on a labeled dataset.
This wrapper provides a high-level interface around the exchangeability testing methods implemented in MAPIE. It can instantiate permutation-based tests as well as online martingale tests and run them through a shared API.
| PARAMETER | DESCRIPTION |
|---|---|
method_names
|
Name of the test method to run, a list of method names, or
TYPE:
|
method_params
|
Additional keyword arguments passed to each method constructor. Keys are method names and values are dictionaries of keyword arguments.
TYPE:
|
test_level
|
Significance level passed to each underlying test.
TYPE:
|
warn
|
Whether underlying methods should raise warnings when they reject exchangeability.
TYPE:
|
Examples:
>>> import numpy as np
>>> X = np.arange(20, dtype=float).reshape(-1, 1)
>>> y = 2 * X.ravel() + np.linspace(0.0, 0.1, X.shape[0])
>>> test = FixedDatasetExchangeabilityTest(
... method_names="pvalue_permutation", warn=False
... )
>>> _ = test.run(X, y)
Source code in mapie/exchangeability_testing/exchangeability.py
is_exchangeable
property
¶
Return the current exchangeability decision for each configured method.
| RETURNS | DESCRIPTION |
|---|---|
Dict[str, Optional[bool]]
|
A dictionary mapping each method name to its current decision.
Values are typically |
run
¶
Run all configured exchangeability tests on the provided dataset.
| PARAMETER | DESCRIPTION |
|---|---|
X_test
|
Feature matrix of the labeled dataset.
TYPE:
|
y_test
|
Labels or targets associated with
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dict[str, FixedDatasetTestMethod]
|
A dictionary mapping each method name to the updated underlying test instance. |
| RAISES | DESCRIPTION |
|---|---|
AttributeError
|
If one of the configured test methods defines neither |
Source code in mapie/exchangeability_testing/exchangeability.py
mapie.exchangeability_testing.OnlineExchangeabilityTest
¶
OnlineExchangeabilityTest(
method_names: Union[
OnlineTestMethods,
Literal["all"],
List[OnlineTestMethods],
] = "all",
method_params: Optional[MethodParams] = None,
test_level: float = 0.05,
warn: bool = True,
)
Monitor exchangeability online with one or several martingale tests.
This wrapper exposes a shared interface for the online exchangeability testing methods available in MAPIE. Each configured method is updated on the same labeled stream, allowing side-by-side monitoring of different martingale constructions.
| PARAMETER | DESCRIPTION |
|---|---|
method_names
|
Name of the online method to use, a list of method names, or
TYPE:
|
method_params
|
Additional keyword arguments passed to each method constructor. Keys are method names and values are dictionaries of keyword arguments.
TYPE:
|
test_level
|
Significance level passed to each underlying online test.
TYPE:
|
warn
|
Whether underlying methods should raise warnings when they reject exchangeability.
TYPE:
|
Examples:
>>> import numpy as np
>>> X = np.arange(120, dtype=float).reshape(-1, 1)
>>> y = 2 * X.ravel() + np.linspace(0.0, 0.1, X.shape[0])
>>> online_test = OnlineExchangeabilityTest(
... method_names="plugin_martingale", warn=False
... )
>>> _ = online_test.update(X, y)
Source code in mapie/exchangeability_testing/exchangeability.py
is_exchangeable
property
¶
Return the current exchangeability decision for each online method.
| RETURNS | DESCRIPTION |
|---|---|
Dict[str, Optional[bool]]
|
A dictionary mapping each method name to its current online
decision. Values may be |
update
¶
Update all configured online tests with newly labeled observations.
| PARAMETER | DESCRIPTION |
|---|---|
X_test
|
Feature matrix for the newly observed batch.
TYPE:
|
y_test
|
Labels or targets associated with
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dict[str, OnlineMartingaleTest]
|
A dictionary mapping each method name to the updated underlying test instance. |
| RAISES | DESCRIPTION |
|---|---|
AttributeError
|
If one of the configured methods does not define |
Source code in mapie/exchangeability_testing/exchangeability.py
mapie.exchangeability_testing.RiskMonitoring
¶
RiskMonitoring(
risk: RiskLike,
test_level: float = 0.05,
tolerance: float = 0.05,
tolerance_type: Literal[
"absolute", "relative"
] = "absolute",
threshold: Optional[float] = None,
reference_data: Optional[
Tuple[NDArray, NDArray]
] = None,
warn: bool = True,
)
Monitor a risk on an online stream relative to a reference set.
The class first estimates an acceptable risk threshold on reference data and then updates a time-uniform lower confidence bound on the online risk as new observations arrive. A harmful shift is detected when the latest online lower bound exceeds the threshold.
| PARAMETER | DESCRIPTION |
|---|---|
risk
|
Risk to monitor. If a string is provided, it must be one of the keys in
TYPE:
|
test_level
|
Level used to test the hypothesis that the online risk is greater than the reference risk. The probability that the test gives a false positive is at most test_level (type I error).
TYPE:
|
tolerance
|
Margin applied to the reference upper confidence bound to define the monitoring threshold.
TYPE:
|
tolerance_type
|
Whether
TYPE:
|
threshold
|
Precomputed monitoring threshold. If provided,
TYPE:
|
reference_data
|
Optional reference labels and predictions
TYPE:
|
warn
|
Whether to emit a warning when a harmful shift is detected.
TYPE:
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
risk |
Resolved risk object used internally.
TYPE:
|
threshold |
Monitoring threshold used to flag harmful shifts.
TYPE:
|
reference_risk_upper_bound |
Upper confidence bound estimated on the reference risk, available after
TYPE:
|
online_risk_sequence_history |
Concatenated sequence of observed online risk values.
TYPE:
|
online_risk_lower_bound_sequence_history |
History of online lower confidence bounds.
TYPE:
|
online_risk_lower_bound_latest |
Latest value of the online lower confidence bound.
TYPE:
|
Examples:
>>> from sklearn.linear_model import LogisticRegression
>>> from sklearn.datasets import make_classification
>>> from sklearn.model_selection import train_test_split
>>> from mapie.exchangeability_testing import RiskMonitoring
>>> X, y = make_classification(n_samples=300, n_features=2, n_redundant=0, n_informative=2, random_state=42, class_sep=2.0)
>>> X_train, X_test, y_train, y_test = train_test_split(
... X, y, test_size=0.4, random_state=42
... )
>>> clf = LogisticRegression().fit(X_train, y_train)
>>> monitor = RiskMonitoring(risk="accuracy", warn=False)
>>> y_pred = clf.predict(X_test)
>>> _ = monitor.compute_threshold(y_test, y_pred)
>>> X_online, y_online = make_classification(n_samples=200, n_features=2, n_redundant=0, n_informative=2, random_state=42, class_sep=0.3)
>>> y_pred_online = clf.predict(X_online)
>>> _ = monitor.update(y_online, y_pred_online)
>>> print(monitor.harmful_shift_detected)
True
References
[1] Aleksandr Podkopaev and Aaditya Ramdas. Tracking the risk of a deployed model and detecting harmful distribution shifts. International Conference on Learning Representations, 2022.
Source code in mapie/exchangeability_testing/risk_monitoring.py
harmful_shift_detected
property
¶
Whether the latest online lower bound exceeds the threshold.
compute_threshold
¶
Estimate the monitoring threshold from reference predictions. Data can be the test set on which the model is evaluated before deployment.
| PARAMETER | DESCRIPTION |
|---|---|
y_true
|
Ground-truth binary labels for the reference data.
TYPE:
|
y_pred
|
Predicted binary labels for the reference data.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RiskMonitoring
|
The fitted instance. |
Source code in mapie/exchangeability_testing/risk_monitoring.py
update
¶
Update the online risk history and its lower confidence bound. Raises a warning when a harmful shift is detected.
| PARAMETER | DESCRIPTION |
|---|---|
y_true
|
Ground-truth binary labels for the newly observed online data.
TYPE:
|
y_pred
|
Predicted binary labels for the newly observed online data.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RiskMonitoring
|
The updated instance. |
Source code in mapie/exchangeability_testing/risk_monitoring.py
Individual Tests¶
mapie.exchangeability_testing.OnlineMartingaleTest
¶
OnlineMartingaleTest(
mapie_estimator: Optional[MapieEstimator] = None,
task: Optional[
Literal["classification", "regression"]
] = None,
test_method: Literal[
"jumper_martingale", "plugin_martingale"
] = "jumper_martingale",
test_level: float = 0.05,
warn: bool = True,
jump_size: float = 0.01,
burn_in: int = 100,
random_state: Optional[int_] = None,
)
Online test of exchangeability based on conformal p-values and test martingales.
OnlineMartingaleTest sequentially monitors whether newly observed labeled data remain exchangeable with respect to a reference stream, using conformity scores, conformal p-values, and a martingale-based evidence process.
At each update, the class:
- computes conformity scores from observed features and labels,
- converts these scores into conformal p-values using past scores,
- updates a martingale statistic from the p-values,
- monitors whether the observed stream provides evidence against exchangeability.
Two martingale constructions are currently supported:
"jumper_martingale": a simple and robust betting martingale based on a finite set of experts."plugin_martingale": a plug-in martingale using an estimated density of past p-values.
The null hypothesis is that the sequence of observations is exchangeable. Large martingale values provide evidence against exchangeability.
| PARAMETER | DESCRIPTION |
|---|---|
mapie_estimator
|
MAPIE estimator used to compute predictions and non-conformity
scores. Supported estimators are
TYPE:
|
task
|
Task type. If
TYPE:
|
test_method
|
Martingale construction used to aggregate evidence across p-values.
To compare both methods in parallel, instantiate two
TYPE:
|
test_level
|
Level used to test the hypothesis that the dataset is exchangeable.
The probability that the test gives a false positive is at most
TYPE:
|
warn
|
Whether to raise a warning when exchangeability is rejected. The warning is issued at most once per instance.
TYPE:
|
jump_size
|
Mixing parameter used by the jumper martingale.
Ignored when
TYPE:
|
burn_in
|
Minimum sample size required before the
TYPE:
|
random_state
|
Random seed used for random tie-breaking and density estimation.
TYPE:
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
pvalue_history |
History of conformal p-values observed so far.
TYPE:
|
conformity_score_history |
History of conformity scores observed so far.
TYPE:
|
martingale_value_history |
History of martingale values after each update.
TYPE:
|
current_martingale_value |
Current value of the martingale process.
TYPE:
|
Examples:
>>> RANDOM_STATE = 7
>>> mapie_estimator = SplitConformalRegressor(prefit=False)
>>> omt = OnlineMartingaleTest(
... mapie_estimator=mapie_estimator,
... task="regression",
... random_state=0,
... burn_in=1,
... )
>>> rng = np.random.default_rng(RANDOM_STATE)
>>> X = np.linspace(0.1, 0.9, 2400).reshape(-1, 1)
>>> y = 3.0 * X.ravel() + rng.normal(scale=0.1, size=X.shape[0])
>>> omt = omt.update(X, y)
>>> omt.is_exchangeable is True
True
Notes
The class is designed for sequential monitoring. It can be initialized on a
reference labeled dataset using update and then updated online whenever
new labels become available.
The martingale provides a valid sequential test against exchangeability when the p-values are valid under the null hypothesis.
References
.. [1] Angelopoulos, Barber, Bates (2026). "Theoretical Foundations of Conformal Prediction". arXiv preprint arXiv:2411.11824. .. [2] Vovk, Gammerman, Shafer (2005). "Algorithmic Learning in a Random World". Boston, MA: Springer US. Section 7.1, page 169. .. [3] Fedorova, Gammerman, Nouretdinov, Vovk (2012). "Plug-in Martingales for Testing Exchangeability on-line". In Proceedings of the 29th ICML. Algorithm 1, page 3.
Initialize the online martingale test.
| PARAMETER | DESCRIPTION |
|---|---|
mapie_estimator
|
MAPIE estimator used to compute predictions and non-conformity
scores. Supported estimators are
TYPE:
|
task
|
Task type. If
TYPE:
|
test_method
|
Martingale construction used to aggregate evidence from conformal p-values. "jumper_martingale" is more stable and less tuning-sensitive. "plugin_martingale" is more adaptive but sensitive to density estimation. To monitor both methods, use two instances and update both online.
TYPE:
|
test_level
|
Level used to test the hypothesis that the dataset is exchangeable.
The probability that the test gives a false positive is at most
TYPE:
|
warn
|
Whether to raise a warning when exchangeability is rejected.
TYPE:
|
jump_size
|
Mixing parameter for the jumper martingale, controlling expert diversity. Must lie in (0, 1). Ignored when test_method="plugin_martingale".
TYPE:
|
burn_in
|
Minimum number of observations required before is_exchangeable returns a non-None decision.
TYPE:
|
random_state
|
Random seed used for randomization (e.g., tie-breaking in p-value computation).
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If test_level is not in (0, 1), if test_method is not supported, or if jump_size is not in (0, 1). |
See Also
update : Update the test with new observations. is_exchangeable : Get current exchangeability decision. summary : Get diagnostic summary of the test state.
References
.. [1] Angelopoulos, Barber, Bates (2026). "Theoretical Foundations of Conformal Prediction". arXiv preprint arXiv:2411.11824. .. [2] Vovk, Gammerman, Shafer (2005). "Algorithmic Learning in a Random World". Boston, MA: Springer US. Section 7.1, page 169. .. [3] Fedorova, Gammerman, Nouretdinov, Vovk (2012). "Plug-in Martingales for Testing Exchangeability on-line". In Proceedings of the 29th ICML. Algorithm 1, page 3.
Source code in mapie/exchangeability_testing/martingales.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
reject_threshold
property
¶
Return the martingale rejection threshold.
| RETURNS | DESCRIPTION |
|---|---|
float
|
Rejection threshold equal to |
is_exchangeable
property
¶
Return the current exchangeability decision based on the martingale process.
The decision is based on the trajectory of martingale values compared to the
rejection threshold (1 / test_level). The interpretation is:
False: Exchangeability is rejected when the martingale exceeds the rejection threshold at least once.True: Failure to reject exchangeability when the martingale remains below the significance level (test_level) throughout the history.None: The test is currently inconclusive because insufficient observations have been processed (fewer thanburn_in).
| RETURNS | DESCRIPTION |
|---|---|
Optional[bool]
|
Exchangeability decision, or |
Notes
This implementation uses a persistent stopping-rule interpretation:
once the martingale has crossed the rejection threshold at any time,
the decision remains False thereafter, even if the martingale later decreases.
Therefore, True should be interpreted as "no rejection so far",
not as evidence in favor of exchangeability.
See Also
reject_threshold : The rejection threshold for the martingale.
compute_p_value
¶
Compute the conformal p-value associated with a new conformity score.
The p-value is computed using only the past conformity scores, according to the empirical conformal formula:
.. math::
p_t = \frac{1 + \#\{i : s_i > s_t\} + U \cdot \#\{i : s_i = s_t\}}{n + 1}
where \(s_t\) is the current conformity score, \(s_i\) are past scores, \(U \sim \mathrm{Uniform}(0, 1)\) is a random tie-breaker, and \(n\) is the number of past observations.
| PARAMETER | DESCRIPTION |
|---|---|
current_conformity_score
|
Conformity score of the current observation.
TYPE:
|
conformity_score_history
|
Array of past conformity scores used as reference.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
Conformal p-value in |
Notes
When no past observations are available, a uniform random p-value is returned. Tie-breaking via random uniform sampling ensures valid p-values even when conformity scores have ties.
References
.. [1] Angelopoulos, Barber, Bates (2026). "Theoretical Foundations of Conformal Prediction". arXiv preprint arXiv:2411.11824. .. [3] Fedorova, Gammerman, Nouretdinov, Vovk (2012). "Plug-in Martingales for Testing Exchangeability on-line". In Proceedings of the 29th ICML. Algorithm 1, page 3.
Source code in mapie/exchangeability_testing/martingales.py
update_simple_jumper_martingale
¶
Update the simple jumper martingale with a new p-value.
The simple jumper martingale maintains a mixture of betting experts and updates their wealth sequentially according to the incoming p-values.
| PARAMETER | DESCRIPTION |
|---|---|
pvalue
|
New conformal p-value in
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
Updated martingale value. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
Notes
This martingale is generally more stable and less tuning-sensitive than the plug-in martingale, making it a suitable default choice in practice.
References
.. [2] Vovk, Gammerman, Shafer (2005). "Algorithmic Learning in a Random World". Boston, MA: Springer US. Section 7.1, page 169.
Source code in mapie/exchangeability_testing/martingales.py
update_plugin_martingale
¶
Update the plug-in martingale with a new p-value.
The plug-in martingale multiplies the current martingale value by an estimate of the p-value density evaluated at the new p-value.
| PARAMETER | DESCRIPTION |
|---|---|
pvalue
|
New conformal p-value in
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
Updated martingale value. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
Notes
The plug-in martingale can be more adaptive than the jumper martingale, but is also more sensitive to density estimation choices and warm-up size.
References
.. [3] Fedorova, Gammerman, Nouretdinov, Vovk (2012). "Plug-in Martingales for Testing Exchangeability on-line". In Proceedings of the 29th ICML. Algorithm 1, page 3.
Source code in mapie/exchangeability_testing/martingales.py
update
¶
Update the online martingale test with newly labeled observations.
This method computes conformity scores from the provided features and labels using the MAPIE conformalizer, converts them into conformal p-values using past history, updates the selected martingale, and appends the new observations to the internal state.
| PARAMETER | DESCRIPTION |
|---|---|
X
|
Feature matrix associated with the new observations.
TYPE:
|
y
|
True labels associated with the new observations.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
OnlineMartingaleTest
|
Updated instance. |
| WARNS | DESCRIPTION |
|---|---|
UserWarning
|
If exchangeability is rejected and |
Notes
This method can be used both to initialize the test on a labeled reference set and to update it online as new labels become available.
Source code in mapie/exchangeability_testing/martingales.py
680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 | |
summary
¶
Summarize the current state of the online martingale test.
| RETURNS | DESCRIPTION |
|---|---|
dict
|
Dictionary containing the current martingale value, exchangeability decision, rejection threshold, summary statistics of the martingale trajectory, and stopping-time information. |
Notes
The returned summary is intended for diagnostics and monitoring. It does not modify the internal state of the test.
The reported stopping_time is the first index at which the martingale
exceeds the rejection threshold. If the martingale never exceeds the
threshold, stopping_time is the index of the last martingale value.
Source code in mapie/exchangeability_testing/martingales.py
768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 | |
mapie.exchangeability_testing.PValuePermutationTest
¶
PValuePermutationTest(
test_level: float = 0.05,
mapie_estimator: Optional[MapieEstimator] = None,
task: Optional[
Literal["classification", "regression"]
] = None,
random_state: Optional[int] = None,
num_permutations: int = 1000,
warn: bool = True,
)
Bases: PermutationTest
Permutation test based on p-values computed from conformity scores.
| PARAMETER | DESCRIPTION |
|---|---|
test_level
|
Level used to test the hypothesis that the dataset is exchangeable.
The probability that the test gives a false positive is at most
TYPE:
|
mapie_estimator
|
MAPIE estimator used to compute predictions and non-conformity
scores. Supported estimators are
TYPE:
|
task
|
Task type. If
TYPE:
|
random_state
|
Seed controlling the randomness of permutations.
TYPE:
|
num_permutations
|
Number of permutations used to estimate the p-value.
TYPE:
|
warn
|
Whether to raise a warning when the exchangeability test fails at the
end of
TYPE:
|
Examples:
>>> import numpy as np
>>> from mapie.exchangeability_testing.permutations import (
... PValuePermutationTest,
... )
>>> X = np.arange(100, dtype=float).reshape(-1, 1)
>>> y = 2 * X.ravel() + np.array([0.0, 0.1] * 50)
>>> test = PValuePermutationTest(
... test_level=0.2,
... )
>>> test.run(X, y).is_exchangeable
True
Source code in mapie/exchangeability_testing/permutations.py
run
¶
Run a p-value permutation test.
| PARAMETER | DESCRIPTION |
|---|---|
X
|
Feature matrix.
TYPE:
|
y
|
Target values.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PValuePermutationTest
|
Updated instance. |
Source code in mapie/exchangeability_testing/permutations.py
mapie.exchangeability_testing.PermutationTest
¶
PermutationTest(
test_level: float = 0.05,
mapie_estimator: Optional[MapieEstimator] = None,
task: Optional[
Literal["classification", "regression"]
] = None,
random_state: Optional[int] = None,
num_permutations: int = 1000,
warn: bool = True,
)
Bases: ABC
Base class for exchangeability tests based on permutations.
| PARAMETER | DESCRIPTION |
|---|---|
test_level
|
Level used to test the hypothesis that the dataset is exchangeable.
The probability that the test gives a false positive is at most
TYPE:
|
mapie_estimator
|
MAPIE estimator used to compute predictions and non-conformity
scores. Supported estimators are
TYPE:
|
random_state
|
Seed controlling the randomness of permutations.
TYPE:
|
num_permutations
|
Number of permutations used by permutation-based tests.
TYPE:
|
warn
|
Whether to raise a warning when the exchangeability test fails at the
end of
TYPE:
|
Source code in mapie/exchangeability_testing/permutations.py
mapie.exchangeability_testing.SequentialMonteCarloTest
¶
SequentialMonteCarloTest(
strategy: Literal[
"aggressive", "binomial", "binomial_mixture"
],
test_level: float = 0.05,
mapie_estimator: Optional[MapieEstimator] = None,
task: Optional[
Literal["classification", "regression"]
] = None,
random_state: Optional[int] = None,
num_permutations: int = 1000,
warn: bool = True,
burn_in: int = 100,
)
Bases: PermutationTest
Sequential Monte Carlo exchangeability test.
| PARAMETER | DESCRIPTION |
|---|---|
strategy
|
Wealth update strategy for the sequential test.
TYPE:
|
test_level
|
Level used to test the hypothesis that the dataset is exchangeable.
The probability that the test gives a false positive is at most
TYPE:
|
mapie_estimator
|
MAPIE estimator used to compute predictions and non-conformity
scores. Supported estimators are
TYPE:
|
task
|
Task type. If
TYPE:
|
random_state
|
Seed controlling the randomness of permutations.
TYPE:
|
num_permutations
|
Maximum number of permutations.
TYPE:
|
warn
|
Whether to raise a warning when the exchangeability test fails at the
end of
TYPE:
|
burn_in
|
Minimum number of permutations before considering early stopping.
TYPE:
|
Source code in mapie/exchangeability_testing/permutations.py
run
¶
Run a sequential Monte Carlo permutation test.
| PARAMETER | DESCRIPTION |
|---|---|
X
|
Feature matrix.
TYPE:
|
y
|
Target values.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SequentialMonteCarloTest
|
Updated instance. |