Sampler based on where the model is least certain.
Project description
AutoRA Uncertainty Sampler
The uncertainty sampler identifies experimental conditions $\vec{x}' \in X'$ with respect model uncertainty. Within the uncertainty sampler, there are three methods to determine uncertainty:
Least Confident
$$ x^* = \text{argmax} \left( 1-P(\hat{y}|x) \right), $$
where $\hat{y} = \text{argmax} P(y_i|x)$
Margin
$$ x^* = \text{argmax} \left( P(\hat{y}_1|x) - P(\hat{y}_2|x) \right), $$
where $\hat{y}_1$ and $\hat{y}_2$ are the first and second most probable class labels under the model, respectively.
Entropy
$$ x^* = \text{argmax} \left( - \sum P(y_i|x)\text{log} P(y_i|x) \right) $$
Example Code
from autora.experimentalist.sampler.uncertainty import uncertainty_sampler
from sklearn.linear_model import LogisticRegression
import numpy as np
#Meta-Setup
X = np.linspace(start=-3, stop=6, num=10).reshape(-1, 1)
y = (X**2).reshape(-1)
n = 5
#Theorists
lr_theorist = LogisticRegression()
lr_theorist.fit(X,y)
#Sampler
X_new = uncertainty_sampler(X, lr_theorist, n, measure ="least_confident")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for autora-experimentalist-sampler-uncertainty-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a9feaca11b991c7340c98d2d14da2c7f7f199ef097f087bb5d102e60c0a9b25 |
|
MD5 | a671614688d64d870901f917cae8e460 |
|
BLAKE2b-256 | f75b6afebb9ce36b20274806d5c0c32ed35a3791cde526696639441472e47f38 |
Close
Hashes for autora_experimentalist_sampler_uncertainty-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2f0b86b517c6ee045ac9538fa0a85a2c16472b2f33c6e1c466ec61df3ad18b6 |
|
MD5 | 607cfe15c0082c338f349040feb1fbb8 |
|
BLAKE2b-256 | c3b3bb8ccd22b05b3824b8a79c9b5e2604b0dd509c3a5857cc64052b1b4a2fc7 |