Skip to main content

Experimentalist based on where the model is least certain.

Project description

AutoRA Uncertainty Experimentalist

The uncertainty experimentalist identifies experimental conditions $\vec{x}' \in X'$ with respect model uncertainty. Within the uncertainty experimentalist, 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.uncertainty import uncertainty_sample
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)

#Experimentalist
X_new = uncertainty_sample(X, lr_theorist, n, measure ="least_confident")

Project details


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

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page