diff --git a/docs/Basic Usage.ipynb b/docs/Basic Usage.ipynb index 1409ade..3887486 100644 --- a/docs/Basic Usage.ipynb +++ b/docs/Basic Usage.ipynb @@ -24,18 +24,22 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": { "pycharm": { "is_executing": true + }, + "ExecuteTime": { + "end_time": "2024-10-02T16:08:44.659380Z", + "start_time": "2024-10-02T16:08:35.715312Z" } }, - "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from autora.experimentalist.nearest_value import nearest_values_sample" - ] + ], + "outputs": [], + "execution_count": 3 }, { "attachments": {}, @@ -52,13 +56,15 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": { "pycharm": { "is_executing": true + }, + "ExecuteTime": { + "end_time": "2024-10-02T16:08:49.694935Z", + "start_time": "2024-10-02T16:08:49.691413Z" } }, - "outputs": [], "source": [ "#Define meta-parameters\n", "X_allowed = np.linspace(-3, 6, 10)\n", @@ -69,7 +75,9 @@ " y = (xs ** 2.0)\n", " y[xs < 0] = 0\n", " return y" - ] + ], + "outputs": [], + "execution_count": 4 }, { "attachments": {}, @@ -83,17 +91,32 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": { "pycharm": { "is_executing": true + }, + "ExecuteTime": { + "end_time": "2024-10-02T16:08:58.653423Z", + "start_time": "2024-10-02T16:08:58.332938Z" } }, - "outputs": [], "source": [ "plt.plot(X, ground_truth(X), 'o')\n", "plt.show()" - ] + ], + "outputs": [ + { + "data": { + "text/plain": [ + "
" + ], + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAh8AAAGdCAYAAACyzRGfAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAgdklEQVR4nO3dfXST9f3/8VdaJAVp4lpo034JWNEJtQKCgBXlgJQ7d3pgonMqX27GqZNT2KDuiN1xdqizTjd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qquu0tq1ayM2D/ERR+rr6/XUU0/pxz/+caRH6RU+//xzdXV1KT09PWB9enq6mpubIzQVpJN7oJYvX66JEycqJycn0uP0Whs2bNCuXbtUWloa6VF6vU8++URlZWW67LLLtHnzZi1ZskQ/+clPtH79+ojMQ3xEoXvvvVcWi+Wsy759+wL+5uDBg5o5c6ZuueUWFRQURGhyIDoUFhZq79692rBhQ6RH6bUaGxv105/+VC+//LKSkpIiPU6v5/V6NWbMGD388MO66qqrdOedd6qgoEBr1qyJyDx9IvKsOKu7775bCxcuPOs2l1xyif+/Dx06pClTpujaa6/V888/H+bpcMrAgQOVmJiolpaWgPUtLS1yOBwRmgpLly7VW2+9pW3btmnw4MGRHqfXqqmpUWtrq8aMGeNf19XVpW3btunpp5+Wx+NRYmJiBCfsXTIyMpSdnR2wbsSIEfrLX/4SkXmIjyg0aNAgDRo06Jy2PXjwoKZMmaKxY8dq3bp1SkhgZ5Ypffv21dixY1VZWak5c+ZIOvmvi8rKSi1dujSyw/VCPp9Py5Yt08aNG7V161ZlZWVFeqReberUqfrwww8D1i1atEjDhw/XypUrCQ/DJk6ceNqp5//+9781dOjQiMxDfMSwgwcPavLkyRo6dKh+85vf6PDhw/77+Je3GUVFRVqwYIGuvvpqjR8/XqtXr1Z7e7sWLVoU6dF6ncLCQpWXl+uNN95QcnKy/7gbu92ufv36RXi63ic5Ofm0420uvPBCpaamchxOBKxYsULXXnutHn74Yf3gBz/Qjh079Pzzz0dsbznxEcO2bNmi+vp61dfXn7Z7mTOozbj11lt1+PBh3X///Wpubtbo0aNVUVFx2kGoCL+ysjJJ0uTJkwPWr1u37lu/xgTi3bhx47Rx40YVFxfrgQceUFZWllavXq077rgjIvNwnQ8AAGAUBwgAAACjiA8AAGAU8QEAAIwiPgAAgFHEBwAAMIr4AAAARhEfAADAKOIDAAAYRXwAAACjiA8AAGAU8QEAAIwiPgAAgFH/D/HGlsjhfY1/AAAAAElFTkSuQmCC" + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "execution_count": 5 }, { "attachments": {}, @@ -107,17 +130,34 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": { "pycharm": { "is_executing": true + }, + "ExecuteTime": { + "end_time": "2024-10-02T16:09:01.310540Z", + "start_time": "2024-10-02T16:09:01.305070Z" } }, - "outputs": [], "source": [ - "sampler_proposal = nearest_values_sample(X, X_allowed, 5)\n", + "sampler_proposal = nearest_values_sample(X_allowed, X, 5)\n", "print(sampler_proposal)" - ] + ], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " 0\n", + "0 5.0\n", + "1 -3.0\n", + "2 1.0\n", + "3 4.0\n", + "4 6.0\n" + ] + } + ], + "execution_count": 6 }, { "attachments": {}, @@ -131,19 +171,34 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": { "pycharm": { "is_executing": true + }, + "ExecuteTime": { + "end_time": "2024-10-02T16:09:04.262772Z", + "start_time": "2024-10-02T16:09:04.206491Z" } }, - "outputs": [], "source": [ "plt.plot(X, ground_truth(X), 'o', alpha = .5, label = 'Original Datapoints')\n", "plt.plot(sampler_proposal, ground_truth(sampler_proposal), 'o', alpha = .5, label = 'New Datapoints')\n", "plt.legend()\n", "plt.show()" - ] + ], + "outputs": [ + { + "data": { + "text/plain": [ + "
" + ], + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAh8AAAGdCAYAAACyzRGfAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA5RUlEQVR4nO3deXhU5f3//9fMJDPZJyRkA4YQJGyyKPsmYkEDrVxSoSIfaoFyISpoEXChLrgWFSu4AernU0B/ItYFqFZBDCZaCiogIiKYIEuEJCCQhYFMljm/P/Jl2mFPSM5keT6u61ww5z5zzntmAvPKfe5zH4thGIYAAABMYg10AQAAoHEhfAAAAFMRPgAAgKkIHwAAwFSEDwAAYCrCBwAAM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xzjZYuXSqLxaKCggJJZ/4WfqoX4Y033lCrVq3kdDp18803q7j4P6959erVGjBggKKjoxUbG6vrr79eu3fvrvLrDQsLU2Jiolq0aKE+ffro6aef1iuvvKLXXntNn376qW+7++67T23btlVYWJhat26thx56SGVlZb76H330UX377be+npQlS5ZIkp577jl17txZ4eHhcrlcuuOOO3T8+HHffk+99pUrV/reo7S0NOXk5PjVuXDhQl122WWy2+1q166d3njjDb/2/z7tcuozeP/993XNNdcoLCxMXbt21YYNGyRJGRkZmjBhggoLC331PvLII5KkBQsW+OpISEjQqFGjqvyeAkB15OVkK+holkrDk6TTL9iwWlUWnijb0Szl5WSbVlOjCh9er6E12/N11F2q1PgIRYYEy2a1KDIkWKnxETrqLtUn3+fX+CmYo0ePas2aNbrjjjsUGhrq15aYmKixY8fq7bfflmH857jPPvusunbtqm+++UYPPfTQGfvcs2ePRo0apREjRujbb7/V5MmT/QLMuezevVsrV67Uhx9+qA8//FCZmZl66qmnfO1ut1vTp0/Xpk2blJ6eLqvVqt/+9rfyer2X8A5UGjdunJo0aeJ3+iUyMlJLlizRjh079Pzzz+u1117TvHnzJFWeNpoxY4Yuv/xy5ebmKjc3V6NHj5ZUecXTCy+8oO+//15Lly7VunXrdO+99/od78SJE3ryySf1+uuva/369SooKNDNN9/sa1+xYoX+9Kc/acaMGdq+fbsmT56sCRMm6LPPPjvv63jggQc0c+ZMbd26VW3bttWYMWNUXl6ufv36af78+YqKivLVO3PmTG3atEl33XWXHnvsMe3atUurV6/WwIEDL/n9BICL4XEXyFrhkYLPPkWFNzhc1gqPPO4C02pqVFe7HCg4qd2HjyvJGXLGJY0Wi0VJzhBlHzquAwUn5YqpuXlEsrKyZBiGOnTocNb2Dh066NixYzp8+LDvNMmvfvUrzZgxw7fN3r17/Z7zyiuvqF27dpo7d64kqV27dtq+fbuefPLJ89bi9Xq1ZMkSRUZGSpJuueUWpaen+543cuRIv+3/9re/KS4uTjt27KjSeJOzsVqtatu2rd9refDBB31/b9WqlWbOnKnly5fr3nvvVWhoqCIiIhQUFKTExES/fU2bNs3veU888YRuu+02LViwwLe+rKxML730knr37i1JWrp0qTp06KCvvvpKvXr10rPPPqvx48frjjvukCRNnz5dGzdu1LPPPqtrrrnmnK9j5syZ+s1vfiNJevTRR3X55ZcrOztb7du3l9PplMVi8at3//79Cg8P1/XXX6/IyEglJyfryiuvrPobCADV4AiPltfmkMpOVJ5yOY21zC2vzSFHeLRpNTWqng93ablKyisUZj975gq12+Qpr5C7tLxWjv/fPRsX0qNHj/O279q1Sz179vRb16tXrwvut1WrVr7gIUlJSUk6dOiQ73FWVpbGjBmj1q1bKyoqSq1atZJU+QVaEwzD8At+b7/9tvr376/ExERFRETowQcfvKhjffrppxo8eLCaN2+uyMhI3XLLLTpy5IjftPtBQUF+71H79u0VHR2tH374QZL0ww8/qH///n777d+/v6/9XLp06eL7e1JSkiT5vYenu/baa5WcnKzWrVvrlltu0ZtvvsntAQCYJtHVRuUxqbK7c6XTe7G9XgW781QRk6pEVxvTampU4SPcHqSQIJtOnCNcnCytkCPIpvBzhJPqatOmjSwWyzm/1H744Qc1adJEcXFx/6k1PLxGazglODjY77HFYvE7pTJ8+HAdPXpUr732mr788kt9+eWXkioHvV6qiooKZWVlKSUlRZK0YcMGjR07Vr/+9a/14Ycf6ptvvtEDDzxwwWPt3btX119/vbp06aL33ntPmzdv1ssvv1xjdV7If7+Hp4LU+U5LRUZGasuWLXrrrbeUlJSkhx9+WF27dvWNzQGA2mS12dSsz6jKq1sKsmTxFMrwlsviKZS9IEvlIU2U1GeUqfN9NKrw0Tw6VJfFRSi3sOSMXgjDMJRbWKI28RFqHh16jj1UT2xsrK699lotWLBAJ0+e9GvLy8vTm2++qdGjR1dpdst27dpp06ZNfuu+/vrrS6rzyJEj2rVrlx588EENHjzYdzqopixdulTHjh3zndr597//reTkZD3wwAPq0aOHUlNTtW/fPr/n2O32M+5evHnzZnm9Xv31r39Vnz591LZtWx08ePCM45WXl/u9R7t27VJBQYHv9FeHDh20fv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uxMRE08MbAODSNL7wcXiXtHGRlLtNCouRYlMr/8zdVrm+FgPIkCFDlJiYqDlz5px3u3/961+66qqrFBoaKpfLpbvuuktut1uS9NJLL6lTp06+bU/1nPz3LeWHDBlywYG+0dHRSkxMVKtWrXTdddfp3Xff1dixYzV16lRfODpy5IjGjBmj5s2bKywsTJ07d9Zbb73l28f48eOVmZmp559/3teTsnfvXlVUVGjixIlKSUlRaGio2rVrp+eff97v+Kd6IB599FHFxcUpKipKt912m0pLS33beDwe3XXXXYqPj1dISIgGDBigr7/+2td++mmXJUuWKDo6WmvWrFGHDh0UERGhoUOHKjc3V1LlbLpLly7VqlWrfPVmZGSotLRUU6dOVVJSkkJCQpScnHzBzwgAUH2NK3x4vdIPH0gnjkhx7SVHlGS1Vf4Z175y/c4Pa+0UjM1m01/+8he9+OKL+vnnn8+6ze7duzV06FCNHDlS27Zt09tvv61//etfvhvGXX311dqxY4cOHz4sScrMzFTTpk2VkZEhSSorK9OGDRs0aNCgKtd39913q7i4WGvXrpVUOdtm9+7d9c9//lPbt2/XrbfeqltuuUVfffWVJOn5559X3759NWnSJOXm5io3N1cul0ter1ctWrTQO++8ox07dujhhx/Wn//8Z/3973/3O156erp++OEHZWRk6K233tL777/vN9X+vffeq/fee09Lly7Vli1b1KZNG6Wlpeno0aPnfA0nTpzQs88+qzfeeEOff/659u/fr5kzZ0qSZs6cqZtuuskXSHJzc9WvXz+98MIL+sc//qG///3v2rVrl9588021atWqyu8fAODiNK7wUZgj/ZIlOZtLp3fVWyxSVHPp8I+V29WS3/72t7riiis0e/bss7bPmTNHY8eO1bRp05Samur7cnz99ddVUlKiTp06KSYmxndlUUZGhmbMmOF7/NVXX6msrEz9+vWrcm3t27eXJO3du1eS1Lx5c82cOVNXXHGFWrdurTvvvFNDhw71hQin0ym73e67k3FiYqJsNpuCg4P16KOPqkePHkpJSdHYsWM1YcKEM8KH3W7X3/72N11++eX6zW9+o8cee0wvvPCCvF6v3G63Fi5cqLlz52rYsGHq2LGj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AADAV4QMAAJiK8AEAAExF+AAAAKYifAAAAFNVKXwsXLhQXbp0UVRUlKKiotS3b199/PHHvvaSkhJNmTJFsbGxioiI0MiRI5Wfn1/jRQMAgPqrSuGjRYsWeuqpp7R582Zt2rRJv/rVr3TDDTfo+++/lyTdfffd+uCDD/TOO+8oMzNTBw8e1I033lgrhQMAgPrJYhiGcSk7iImJ0dy5czVq1CjFxcVp2bJlGjVqlCRp586d6tChgzZs2KA+ffpc1P6KiorkdDpVWFioqKioSykNAACYpCrf39Ue81FRUaHly5fL7Xarb9++2rx5s8rKyjRkyBDfNu3bt1fLli21YcOGc+7H4/GoqKjIbwEAAA1XlcPHd999p4iICDkcDt12221asWKFOnbsqLy8PNntdkVHR/ttn5CQoLy8vHPub86cOXI6nb7F5XJV+UUAAID6o8rho127dtq6dau+/PJL3X777Ro3bpx27NhR7QJmzZqlwsJC35KTk1PtfQEAgLovqKpPsNvtatOmjSSpe/fu+vrrr/X8889r9OjRKi0tVUFBgV/vR35+vhITE8+5P4fDIYfDUfXKAQBAvXTJ83x4vV55PB51795dwcHBSk9P97Xt2rVL+/fvV9++fS/1MAAAoIGoUs/HrFmzNGzYMLVs2VLFxcVatmyZMjIytGbNGjmdTk2cOFHTp09XTEyMoqKidOedd6pv374XfaULAABo+KoUPg4dOqQ//OEPys3NldPpVJcuXbRmzRpde+21kqR58+bJarVq5MiR8ng8SktL04IFC2qlcAAAUD9d8jwfNY15PgAAqH9MmecDAACgOggfAADAVIQPAABgKsIHAAAwFeEDAACYivABAABMRfgAAACmInwAAABTET4AAICpCB8AAMBUhA8AAGAqwgcAADAV4QMAAJiK8AEAAExF+AAAAKYifAAAAFMRPgAAgKkIHwAAwFSEDwAAYCrCBwAAMBXhAwAAmIrwAQAATEX4AAAApiJ8AAAAUxE+AACAqQgfAADAVIQPAABgKsIHAAAwFeEDAACYivABAABMRfgAAACmInwAAABTET4AAICpCB8AAMBUhA8AAGCqoEAXAABAXVfqKdMXW75RQcExRUc30VXdrpTdER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fNjXxm/e5pg+fbrGjRunHj16qFevXpo/f77cbrcmTJgQ6NIanSlTpmjZsmVatWqVIiMjfeNunE6nQkNDA1xd4xMZGXnGeJvw8HDFxsYyDicA7r77bvXr109/+ctfdNNNN+mrr77Sq6++GrDecsJHPbZ27VplZ2crOzv7jO5lrqA2x+jRo3X48GE9/PDDysvL0xVXXKHVq1efMQgVtW/hwoWSpEGDBvmtX7x48QVPYwINXc+ePbVixQrNmjVLjz32mFJSUjR//nyNHTs2IPUwzwcAADAVAwQAAICpCB8AAMBUhA8AAGAqwgcAADAV4QMAAJiK8AEAAExF+AAAAKYifAAAAFMRPgAAgKkIHwAAwFSEDwAAYCrCBwAAMNX/D/+HzScnre0VAAAAAElFTkSuQmCC" + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "execution_count": 7 }, { "cell_type": "code", @@ -157,9 +212,9 @@ ], "metadata": { "kernelspec": { - "display_name": "autoraKernel", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "autorakernel" + "name": "python3" }, "language_info": { "codemirror_mode": { diff --git a/src/autora/experimentalist/nearest_value/__init__.py b/src/autora/experimentalist/nearest_value/__init__.py index f7081e5..2a94af9 100644 --- a/src/autora/experimentalist/nearest_value/__init__.py +++ b/src/autora/experimentalist/nearest_value/__init__.py @@ -8,7 +8,7 @@ def sample( conditions: Union[pd.DataFrame, np.ndarray], - allowed_values: np.ndarray, + reference_conditions: Union[pd.DataFrame, np.ndarray], num_samples: int, ): """ @@ -16,8 +16,8 @@ def sample( values, without replacement. Args: - conditions: input conditions - allowed_values: allowed conditions to sample from + conditions: The candidate samples of experimental conditions to be evaluated. + reference_conditions: Experimental conditions to which the distance is calculated num_samples: number of samples Returns: @@ -25,23 +25,23 @@ def sample( """ - if isinstance(allowed_values, Iterable): - allowed_values = np.array(list(allowed_values)) + if isinstance(conditions, Iterable): + conditions = np.array(list(conditions)) - if len(allowed_values.shape) == 1: - allowed_values = allowed_values.reshape(-1, 1) + if len(conditions.shape) == 1: + conditions = conditions.reshape(-1, 1) - if allowed_values.shape[0] < num_samples: + if conditions.shape[0] < num_samples: raise Exception( "More samples requested than samples available in the set allowed of values." ) - X = np.array(conditions) + X = np.array(reference_conditions) if X.shape[0] < num_samples: raise Exception("More samples requested than samples available in the pool.") - x_new = np.empty((num_samples, allowed_values.shape[1])) + x_new = np.empty((num_samples, conditions.shape[1])) # get index of row in x that is closest to each sample for row, sample in enumerate(X): @@ -49,13 +49,13 @@ def sample( if row >= num_samples: break - dist = np.linalg.norm(allowed_values - sample, axis=1) + dist = np.linalg.norm(conditions - sample, axis=1) idx = np.argmin(dist) - x_new[row, :] = allowed_values[idx, :] - allowed_values = np.delete(allowed_values, idx, axis=0) + x_new[row, :] = conditions[idx, :] + conditions = np.delete(conditions, idx, axis=0) - if isinstance(conditions, pd.DataFrame): - x_new = pd.DataFrame(x_new, columns=conditions.columns) + if isinstance(reference_conditions, pd.DataFrame): + x_new = pd.DataFrame(x_new, columns=reference_conditions.columns) else: x_new = pd.DataFrame(x_new) diff --git a/tests/test_nearest_value_sampler.py b/tests/test_nearest_value_sampler.py index 71cc944..d69186a 100644 --- a/tests/test_nearest_value_sampler.py +++ b/tests/test_nearest_value_sampler.py @@ -10,7 +10,7 @@ def test_output_dimensions(): n = 5 # Sampler - X_new = nearest_values_sample(X, X_allowed, n) + X_new = nearest_values_sample(X_allowed, X, n) # Check that the sampler returns n experiment conditions assert X_new.shape == (n, X.shape[1])