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
File details
Details for the file autora-experimentalist-sampler-uncertainty-1.0.1.tar.gz
.
File metadata
- Download URL: autora-experimentalist-sampler-uncertainty-1.0.1.tar.gz
- Upload date:
- Size: 46.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee4499aa6233713eb4b93b013ff4e747ca730307701e55f09434053cca2fde0a |
|
MD5 | 4cd61ca48f72b9cf24297eff3f471758 |
|
BLAKE2b-256 | c86fbcff9a07338769f3b0519846b61a3045880e19b9ad30d841c3f33178ccc7 |
File details
Details for the file autora_experimentalist_sampler_uncertainty-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: autora_experimentalist_sampler_uncertainty-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 589ff600ab2b6f1fcb0eea127bbc10c33d3b829aa746b03dd8329fd5e49dd165 |
|
MD5 | 73ea08b22dda48831adb245d9a0990e1 |
|
BLAKE2b-256 | b9be913664adc4979da575b1b3de630d08982edee2eb64342320d6e73f6298a4 |