Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 51 additions & 10 deletions docs/source/benchmarks/bwr.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"id": "7ab0929e",
"metadata": {
"execution": {
Expand All @@ -1085,7 +1085,7 @@
"outputs": [],
"source": [
"model_settings = {\n",
" \"models\": [\"Linear\", \"Lasso\", \"DT\", \"RF\", \"KN\", \"FNN\"],\n",
" \"models\": [\"Linear\", \"Lasso\", \"DT\", \"RF\", \"KN\", \"FNN\", \"RD\", \"EN\", \"ET\", \"Stacking\", \"MultiOutput\", \"GB\", \"AB\"],\n",
" \"FNN\": {\n",
" \"structural_params\": {\n",
" \"Dense_hidden\": {\n",
Expand Down Expand Up @@ -1118,6 +1118,19 @@
" \"validation_split\": 0.15,\n",
" },\n",
" },\n",
" \"GB\":{\n",
" \"multi_output\": True\n",
" },\n",
" \"AB\":{\n",
" \"multi_output\": True \n",
" },\n",
" \"MultiOutput\":{\n",
" \"estimator\": \"SVM\",\n",
" },\n",
" \"Stacking\":{\n",
" \"estimators\": [\"KN\", \"SVM\"],\n",
" \"_multi_output\": True,\n",
" },\n",
"}\n",
"tuner = mai.Tuner(xtrain, ytrain, model_settings=model_settings)"
]
Expand All @@ -1134,7 +1147,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"id": "d3c55743",
"metadata": {
"execution": {
Expand Down Expand Up @@ -1177,6 +1190,33 @@
" \"leaf_size\": randint(low=1, high=30), # 1 - 30\n",
" \"p\": randint(low=1, high=10), # 1 - 10\n",
" },\n",
" \"RD\":{\n",
" \"alpha\": uniform(loc=0.0001, scale=0.0099), # 0.0001 - 0.01\n",
" },\n",
" \"EN\":{\n",
" \"alpha\": uniform(loc=0.0001, scale=0.0099), # 0.0001 - 0.01\n",
" },\n",
" \"ET\":{\n",
" \"max_depth\": randint(low=5, high=50), # 5 - 50\n",
" \"min_samples_split\": randint(low=2, high=20), # 2 - 20\n",
" \"min_samples_leaf\": randint(low=1, high=20), # 1 - 20\n",
" },\n",
" \"GB\": {\n",
" \"estimator__learning_rate\": uniform(loc=0.1, scale=1e-2)\n",
" },\n",
" \"AB\":{\n",
" \"estimator__learning_rate\": uniform(loc=1, scale=0.5)\n",
" },\n",
" \"MultiOutput\":{\n",
" \"estimator__C\": uniform(loc=0.01, scale=99.99), # 0.01 - 100\n",
" },\n",
" \"Stacking\":{\n",
" \"estimator__KN__n_neighbors\": randint(low=1, high=20), # 1 - 20\n",
" \"estimator__KN__weights\": [\"uniform\", \"distance\"],\n",
" \"estimator__KN__leaf_size\": randint(low=1, high=30), # 1 - 30\n",
" \"estimator__KN__p\": randint(low=1, high=10), # 1 - 10\n",
" \"estimator__SVM__C\": uniform(loc=0.01, scale=99.99), # 0.01 - 100\n",
" },\n",
"}\n",
"start = time.time()\n",
"random_search_configs = tuner.random_search(\n",
Expand Down Expand Up @@ -4088,7 +4128,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": null,
"id": "7799a9a9",
"metadata": {
"execution": {
Expand Down Expand Up @@ -4172,7 +4212,7 @@
}
],
"source": [
"for model in [\"Lasso\", \"DT\", \"RF\", \"KN\", \"FNN\"]:\n",
"for model in [\"Lasso\", \"DT\", \"RF\", \"KN\", \"FNN\", \"RD\", \"EN\", \"ET\", \"Stacking\", \"MultiOutput\", \"GB\", \"AB\"]:\n",
" postprocessor.print_model(model_type=model)\n",
" print()"
]
Expand Down Expand Up @@ -4230,7 +4270,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": null,
"id": "bde1e6e3",
"metadata": {
"execution": {
Expand All @@ -4254,8 +4294,8 @@
],
"source": [
"def performance_plot(meth, output):\n",
" models = np.array([[\"Linear\", \"Lasso\"], [\"DT\", \"KN\"], [\"RF\", \"FNN\"]])\n",
" fig, axarr = plt.subplots(models.shape[0], models.shape[1], figsize=(15,20))\n",
" models = np.array([[\"Linear\", \"Lasso\"], [\"DT\", \"KN\"], [\"RF\", \"FNN\"], [\"RD\", \"EN\"], [\"ET\", \"Stacking\"], [\"MultiOutput\", \"GB\"], [\"AB\", \"AB\"]])\n",
" fig, axarr = plt.subplots(models.shape[0], models.shape[1], figsize=(15,20), constrained_layout=True)\n",
" for i in range(models.shape[0]):\n",
" for j in range(models.shape[1]):\n",
" plt.sca(axarr[i, j])\n",
Expand Down Expand Up @@ -4394,7 +4434,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": null,
"id": "94e8377c",
"metadata": {
"execution": {
Expand All @@ -4418,7 +4458,7 @@
],
"source": [
"# Output Features and models to plot\n",
"models = np.array([[\"Linear\", \"Lasso\"], [\"DT\", \"KN\"], [\"RF\", \"FNN\"]])\n",
"models = np.array([[\"Linear\", \"Lasso\"], [\"DT\", \"KN\"], [\"RF\", \"FNN\"], [\"RD\", \"EN\"], [\"ET\", \"Stacking\"], [\"MultiOutput\", \"GB\"], [\"AB\", \"AB\"]])\n",
"\n",
"# Plot info\n",
"fig, axarr = plt.subplots(models.shape[0], models.shape[1], figsize=(17,22))\n",
Expand All @@ -4432,6 +4472,7 @@
" axarr[i, j].get_legend().remove()\n",
"\n",
"fig.legend([\"K-eff\", \"Max3Pin\", \"Max4Pin\", \"F-delta-H\", \"Max-Fxy\"], loc=\"upper center\", ncol=5)\n",
"plt.subplots_adjust(hspace=0.5) \n",
"plt.show()"
]
},
Expand Down
Loading