|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": null, |
| 6 | + "id": "7ecc7207", |
| 7 | + "metadata": { |
| 8 | + "ExecuteTime": { |
| 9 | + "end_time": "2021-07-16T06:46:10.332046Z", |
| 10 | + "start_time": "2021-07-16T06:46:08.296274Z" |
| 11 | + } |
| 12 | + }, |
| 13 | + "outputs": [], |
| 14 | + "source": [ |
| 15 | + "from autogluon.tabular import TabularDataset, TabularPredictor" |
| 16 | + ] |
| 17 | + }, |
| 18 | + { |
| 19 | + "cell_type": "code", |
| 20 | + "execution_count": null, |
| 21 | + "id": "6bc8546b", |
| 22 | + "metadata": { |
| 23 | + "ExecuteTime": { |
| 24 | + "end_time": "2021-07-16T06:46:58.348088Z", |
| 25 | + "start_time": "2021-07-16T06:46:54.098157Z" |
| 26 | + }, |
| 27 | + "scrolled": true |
| 28 | + }, |
| 29 | + "outputs": [], |
| 30 | + "source": [ |
| 31 | + "train_data = TabularDataset('./data/zhidemai/train.csv')" |
| 32 | + ] |
| 33 | + }, |
| 34 | + { |
| 35 | + "cell_type": "code", |
| 36 | + "execution_count": null, |
| 37 | + "id": "21370fd8", |
| 38 | + "metadata": { |
| 39 | + "ExecuteTime": { |
| 40 | + "end_time": "2021-07-16T06:47:01.557381Z", |
| 41 | + "start_time": "2021-07-16T06:47:01.542237Z" |
| 42 | + }, |
| 43 | + "scrolled": false |
| 44 | + }, |
| 45 | + "outputs": [], |
| 46 | + "source": [ |
| 47 | + "train_data.shape" |
| 48 | + ] |
| 49 | + }, |
| 50 | + { |
| 51 | + "cell_type": "code", |
| 52 | + "execution_count": null, |
| 53 | + "id": "4ba99057", |
| 54 | + "metadata": { |
| 55 | + "ExecuteTime": { |
| 56 | + "end_time": "2021-07-16T06:47:02.571735Z", |
| 57 | + "start_time": "2021-07-16T06:47:02.533065Z" |
| 58 | + }, |
| 59 | + "scrolled": true |
| 60 | + }, |
| 61 | + "outputs": [], |
| 62 | + "source": [ |
| 63 | + "train_data.head()" |
| 64 | + ] |
| 65 | + }, |
| 66 | + { |
| 67 | + "cell_type": "code", |
| 68 | + "execution_count": null, |
| 69 | + "id": "ec3eacc4", |
| 70 | + "metadata": { |
| 71 | + "ExecuteTime": { |
| 72 | + "end_time": "2021-07-16T06:47:13.690516Z", |
| 73 | + "start_time": "2021-07-16T06:47:13.685902Z" |
| 74 | + }, |
| 75 | + "scrolled": true |
| 76 | + }, |
| 77 | + "outputs": [], |
| 78 | + "source": [ |
| 79 | + "label = 'orders_3h_15h'" |
| 80 | + ] |
| 81 | + }, |
| 82 | + { |
| 83 | + "cell_type": "code", |
| 84 | + "execution_count": null, |
| 85 | + "id": "a225cdb6", |
| 86 | + "metadata": { |
| 87 | + "ExecuteTime": { |
| 88 | + "end_time": "2021-07-16T19:25:45.595950Z", |
| 89 | + "start_time": "2021-07-16T06:47:30.624411Z" |
| 90 | + }, |
| 91 | + "scrolled": true |
| 92 | + }, |
| 93 | + "outputs": [], |
| 94 | + "source": [ |
| 95 | + "save_path = 'agModels-zhidemai' # specifies folder to store trained models\n", |
| 96 | + "predictor = TabularPredictor(label=label, path=save_path).fit(train_data)" |
| 97 | + ] |
| 98 | + }, |
| 99 | + { |
| 100 | + "cell_type": "code", |
| 101 | + "execution_count": null, |
| 102 | + "id": "fa84c4eb", |
| 103 | + "metadata": { |
| 104 | + "ExecuteTime": { |
| 105 | + "end_time": "2021-07-16T19:25:46.126045Z", |
| 106 | + "start_time": "2021-07-16T19:25:45.598171Z" |
| 107 | + }, |
| 108 | + "scrolled": true |
| 109 | + }, |
| 110 | + "outputs": [], |
| 111 | + "source": [ |
| 112 | + "test_data_nolab = TabularDataset('./data/zhidemai/test.csv')" |
| 113 | + ] |
| 114 | + }, |
| 115 | + { |
| 116 | + "cell_type": "code", |
| 117 | + "execution_count": null, |
| 118 | + "id": "54cce4ce", |
| 119 | + "metadata": { |
| 120 | + "ExecuteTime": { |
| 121 | + "end_time": "2021-07-16T19:25:51.661647Z", |
| 122 | + "start_time": "2021-07-16T19:25:46.128238Z" |
| 123 | + } |
| 124 | + }, |
| 125 | + "outputs": [], |
| 126 | + "source": [ |
| 127 | + "y_pred = predictor.predict(test_data_nolab)" |
| 128 | + ] |
| 129 | + }, |
| 130 | + { |
| 131 | + "cell_type": "code", |
| 132 | + "execution_count": null, |
| 133 | + "id": "ca6cc9bf", |
| 134 | + "metadata": { |
| 135 | + "ExecuteTime": { |
| 136 | + "end_time": "2021-07-19T02:39:52.803717Z", |
| 137 | + "start_time": "2021-07-19T02:39:52.791822Z" |
| 138 | + }, |
| 139 | + "scrolled": true |
| 140 | + }, |
| 141 | + "outputs": [], |
| 142 | + "source": [ |
| 143 | + "y_pred" |
| 144 | + ] |
| 145 | + }, |
| 146 | + { |
| 147 | + "cell_type": "code", |
| 148 | + "execution_count": null, |
| 149 | + "id": "240cd16c", |
| 150 | + "metadata": {}, |
| 151 | + "outputs": [], |
| 152 | + "source": [ |
| 153 | + "id_ = ['article_id']\n", |
| 154 | + "target = 'orders_3h_15h'" |
| 155 | + ] |
| 156 | + }, |
| 157 | + { |
| 158 | + "cell_type": "code", |
| 159 | + "execution_count": null, |
| 160 | + "id": "b4fd354e", |
| 161 | + "metadata": {}, |
| 162 | + "outputs": [], |
| 163 | + "source": [ |
| 164 | + "sub = test_data_nolab[id_].copy()\n", |
| 165 | + "sub[target] = list(y_pred.values)" |
| 166 | + ] |
| 167 | + }, |
| 168 | + { |
| 169 | + "cell_type": "code", |
| 170 | + "execution_count": null, |
| 171 | + "id": "c59b336a", |
| 172 | + "metadata": {}, |
| 173 | + "outputs": [], |
| 174 | + "source": [ |
| 175 | + "sub.to_csv(\"./autogluon_sub.csv\", index = False)" |
| 176 | + ] |
| 177 | + }, |
| 178 | + { |
| 179 | + "cell_type": "code", |
| 180 | + "execution_count": null, |
| 181 | + "id": "c43926aa", |
| 182 | + "metadata": {}, |
| 183 | + "outputs": [], |
| 184 | + "source": [] |
| 185 | + }, |
| 186 | + { |
| 187 | + "cell_type": "code", |
| 188 | + "execution_count": null, |
| 189 | + "id": "6b54628e", |
| 190 | + "metadata": {}, |
| 191 | + "outputs": [], |
| 192 | + "source": [] |
| 193 | + } |
| 194 | + ], |
| 195 | + "metadata": { |
| 196 | + "kernelspec": { |
| 197 | + "display_name": "Python 3", |
| 198 | + "language": "python", |
| 199 | + "name": "python3" |
| 200 | + }, |
| 201 | + "language_info": { |
| 202 | + "codemirror_mode": { |
| 203 | + "name": "ipython", |
| 204 | + "version": 3 |
| 205 | + }, |
| 206 | + "file_extension": ".py", |
| 207 | + "mimetype": "text/x-python", |
| 208 | + "name": "python", |
| 209 | + "nbconvert_exporter": "python", |
| 210 | + "pygments_lexer": "ipython3", |
| 211 | + "version": "3.7.10" |
| 212 | + }, |
| 213 | + "toc": { |
| 214 | + "base_numbering": 1, |
| 215 | + "nav_menu": {}, |
| 216 | + "number_sections": true, |
| 217 | + "sideBar": true, |
| 218 | + "skip_h1_title": false, |
| 219 | + "title_cell": "Table of Contents", |
| 220 | + "title_sidebar": "Contents", |
| 221 | + "toc_cell": false, |
| 222 | + "toc_position": {}, |
| 223 | + "toc_section_display": true, |
| 224 | + "toc_window_display": false |
| 225 | + } |
| 226 | + }, |
| 227 | + "nbformat": 4, |
| 228 | + "nbformat_minor": 5 |
| 229 | +} |
0 commit comments