|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": 1, |
| 6 | + "id": "initial_id", |
| 7 | + "metadata": { |
| 8 | + "ExecuteTime": { |
| 9 | + "end_time": "2024-01-15T12:54:35.753589Z", |
| 10 | + "start_time": "2024-01-15T12:54:35.750257Z" |
| 11 | + } |
| 12 | + }, |
| 13 | + "outputs": [], |
| 14 | + "source": [ |
| 15 | + "%%capture\n", |
| 16 | + "cd .." |
| 17 | + ] |
| 18 | + }, |
| 19 | + { |
| 20 | + "cell_type": "code", |
| 21 | + "execution_count": 2, |
| 22 | + "id": "13f6945fd3b104a7", |
| 23 | + "metadata": { |
| 24 | + "ExecuteTime": { |
| 25 | + "end_time": "2024-01-15T12:54:39.118554Z", |
| 26 | + "start_time": "2024-01-15T12:54:35.754737Z" |
| 27 | + } |
| 28 | + }, |
| 29 | + "outputs": [], |
| 30 | + "source": [ |
| 31 | + "%%capture\n", |
| 32 | + "import pandas as pd\n", |
| 33 | + "from tempfile import gettempdir\n", |
| 34 | + "\n", |
| 35 | + "from sklearn import model_selection\n", |
| 36 | + "from palma.datasets import load_credit_approval\n", |
| 37 | + "from palma import Project, ModelSelector\n", |
| 38 | + "from palma.components import DeepCheck, FileSystemLogger, Leakage\n", |
| 39 | + "from palma import set_logger\n", |
| 40 | + "\n", |
| 41 | + "# set_logger(FileSystemLogger(f'{gettempdir()}/fs-logger'))\n", |
| 42 | + "\n", |
| 43 | + "X, y = load_credit_approval()\n" |
| 44 | + ] |
| 45 | + }, |
| 46 | + { |
| 47 | + "cell_type": "code", |
| 48 | + "execution_count": 3, |
| 49 | + "id": "c8753b3c", |
| 50 | + "metadata": { |
| 51 | + "ExecuteTime": { |
| 52 | + "end_time": "2024-01-15T12:54:52.510171Z", |
| 53 | + "start_time": "2024-01-15T12:54:39.123512Z" |
| 54 | + } |
| 55 | + }, |
| 56 | + "outputs": [], |
| 57 | + "source": [ |
| 58 | + "%%capture\n", |
| 59 | + "project = Project(problem=\"classification\", project_name=\"test\")\n", |
| 60 | + "project.add(DeepCheck())\n", |
| 61 | + "project.add(Leakage())\n", |
| 62 | + "project.start(\n", |
| 63 | + " X, y,\n", |
| 64 | + " splitter=model_selection.ShuffleSplit(\n", |
| 65 | + " n_splits=10, random_state=42)\n", |
| 66 | + ")" |
| 67 | + ] |
| 68 | + }, |
| 69 | + { |
| 70 | + "cell_type": "code", |
| 71 | + "execution_count": 4, |
| 72 | + "id": "af750aaa1ad437d9", |
| 73 | + "metadata": { |
| 74 | + "ExecuteTime": { |
| 75 | + "end_time": "2024-01-15T12:54:57.536949Z", |
| 76 | + "start_time": "2024-01-15T12:54:52.511725Z" |
| 77 | + } |
| 78 | + }, |
| 79 | + "outputs": [], |
| 80 | + "source": [ |
| 81 | + "model = ModelSelector(engine=\"FlamlOptimizer\",\n", |
| 82 | + " engine_parameters=dict(time_budget=5))\n", |
| 83 | + "model.start(project)" |
| 84 | + ] |
| 85 | + }, |
| 86 | + { |
| 87 | + "cell_type": "code", |
| 88 | + "execution_count": 5, |
| 89 | + "id": "63f097fa57aed229", |
| 90 | + "metadata": { |
| 91 | + "ExecuteTime": { |
| 92 | + "end_time": "2024-01-15T12:54:57.545479Z", |
| 93 | + "start_time": "2024-01-15T12:54:57.543230Z" |
| 94 | + } |
| 95 | + }, |
| 96 | + "outputs": [], |
| 97 | + "source": [ |
| 98 | + "checker = project.components[\"DeepCheck\"]" |
| 99 | + ] |
| 100 | + }, |
| 101 | + { |
| 102 | + "cell_type": "code", |
| 103 | + "execution_count": 6, |
| 104 | + "id": "c53c5e4b0367c945", |
| 105 | + "metadata": { |
| 106 | + "ExecuteTime": { |
| 107 | + "end_time": "2024-01-15T12:54:57.803874Z", |
| 108 | + "start_time": "2024-01-15T12:54:57.546706Z" |
| 109 | + } |
| 110 | + }, |
| 111 | + "outputs": [ |
| 112 | + { |
| 113 | + "data": { |
| 114 | + "application/vnd.jupyter.widget-view+json": { |
| 115 | + "model_id": "300a6e5f1c654cca8168d694332e9186", |
| 116 | + "version_major": 2, |
| 117 | + "version_minor": 0 |
| 118 | + }, |
| 119 | + "text/plain": [ |
| 120 | + "Accordion(children=(VBox(children=(HTML(value='\\n<h1 id=\"summary_CD829DTZWSNJIRWNWAMFPGB2D\">Checks on train an…" |
| 121 | + ] |
| 122 | + }, |
| 123 | + "metadata": {}, |
| 124 | + "output_type": "display_data" |
| 125 | + } |
| 126 | + ], |
| 127 | + "source": [ |
| 128 | + "checker.train_test_checks_results" |
| 129 | + ] |
| 130 | + }, |
| 131 | + { |
| 132 | + "cell_type": "code", |
| 133 | + "execution_count": 7, |
| 134 | + "id": "95998b6bac06baaf", |
| 135 | + "metadata": { |
| 136 | + "ExecuteTime": { |
| 137 | + "end_time": "2024-01-15T12:54:57.925889Z", |
| 138 | + "start_time": "2024-01-15T12:54:57.805250Z" |
| 139 | + } |
| 140 | + }, |
| 141 | + "outputs": [ |
| 142 | + { |
| 143 | + "data": { |
| 144 | + "application/vnd.jupyter.widget-view+json": { |
| 145 | + "model_id": "4cc6b337a1a14c49b2eb53cce9f23ead", |
| 146 | + "version_major": 2, |
| 147 | + "version_minor": 0 |
| 148 | + }, |
| 149 | + "text/plain": [ |
| 150 | + "Accordion(children=(VBox(children=(HTML(value='\\n<h1 id=\"summary_AF8AUIK6P7ETIR1CBXAG3D2F1\">Checks on whole da…" |
| 151 | + ] |
| 152 | + }, |
| 153 | + "metadata": {}, |
| 154 | + "output_type": "display_data" |
| 155 | + } |
| 156 | + ], |
| 157 | + "source": [ |
| 158 | + "checker.dataset_checks_results" |
| 159 | + ] |
| 160 | + }, |
| 161 | + { |
| 162 | + "cell_type": "code", |
| 163 | + "execution_count": 8, |
| 164 | + "id": "bf606df8", |
| 165 | + "metadata": { |
| 166 | + "ExecuteTime": { |
| 167 | + "end_time": "2024-01-15T12:54:58.053511Z", |
| 168 | + "start_time": "2024-01-15T12:54:57.927114Z" |
| 169 | + } |
| 170 | + }, |
| 171 | + "outputs": [ |
| 172 | + { |
| 173 | + "data": { |
| 174 | + "text/plain": [ |
| 175 | + "{'leakage': False, 'metric': 0.387037037037037}" |
| 176 | + ] |
| 177 | + }, |
| 178 | + "execution_count": 8, |
| 179 | + "metadata": {}, |
| 180 | + "output_type": "execute_result" |
| 181 | + } |
| 182 | + ], |
| 183 | + "source": [ |
| 184 | + "project.components[\"Leakage\"].metrics" |
| 185 | + ] |
| 186 | + } |
| 187 | + ], |
| 188 | + "metadata": { |
| 189 | + "hide_input": false, |
| 190 | + "kernelspec": { |
| 191 | + "display_name": "Python 3 (ipykernel)", |
| 192 | + "language": "python", |
| 193 | + "name": "python3" |
| 194 | + }, |
| 195 | + "language_info": { |
| 196 | + "codemirror_mode": { |
| 197 | + "name": "ipython", |
| 198 | + "version": 3 |
| 199 | + }, |
| 200 | + "file_extension": ".py", |
| 201 | + "mimetype": "text/x-python", |
| 202 | + "name": "python", |
| 203 | + "nbconvert_exporter": "python", |
| 204 | + "pygments_lexer": "ipython3", |
| 205 | + "version": "3.10.12" |
| 206 | + }, |
| 207 | + "toc": { |
| 208 | + "base_numbering": 1, |
| 209 | + "nav_menu": {}, |
| 210 | + "number_sections": true, |
| 211 | + "sideBar": true, |
| 212 | + "skip_h1_title": false, |
| 213 | + "title_cell": "Table of Contents", |
| 214 | + "title_sidebar": "Contents", |
| 215 | + "toc_cell": false, |
| 216 | + "toc_position": {}, |
| 217 | + "toc_section_display": true, |
| 218 | + "toc_window_display": false |
| 219 | + }, |
| 220 | + "varInspector": { |
| 221 | + "cols": { |
| 222 | + "lenName": 16, |
| 223 | + "lenType": 16, |
| 224 | + "lenVar": 40 |
| 225 | + }, |
| 226 | + "kernels_config": { |
| 227 | + "python": { |
| 228 | + "delete_cmd_postfix": "", |
| 229 | + "delete_cmd_prefix": "del ", |
| 230 | + "library": "var_list.py", |
| 231 | + "varRefreshCmd": "print(var_dic_list())" |
| 232 | + }, |
| 233 | + "r": { |
| 234 | + "delete_cmd_postfix": ") ", |
| 235 | + "delete_cmd_prefix": "rm(", |
| 236 | + "library": "var_list.r", |
| 237 | + "varRefreshCmd": "cat(var_dic_list()) " |
| 238 | + } |
| 239 | + }, |
| 240 | + "types_to_exclude": [ |
| 241 | + "module", |
| 242 | + "function", |
| 243 | + "builtin_function_or_method", |
| 244 | + "instance", |
| 245 | + "_Feature" |
| 246 | + ], |
| 247 | + "window_display": false |
| 248 | + } |
| 249 | + }, |
| 250 | + "nbformat": 4, |
| 251 | + "nbformat_minor": 5 |
| 252 | +} |
0 commit comments