Metadata-Version: 2.1
Name: autora-experimentalist-novelty
Version: 2.0.1
Summary: AutoRA Novelty Experimentalist
Author-email: Sebastian Musslick <sebastian@musslick.de>
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-novelty
Project-URL: documentation, https://autoresearch.github.io/autora/
Requires-Python: <4,>=3.8.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: autora-core >=3.1.0
Provides-Extra: dev
Requires-Dist: autora-core[dev] ; extra == 'dev'

# AutoRA Novelty Experimentalist

The novelty experimentalist identifies experimental conditions $\vec{x}' \in X'$ with respect to
a pairwise distance metric applied to existing experimental conditions $\vec{x} \in X$:

$$
\underset{\vec{x}'}{\arg\max}~f(d(\vec{x}, \vec{x}'))
$$

where $f$ is an integration function applied to all pairwise  distances.

## Example

For instance,
the integration function $f(x)=\min(x)$ and distance function $d(x, x')=|x-x'|$ identifies
condition $\vec{x}'$ with the greatest minimal Euclidean distance to all
existing conditions in $\vec{x} \in X$.

$$
\underset{\vec{x}}{\arg\max}~\min_i(\sum_{j=1}^n(x_{i,j} - x_{i,j}')^2)
$$

To illustrate this sampling strategy, consider the following four experimental conditions that
were already probed:


| $x_{i,0}$ | $x_{i,1}$ | $x_{i,2}$ |
|-----------|-----------|-----------|
| 0         | 0         | 0         |
| 1         | 0         | 0         |
| 0         | 1         | 0         |
| 0         | 0         | 1         |

Fruthermore, let's consider the following three candidate conditions $X'$:

| $x_{i,0}'$ | $x_{i,1}'$ | $x_{i,2}'$ |
|------------|------------|------------|
| 1          | 1          | 1          |
| 2          | 2          | 2          |
| 3          | 3          | 3          |


If the novelty experimentalist is tasked to identify two novel conditions, it will select
the last two candidate conditions $x'_{1,j}$ and $x'_{2,j}$ because they have the greatest
minimal distance to all existing conditions $x_{i,j}$:

### Example Code
```python
import numpy as np
from autora.experimentalist.novelty import novelty_sampler, novelty_score_sampler

# Specify X and X'
X = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]])
X_prime = np.array([[1, 1, 1], [2, 2, 2], [3, 3, 3]])

# Here, we choose to identify two novel conditions
n = 2
X_sampled = novelty_sampler(conditions=X_prime, reference_conditions=X, num_samples=n)

# We may also obtain samples along with their z-scored novelty scores
(X_sampled, scores) = novelty_score_sampler(conditions=X_prime, reference_conditions=X, num_samples=n)
```




