Basic Usage¶
The inequality experimentalist selects $n$ experimental conditions from a pool of candidate experimental conditions $X'$. The choice is informed based on the similarity of the candidate conditions $X'$ with respect to previously examined experiment conditions $X$. We begin with importing the relevant packages.
# Uncomment the following line when running on Google Colab
# !pip install "autora[experimentalist-inequality]"
from autora.experimentalist.inequality import summed_inequality_sample
import numpy as np
Next, we define the existing experimental conditons $X$.
X = np.array([1, 2, 3])
We define the candidate experimental conditons $X'$ from which we seek to sample.
X_prime = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
Next, we need to specify how many samples we would like to collect. In this case, we pick $n=2$.
n = 2
Finally, we can call the inequality experimentalist. Note that $X'$ is the first argument to the experimentalist, followed by the "reference" conditions $X$, and the number of samples.
X_sampled = summed_inequality_sample(conditions=X_prime, reference_conditions=X, num_samples=n)
print(X_sampled)
The inequality experimentalist also works for experiments with multiple independent variables. In the following example, we define $X$ as a single experimental condition composed of three independent factors. We choose from a pool $X'$ composed of four experimental conditions.
X = np.array([[1, 2, 3]])
X_prime = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]])
Next, we sample a single experimental condition from the pool $X'$ which yields the greatest summed Euclidean distance to the existing condition in $X$.
X_sampled = summed_inequality_sample(conditions=X_prime, reference_conditions=X, num_samples=n)
print(X_sampled)