diff --git a/README.md b/README.md index 12febcd..deb2987 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# AutoRA Uncertainty Sampler +# AutoRA Uncertainty Experimentalist -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: +The uncertainty experimentalist identifies experimental conditions $\vec{x}' \in X'$ with respect model uncertainty. Within the uncertainty sampler, there are three methods to determine uncertainty: ## Least Confident $$ @@ -25,7 +25,7 @@ $$ # Example Code ``` -from autora.experimentalist.sampler.uncertainty import uncertainty_sample +from autora.experimentalist.uncertainty import uncertainty_sample from sklearn.linear_model import LogisticRegression import numpy as np diff --git a/docs/Basic Usage.ipynb b/docs/Basic Usage.ipynb index 2ad3a3e..c7709bf 100644 --- a/docs/Basic Usage.ipynb +++ b/docs/Basic Usage.ipynb @@ -15,7 +15,7 @@ "outputs": [], "source": [ "# Uncomment the following line when running on Google Colab\n", - "# !pip install \"autora[experimentalist-sampler-uncertainty]\"" + "# !pip install \"autora[experimentalist-uncertainty]\"" ] }, { @@ -27,7 +27,7 @@ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from sklearn.linear_model import LogisticRegression\n", - "from autora.experimentalist.sampler.uncertainty import uncertainty_sample" + "from autora.experimentalist.uncertainty import uncertainty_sample" ] }, { diff --git a/docs/index.md b/docs/index.md index 96f68a6..09528a5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,4 +1,4 @@ -# Uncertainty Sampler +# Uncertainty Experimentalist 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: @@ -25,7 +25,7 @@ $$ # Example Code ``` -from autora.experimentalist.sampler.uncertainty import uncertainty_sample +from autora.experimentalist.uncertainty import uncertainty_sample from sklearn.linear_model import LogisticRegression import numpy as np diff --git a/docs/quickstart.md b/docs/quickstart.md index 017a93c..87c71b7 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -7,11 +7,11 @@ You will need: *Uncertainty-Sampler is a part of the `autora` package: ```shell -pip install -U autora["experimentalist-sampler-uncertainty"] +pip install -U autora["experimentalist-uncertainty"] ``` Check your installation by running: ```shell -python -c "from autora.experimentalist.sampler.uncertainty import uncertainty_sample" +python -c "from autora.experimentalist.uncertainty import uncertainty_sample" ``` diff --git a/mkdocs.yml b/mkdocs.yml index 400c157..a394d33 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,8 +1,8 @@ # yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json INHERIT: mkdocs/base.yml # use the shared AutoRA configuration by default -site_name: AutoRA Uncertainty Sampler -repo_url: 'https://github.com/AutoResearch/autora-experimentalist-sampler-uncertainty' +site_name: AutoRA Uncertainty +repo_url: 'https://github.com/AutoResearch/autora-experimentalist-uncertainty' nav: - Home: 'index.md' diff --git a/pyproject.toml b/pyproject.toml index e046560..6e491d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] # UPDATE THIS BEFORE PUBLISHING -name = "autora-experimentalist-sampler-uncertainty" +name = "autora-experimentalist-uncertainty" description = "Sampler based on where the model is least certain." authors = [{ name = "Built by Sebastian Musslick, restructured by Chad Williams", email = "sebastian_musslick@brown.edu" }] dynamic = ["version"] @@ -22,7 +22,7 @@ dev = [ [project.urls] homepage = "http://www.empiricalresearch.ai" -repository = "https://github.com/AutoResearch/autora-experimentalist-sampler-uncertainty" +repository = "https://github.com/AutoResearch/autora-experimentalist-uncertainty" documentation = "https://autoresearch.github.io/autora/" diff --git a/src/autora/experimentalist/sampler/uncertainty/__init__.py b/src/autora/experimentalist/uncertainty/__init__.py similarity index 95% rename from src/autora/experimentalist/sampler/uncertainty/__init__.py rename to src/autora/experimentalist/uncertainty/__init__.py index 0cbae5a..c46bd3b 100644 --- a/src/autora/experimentalist/sampler/uncertainty/__init__.py +++ b/src/autora/experimentalist/uncertainty/__init__.py @@ -1,10 +1,12 @@ from typing import Iterable + import numpy as np from scipy.stats import entropy from autora.utils.deprecation import deprecated_alias -def uncertainty_sample(X, model, num_samples, measure="least_confident"): + +def sample(X, model, num_samples, measure="least_confident"): """ Args: @@ -60,4 +62,6 @@ class labels under the model, respectively. return X[idx] + +uncertainty_sample = sample uncertainty_sampler = deprecated_alias(uncertainty_sample, "uncertainty_sampler") diff --git a/tests/test_uncertainty_sampler.py b/tests/test_uncertainty_sampler.py index be6605b..0ee9f9c 100644 --- a/tests/test_uncertainty_sampler.py +++ b/tests/test_uncertainty_sampler.py @@ -1,19 +1,21 @@ -from autora.experimentalist.sampler.uncertainty import uncertainty_sample -from sklearn.linear_model import LogisticRegression import numpy as np +from sklearn.linear_model import LogisticRegression + +from autora.experimentalist.uncertainty import uncertainty_sample + def test_output_dimensions(): - #Meta-Setup + # Meta-Setup X = np.linspace(start=-3, stop=6, num=10).reshape(-1, 1) y = (X**2).reshape(-1) n = 5 - - #Theorists + + # Theorists lr_theorist = LogisticRegression() - - lr_theorist.fit(X,y) - #Sampler + lr_theorist.fit(X, y) + + # Sampler X_new = uncertainty_sample(X, lr_theorist, n) # Check that the sampler returns n experiment conditions