@@ -62,16 +62,10 @@ df.head()
6262
6363 Shape of dataset: (4177, 11)
6464
65- | :--------:| :----------:| :--------:| :--------------:| :----------------:| :----------------:| :--------------:| :-------:| :-------:| :-------:| :-------:|
66- | Length | Diameter | Height | Whole weight | Shucked weight | Viscera weight | Shell weight | Rings | Sex_F | Sex_I | Sex_M |
67- | :--------:| :----------:| :--------:| :--------------:| :----------------:| :----------------:| :--------------:| :-------:| :-------:| :-------:| :-------:|
68- | 0.455 | 0.365 | 0.095 | 0.514 | 0.2245 | 0.101 | 0.15 | 15 | 0 | 0 | 1 |
69- | 0.35 | 0.265 | 0.09 | 0.2255 | 0.0995 | 0.0485 | 0.07 | 7 | 0 | 0 | 1 |
70- | 0.53 | 0.42 | 0.135 | 0.677 | 0.2565 | 0.1415 | 0.21 | 9 | 1 | 0 | 0 |
71- | 0.44 | 0.365 | 0.125 | 0.516 | 0.2155 | 0.114 | 0.155 | 10 | 0 | 0 | 1 |
72- | 0.33 | 0.255 | 0.08 | 0.205 | 0.0895 | 0.0395 | 0.055 | 7 | 0 | 1 | 0 |
73-
74- <br >
65+ <img class =" img-fluid rounded z-depth-1 " src =" {{ site.baseurl }}/assets/ex_plots/04_tensorflow_dataset_table.png " data-zoomable width =800px style =" padding-top : 20px ; padding-right : 20px ; padding-bottom : 20px ; padding-left : 20px " >
66+ <div class =" caption " >
67+ Figure 1: Overview of the abalone dataset.
68+ </div >
7569
7670Next, let's split the dataset into a train and test set.
7771
@@ -309,7 +303,7 @@ plot_history(history_file='history_log.csv', title="Training overview")
309303```
310304<img class =" img-fluid rounded z-depth-1 " src =" {{ site.baseurl }}/assets/ex_plots/04_tensorflow_training_history.png " data-zoomable width =800px style =" padding-top : 20px ; padding-right : 20px ; padding-bottom : 20px ; padding-left : 20px " >
311305<div class =" caption " >
312- Figure 1 : Training progress showing loss and Mean Absolute Error (MAE) metrics over epochs. The logarithmic scale helps visualize improvements across different orders of magnitude.
306+ Figure 2 : Training progress showing loss and Mean Absolute Error (MAE) metrics over epochs. The logarithmic scale helps visualize improvements across different orders of magnitude.
313307</div >
314308
315309## Analyzing Model Performance
@@ -582,28 +576,38 @@ for gixd in grid_idx:
582576 print (f " \t Model Parameters: { model.count_params()} \n\n " )
583577```
584578
585- Exploring: {'use_batch': False, 'optimizers': 'sgd', 'learning_rate': 0.0001, 'kernel_regularizer': None, 'kernel_init': 'glorot_uniform', 'hidden': [8], 'dropout_rate': 0, 'batch_size': 128, 'activation': 'selu'}
579+ Exploring: {'use_batch': False, 'optimizers': 'sgd', 'learning_rate': 0.0001,
580+ 'kernel_regularizer': None, 'kernel_init': 'glorot_uniform', 'hidden': [8],
581+ 'dropout_rate': 0, 'batch_size': 128, 'activation': 'selu'}
586582 Train - Loss: 5.294 | MAE: 1.643
587583 Test - Loss: 7.148 | MAE: 1.807
588584 Model Parameters: 118
589585
590- Exploring: {'use_batch': False, 'optimizers': 'sgd', 'learning_rate': 0.001, 'kernel_regularizer': None, 'kernel_init': 'glorot_uniform', 'hidden': [8, 4], 'dropout_rate': 0.5, 'batch_size': 128, 'activation': 'tanh'}
586+ Exploring: {'use_batch': False, 'optimizers': 'sgd', 'learning_rate': 0.001,
587+ 'kernel_regularizer': None, 'kernel_init': 'glorot_uniform', 'hidden': [8, 4],
588+ 'dropout_rate': 0.5, 'batch_size': 128, 'activation': 'tanh'}
591589 Train - Loss: 5.290 | MAE: 1.583
592590 Test - Loss: 6.250 | MAE: 1.730
593591 Model Parameters: 150
594592
595- Exploring: {'use_batch': True, 'optimizers': 'sgd', 'learning_rate': 0.0001, 'kernel_regularizer': None, 'kernel_init': 'uniform', 'hidden': [8, 4], 'dropout_rate': 0.5, 'batch_size': 32, 'activation': 'relu'}
593+ Exploring: {'use_batch': True, 'optimizers': 'sgd', 'learning_rate': 0.0001,
594+ 'kernel_regularizer': None, 'kernel_init': 'uniform', 'hidden': [8, 4],
595+ 'dropout_rate': 0.5, 'batch_size': 32, 'activation': 'relu'}
596596 Epoch 195: early stopping
597597 Train - Loss: 8.660 | MAE: 2.050
598598 Test - Loss: 10.039 | MAE: 2.144
599599 Model Parameters: 222
600600
601- Exploring: {'use_batch': True, 'optimizers': 'rmsprop', 'learning_rate': 0.0001, 'kernel_regularizer': None, 'kernel_init': 'he_uniform', 'hidden': [8, 16, 8], 'dropout_rate': 0.5, 'batch_size': 128, 'activation': 'tanh'}
601+ Exploring: {'use_batch': True, 'optimizers': 'rmsprop', 'learning_rate': 0.0001,
602+ 'kernel_regularizer': None, 'kernel_init': 'he_uniform', 'hidden': [8, 16, 8],
603+ 'dropout_rate': 0.5, 'batch_size': 128, 'activation': 'tanh'}
602604 Train - Loss: 24.535 | MAE: 3.957
603605 Test - Loss: 26.605 | MAE: 4.079
604606 Model Parameters: 534
605607
606- Exploring: {'use_batch': False, 'optimizers': 'adam', 'learning_rate': 0.0001, 'kernel_regularizer': 'l2', 'kernel_init': 'glorot_uniform', 'hidden': [8, 16, 8], 'dropout_rate': 0.5, 'batch_size': 128, 'activation': 'selu'}
608+ Exploring: {'use_batch': False, 'optimizers': 'adam', 'learning_rate': 0.0001,
609+ 'kernel_regularizer': 'l2', 'kernel_init': 'glorot_uniform', 'hidden': [8, 16, 8],
610+ 'dropout_rate': 0.5, 'batch_size': 128, 'activation': 'selu'}
607611 Train - Loss: 6.947 | MAE: 1.715
608612 Test - Loss: 8.042 | MAE: 1.851
609613 Model Parameters: 398
@@ -643,16 +647,10 @@ results = pd.concat(results).reset_index(drop=True).sort_values('loss_te')
643647results
644648```
645649
646- | :-----------:| :------------:| :---------------:| :--------------------:| :--------------:| :----------:| :--------------:| :------------:| :------------:| :---------:| :--------:| :---------:| :--------:| :-----:|
647- | use_batch | optimizers | learning_rate | kernel_regularizer | kernel_init | hidden | dropout_rate | batch_size | activation | loss_tr | MAE_tr | loss_te | MAE_te | idx |
648- | :-----------:| :------------:| :---------------:| :--------------------:| :--------------:| :----------:| :--------------:| :------------:| :------------:| :---------:| :--------:| :---------:| :--------:| :-----:|
649- | False | sgd | 0.001 | | glorot_uniform | [ 8, 4] | 0.5 | 128 | tanh | 5.2905 | 1.58287 | 6.25027 | 1.73029 | 13396 |
650- | False | sgd | 0.0001 | | glorot_uniform | [ 8] | 0 | 128 | selu | 5.2939 | 1.64328 | 7.14837 | 1.8074 | 8794 |
651- | False | adam | 0.0001 | l2 | glorot_uniform | [ 8, 16, 8] | 0.5 | 128 | selu | 6.94665 | 1.71511 | 8.04218 | 1.85146 | 10254 |
652- | True | sgd | 0.0001 | | uniform | [ 8, 4] | 0.5 | 32 | relu | 8.65953 | 2.05007 | 10.0391 | 2.14398 | 1355 |
653- | True | rmsprop | 0.0001 | | he_uniform | [ 8, 16, 8] | 0.5 | 128 | tanh | 24.535 | 3.95683 | 26.6054 | 4.07911 | 13593 |
654-
655- <br >
650+ <img class =" img-fluid rounded z-depth-1 " src =" {{ site.baseurl }}/assets/ex_plots/04_tensorflow_results_table.png " data-zoomable width =800px style =" padding-top : 20px ; padding-right : 20px ; padding-bottom : 20px ; padding-left : 20px " >
651+ <div class =" caption " >
652+ Figure 5: Results table for the best performing model architecture, showing both loss and MAE on training and validation sets. The consistent convergence suggests stable learning without overfitting.
653+ </div >
656654
657655From this table, you could now perform a multitude of follow-up investigations. For example, take a look at the
658656loss evolution during training:
@@ -670,7 +668,7 @@ plot_history(history_file=history_file, title="Training overview of best model")
670668
671669<img class =" img-fluid rounded z-depth-1 " src =" {{ site.baseurl }}/assets/ex_plots/04_tensorflow_architecture_comparison.png " data-zoomable width =800px style =" padding-top : 20px ; padding-right : 20px ; padding-bottom : 20px ; padding-left : 20px " >
672670<div class =" caption " >
673- Figure 2 : Training metrics for the best performing model architecture, showing both loss and MAE on training and validation sets. The consistent convergence suggests stable learning without overfitting.
671+ Figure 4 : Training metrics for the best performing model architecture, showing both loss and MAE on training and validation sets. The consistent convergence suggests stable learning without overfitting.
674672</div >
675673
676674### Advanced Deep Learning Pitfalls
0 commit comments