|
20 | 20 | }, |
21 | 21 | { |
22 | 22 | "cell_type": "code", |
23 | | - "execution_count": 155, |
| 23 | + "execution_count": 6, |
24 | 24 | "metadata": {}, |
25 | 25 | "outputs": [ |
26 | 26 | { |
27 | 27 | "name": "stdout", |
28 | 28 | "output_type": "stream", |
29 | 29 | "text": [ |
30 | | - "TensorFlow : 1.10.0\n" |
| 30 | + "TensorFlow : 1.12.0\n" |
31 | 31 | ] |
32 | 32 | } |
33 | 33 | ], |
|
54 | 54 | }, |
55 | 55 | { |
56 | 56 | "cell_type": "code", |
57 | | - "execution_count": 1, |
| 57 | + "execution_count": 7, |
58 | 58 | "metadata": {}, |
59 | 59 | "outputs": [ |
60 | 60 | { |
61 | 61 | "name": "stdout", |
62 | 62 | "output_type": "stream", |
63 | 63 | "text": [ |
| 64 | + "mkdir: data: File exists\n", |
64 | 65 | "Copying gs://cloud-samples-data/ml-engine/census/data/adult.data.csv...\n", |
65 | 66 | "- [1 files][ 3.8 MiB/ 3.8 MiB] \n", |
66 | 67 | "Operation completed over 1 objects/3.8 MiB. \n", |
|
79 | 80 | }, |
80 | 81 | { |
81 | 82 | "cell_type": "code", |
82 | | - "execution_count": 121, |
| 83 | + "execution_count": 8, |
83 | 84 | "metadata": {}, |
84 | 85 | "outputs": [], |
85 | 86 | "source": [ |
|
89 | 90 | }, |
90 | 91 | { |
91 | 92 | "cell_type": "code", |
92 | | - "execution_count": 8, |
| 93 | + "execution_count": 19, |
93 | 94 | "metadata": {}, |
94 | 95 | "outputs": [ |
95 | 96 | { |
|
103 | 104 | ], |
104 | 105 | "source": [ |
105 | 106 | "!wc -l $TRAIN_DATA_FILE\n", |
106 | | - "!wc -l $TEST_DATA_FILE" |
| 107 | + "!wc -l $EVAL_DATA_FILE" |
107 | 108 | ] |
108 | 109 | }, |
109 | 110 | { |
|
115 | 116 | }, |
116 | 117 | { |
117 | 118 | "cell_type": "code", |
118 | | - "execution_count": 103, |
| 119 | + "execution_count": 20, |
119 | 120 | "metadata": {}, |
120 | 121 | "outputs": [ |
121 | 122 | { |
|
149 | 150 | }, |
150 | 151 | { |
151 | 152 | "cell_type": "code", |
152 | | - "execution_count": 75, |
| 153 | + "execution_count": 21, |
153 | 154 | "metadata": {}, |
154 | 155 | "outputs": [], |
155 | 156 | "source": [ |
|
180 | 181 | }, |
181 | 182 | { |
182 | 183 | "cell_type": "code", |
183 | | - "execution_count": 76, |
| 184 | + "execution_count": 22, |
184 | 185 | "metadata": {}, |
185 | 186 | "outputs": [ |
186 | 187 | { |
|
206 | 207 | }, |
207 | 208 | { |
208 | 209 | "cell_type": "code", |
209 | | - "execution_count": 82, |
| 210 | + "execution_count": 23, |
210 | 211 | "metadata": {}, |
211 | 212 | "outputs": [ |
212 | 213 | { |
|
220 | 221 | "source": [ |
221 | 222 | "import math\n", |
222 | 223 | "\n", |
223 | | - "\n", |
224 | 224 | "def create_feature_columns():\n", |
225 | 225 | " \n", |
226 | 226 | " feature_columns = []\n", |
|
248 | 248 | " feature_columns=feature_columns,\n", |
249 | 249 | " n_classes=len(TARGET_LABELS),\n", |
250 | 250 | " label_vocabulary=TARGET_LABELS,\n", |
| 251 | + " weight_column=WEIGHT_COLUMN_NAME,\n", |
251 | 252 | " hidden_units=[100, 70, 50] ,\n", |
252 | 253 | " dropout=0.2,\n", |
253 | 254 | " batch_norm=True,\n", |
|
277 | 278 | }, |
278 | 279 | { |
279 | 280 | "cell_type": "code", |
280 | | - "execution_count": 104, |
| 281 | + "execution_count": 24, |
281 | 282 | "metadata": {}, |
282 | 283 | "outputs": [], |
283 | 284 | "source": [ |
284 | 285 | "def make_input_fn(file_pattern, batch_size, num_epochs, shuffle=False):\n", |
285 | 286 | " \n", |
286 | 287 | " def _input_fn():\n", |
287 | | - " dataset = tf.contrib.data.make_csv_dataset(\n", |
| 288 | + " dataset = tf.data.experimental.make_csv_dataset(\n", |
288 | 289 | " file_pattern=file_pattern,\n", |
289 | 290 | " batch_size=batch_size,\n", |
290 | 291 | " column_names=HEADER,\n", |
|
317 | 318 | }, |
318 | 319 | { |
319 | 320 | "cell_type": "code", |
320 | | - "execution_count": 105, |
| 321 | + "execution_count": 25, |
321 | 322 | "metadata": {}, |
322 | 323 | "outputs": [], |
323 | 324 | "source": [ |
|
344 | 345 | }, |
345 | 346 | { |
346 | 347 | "cell_type": "code", |
347 | | - "execution_count": 85, |
| 348 | + "execution_count": 26, |
348 | 349 | "metadata": {}, |
349 | 350 | "outputs": [], |
350 | 351 | "source": [ |
|
383 | 384 | }, |
384 | 385 | { |
385 | 386 | "cell_type": "code", |
386 | | - "execution_count": 86, |
| 387 | + "execution_count": 27, |
387 | 388 | "metadata": {}, |
388 | 389 | "outputs": [ |
389 | 390 | { |
|
392 | 393 | "text": [ |
393 | 394 | "Removing previous artefacts...\n", |
394 | 395 | "\n", |
395 | | - "INFO:tensorflow:Using config: {'_save_checkpoints_secs': 600, '_global_id_in_cluster': 0, '_session_config': None, '_keep_checkpoint_max': 5, '_tf_random_seed': 19831006, '_task_type': 'worker', '_train_distribute': None, '_is_chief': True, '_cluster_spec': <tensorflow.python.training.server_lib.ClusterSpec object at 0x11fb97150>, '_model_dir': 'models/census/dnn_classifier', '_num_worker_replicas': 1, '_task_id': 0, '_log_step_count_steps': 100, '_master': '', '_save_checkpoints_steps': None, '_keep_checkpoint_every_n_hours': 10000, '_evaluation_master': '', '_service': None, '_device_fn': None, '_save_summary_steps': 100, '_num_ps_replicas': 0}\n", |
| 396 | + "INFO:tensorflow:Using config: {'_save_checkpoints_secs': 600, '_session_config': allow_soft_placement: true\n", |
| 397 | + "graph_options {\n", |
| 398 | + " rewrite_options {\n", |
| 399 | + " meta_optimizer_iterations: ONE\n", |
| 400 | + " }\n", |
| 401 | + "}\n", |
| 402 | + ", '_keep_checkpoint_max': 5, '_task_type': 'worker', '_train_distribute': None, '_is_chief': True, '_cluster_spec': <tensorflow.python.training.server_lib.ClusterSpec object at 0x10ca58ed0>, '_model_dir': 'models/census/dnn_classifier', '_protocol': None, '_save_checkpoints_steps': None, '_keep_checkpoint_every_n_hours': 10000, '_service': None, '_num_ps_replicas': 0, '_tf_random_seed': 19831060, '_save_summary_steps': 100, '_device_fn': None, '_experimental_distribute': None, '_num_worker_replicas': 1, '_task_id': 0, '_log_step_count_steps': 100, '_evaluation_master': '', '_eval_distribute': None, '_global_id_in_cluster': 0, '_master': ''}\n", |
396 | 403 | "\n", |
397 | | - "Experiment started at 16:33:38\n", |
| 404 | + "Experiment started at 16:52:35\n", |
398 | 405 | ".......................................\n", |
399 | 406 | "INFO:tensorflow:Calling model_fn.\n", |
400 | 407 | "INFO:tensorflow:Done calling model_fn.\n", |
|
403 | 410 | "INFO:tensorflow:Running local_init_op.\n", |
404 | 411 | "INFO:tensorflow:Done running local_init_op.\n", |
405 | 412 | "INFO:tensorflow:Saving checkpoints for 0 into models/census/dnn_classifier/model.ckpt.\n", |
406 | | - "INFO:tensorflow:loss = 165.60706, step = 1\n", |
407 | | - "INFO:tensorflow:global_step/sec: 74.3614\n", |
408 | | - "INFO:tensorflow:loss = 74.62894, step = 101 (1.344 sec)\n", |
409 | | - "INFO:tensorflow:global_step/sec: 166.275\n", |
410 | | - "INFO:tensorflow:loss = 70.498184, step = 201 (0.601 sec)\n", |
411 | | - "INFO:tensorflow:global_step/sec: 166.44\n", |
412 | | - "INFO:tensorflow:loss = 66.00288, step = 301 (0.602 sec)\n", |
413 | | - "INFO:tensorflow:global_step/sec: 135.288\n", |
414 | | - "INFO:tensorflow:loss = 72.86255, step = 401 (0.738 sec)\n", |
415 | | - "INFO:tensorflow:global_step/sec: 127.645\n", |
416 | | - "INFO:tensorflow:loss = 72.79736, step = 501 (0.784 sec)\n", |
417 | | - "INFO:tensorflow:global_step/sec: 131.001\n", |
418 | | - "INFO:tensorflow:loss = 75.737885, step = 601 (0.763 sec)\n", |
419 | | - "INFO:tensorflow:global_step/sec: 132.392\n", |
420 | | - "INFO:tensorflow:loss = 51.82579, step = 701 (0.756 sec)\n", |
421 | | - "INFO:tensorflow:global_step/sec: 120.433\n", |
422 | | - "INFO:tensorflow:loss = 66.95524, step = 801 (0.830 sec)\n", |
423 | | - "INFO:tensorflow:global_step/sec: 112.34\n", |
424 | | - "INFO:tensorflow:loss = 61.824047, step = 901 (0.890 sec)\n", |
| 413 | + "INFO:tensorflow:loss = 31132416.0, step = 1\n", |
| 414 | + "INFO:tensorflow:global_step/sec: 82.2509\n", |
| 415 | + "INFO:tensorflow:loss = 12670475.0, step = 101 (1.218 sec)\n", |
| 416 | + "INFO:tensorflow:global_step/sec: 169.578\n", |
| 417 | + "INFO:tensorflow:loss = 11341477.0, step = 201 (0.590 sec)\n", |
| 418 | + "INFO:tensorflow:global_step/sec: 177.614\n", |
| 419 | + "INFO:tensorflow:loss = 12852321.0, step = 301 (0.563 sec)\n", |
| 420 | + "INFO:tensorflow:global_step/sec: 163.928\n", |
| 421 | + "INFO:tensorflow:loss = 13684520.0, step = 401 (0.610 sec)\n", |
| 422 | + "INFO:tensorflow:global_step/sec: 169.234\n", |
| 423 | + "INFO:tensorflow:loss = 12090486.0, step = 501 (0.591 sec)\n", |
| 424 | + "INFO:tensorflow:global_step/sec: 187.021\n", |
| 425 | + "INFO:tensorflow:loss = 13600504.0, step = 601 (0.534 sec)\n", |
| 426 | + "INFO:tensorflow:global_step/sec: 167.494\n", |
| 427 | + "INFO:tensorflow:loss = 14767286.0, step = 701 (0.597 sec)\n", |
| 428 | + "INFO:tensorflow:global_step/sec: 145.886\n", |
| 429 | + "INFO:tensorflow:loss = 10702760.0, step = 801 (0.685 sec)\n", |
| 430 | + "INFO:tensorflow:global_step/sec: 153.083\n", |
| 431 | + "INFO:tensorflow:loss = 13668747.0, step = 901 (0.654 sec)\n", |
425 | 432 | "INFO:tensorflow:Saving checkpoints for 1000 into models/census/dnn_classifier/model.ckpt.\n", |
426 | | - "INFO:tensorflow:Loss for final step: 68.06041.\n", |
| 433 | + "INFO:tensorflow:Loss for final step: 14524872.0.\n", |
427 | 434 | ".......................................\n", |
428 | | - "Experiment finished at 16:33:52\n", |
| 435 | + "Experiment finished at 16:52:47\n", |
429 | 436 | "\n", |
430 | | - "Experiment elapsed time: 13.688361 seconds\n" |
| 437 | + "Experiment elapsed time: 12.109969 seconds\n" |
431 | 438 | ] |
432 | 439 | }, |
433 | 440 | { |
434 | 441 | "data": { |
435 | 442 | "text/plain": [ |
436 | | - "<tensorflow.python.estimator.canned.dnn.DNNClassifier at 0x116d262d0>" |
| 443 | + "<tensorflow.python.estimator.canned.dnn.DNNClassifier at 0x105902610>" |
437 | 444 | ] |
438 | 445 | }, |
439 | | - "execution_count": 86, |
| 446 | + "execution_count": 27, |
440 | 447 | "metadata": {}, |
441 | 448 | "output_type": "execute_result" |
442 | 449 | } |
|
0 commit comments