Plot Nested K-fold Cross Validation
In [28]:
Copied!
import numpy as np
import os
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
# Default settings
mpl.rcParams.update(mpl.rcParamsDefault)
# plt.style.use('science')
plt.style.use("seaborn-darkgrid")
plt.rcParams.update({'font.size': 12})
import numpy as np
import os
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
# Default settings
mpl.rcParams.update(mpl.rcParamsDefault)
# plt.style.use('science')
plt.style.use("seaborn-darkgrid")
plt.rcParams.update({'font.size': 12})
C:\Users\dicky1031\AppData\Local\Temp\ipykernel_27368\1340097018.py:9: MatplotlibDeprecationWarning: The seaborn styles shipped by Matplotlib are deprecated since 3.6, as they no longer correspond to the styles shipped by seaborn. However, they will remain available as 'seaborn-v0_8-<style>'. Alternatively, directly use the seaborn API instead. plt.style.use("seaborn-darkgrid")
In [8]:
Copied!
data = pd.read_csv(os.path.join('model_save', 'prediction_model_formula8', 'all_result.csv'))
data = pd.read_csv(os.path.join('model_save', 'prediction_model_formula8', 'all_result.csv'))
Out[8]:
out_fold_idx | in_fold_idx | hp_idx | neuron | learning_rate | batch_size | test_loss | |
---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 5 | 0.00010 | 512 | 0.000070 |
1 | 0 | 0 | 1 | 3 | 0.00010 | 512 | 0.000074 |
2 | 0 | 0 | 2 | 1 | 0.00010 | 512 | 0.000112 |
3 | 0 | 0 | 3 | 5 | 0.00005 | 512 | 0.000074 |
4 | 0 | 0 | 4 | 3 | 0.00005 | 512 | 0.000082 |
... | ... | ... | ... | ... | ... | ... | ... |
675 | 4 | 4 | 23 | 1 | 0.00005 | 128 | 0.000087 |
676 | 4 | 4 | 24 | 5 | 0.00003 | 128 | 0.000060 |
677 | 4 | 4 | 25 | 3 | 0.00003 | 128 | 0.000072 |
678 | 4 | 4 | 26 | 1 | 0.00003 | 128 | 0.000112 |
679 | 4 | 4 | 26 | 1 | 0.00003 | 128 | 0.000051 |
680 rows × 7 columns
In [34]:
Copied!
plt.figure(figsize=(8,6))
plt.plot(sorted(data['test_loss'].to_list())[:-3])
plt.xlabel("hyperparameter set #")
plt.ylabel("loss")
plt.savefig(os.path.join("pic", 'prediction_model_formula8', "nested-k-fold-cross-validation.png"), dpi=300, format='png', bbox_inches='tight')
plt.show()
plt.figure(figsize=(8,6))
plt.plot(sorted(data['test_loss'].to_list())[:-3])
plt.xlabel("hyperparameter set #")
plt.ylabel("loss")
plt.savefig(os.path.join("pic", 'prediction_model_formula8', "nested-k-fold-cross-validation.png"), dpi=300, format='png', bbox_inches='tight')
plt.show()
In [32]:
Copied!
hyper_set = pd.read_csv(os.path.join('model_save', 'prediction_model_formula8', 'hyper_set.csv'))
hyper_set
hyper_set = pd.read_csv(os.path.join('model_save', 'prediction_model_formula8', 'hyper_set.csv'))
hyper_set
Out[32]:
hp_idx | batch_size | learning_rate | neuron | |
---|---|---|---|---|
0 | 0 | 512 | 0.00010 | 5 |
1 | 1 | 512 | 0.00010 | 3 |
2 | 2 | 512 | 0.00010 | 1 |
3 | 3 | 512 | 0.00005 | 5 |
4 | 4 | 512 | 0.00005 | 3 |
5 | 5 | 512 | 0.00005 | 1 |
6 | 6 | 512 | 0.00003 | 5 |
7 | 7 | 512 | 0.00003 | 3 |
8 | 8 | 512 | 0.00003 | 1 |
9 | 9 | 256 | 0.00010 | 5 |
10 | 10 | 256 | 0.00010 | 3 |
11 | 11 | 256 | 0.00010 | 1 |
12 | 12 | 256 | 0.00005 | 5 |
13 | 13 | 256 | 0.00005 | 3 |
14 | 14 | 256 | 0.00005 | 1 |
15 | 15 | 256 | 0.00003 | 5 |
16 | 16 | 256 | 0.00003 | 3 |
17 | 17 | 256 | 0.00003 | 1 |
18 | 18 | 128 | 0.00010 | 5 |
19 | 19 | 128 | 0.00010 | 3 |
20 | 20 | 128 | 0.00010 | 1 |
21 | 21 | 128 | 0.00005 | 5 |
22 | 22 | 128 | 0.00005 | 3 |
23 | 23 | 128 | 0.00005 | 1 |
24 | 24 | 128 | 0.00003 | 5 |
25 | 25 | 128 | 0.00003 | 3 |
26 | 26 | 128 | 0.00003 | 1 |