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^* = \operatorname{argmax} \left( 1-P(\hat{y}|x) \right), $$
where $\hat{y} = \operatorname{argmax} P(y_i|x)$
Margin
$$ x^* = \operatorname{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^* = \operatorname{argmax} \left( - \sum P(y_i|x)\operatorname{log} P(y_i|x) \right) $$
Example Code
from autora.experimentalist.sampler.uncertainty_sampler 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
Hashes for autora-experimentalist-sampler-uncertainty-1.0.0b1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 093d16a15ea65fe147a0153627cf57a5e102ebc497949614321792bcec01c2a9 |
|
MD5 | 8b6ae749ed79fb7896ee517dd679cdf6 |
|
BLAKE2b-256 | e2adf0f1d8f32edeaee46d50f63c4628ea8c62642598a12915d75f2f19e27ae5 |
Hashes for autora_experimentalist_sampler_uncertainty-1.0.0b1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e082aa48d3a11467727d408308e064e1f64b38345269909ed4850e1df4c7edd6 |
|
MD5 | 9542f25df251b07f6c0d899165ed919e |
|
BLAKE2b-256 | 71177114e66b698a36deb1ac9416bd0d169cc21ff90a361e706de05524c896a0 |