Metadata-Version: 2.1
Name: autora-experimentalist-uncertainty
Version: 2.0.0
Summary: Experimentalist based on where the model is least certain.
Author-email: "Built by Sebastian Musslick, restructured by Chad Williams" <sebastian_musslick@brown.edu>
License: MIT License
        
        Copyright (c) 2023 Autonomous Empirical Research Initiative
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: homepage, http://www.empiricalresearch.ai
Project-URL: repository, https://github.com/AutoResearch/autora-experimentalist-uncertainty
Project-URL: documentation, https://autoresearch.github.io/autora/
Requires-Python: <4,>=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: autora-core >=3.1.0
Requires-Dist: scikit-learn
Provides-Extra: dev
Requires-Dist: autora-core[dev] ; extra == 'dev'

# 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")
```
