teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

プログラムの修正

2019/09/30 08:09

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -13,16 +13,6 @@
13
13
  ### 該当のソースコード
14
14
 
15
15
  ```python
16
- import numpy as np
17
- import pandas as pd
18
- from pandas import DataFrame
19
- from sklearn.model_selection import train_test_split
20
- from keras.layers.core import Dense, Activation
21
- from keras.models import Sequential, load_model
22
- from keras.optimizers import SGD
23
- import matplotlib.pyplot as plt
24
- import csv
25
-
26
16
  data = pd.read_csv('SPSS.csv', sep=",", header=0)
27
17
 
28
18
  train_size = 0.7
@@ -89,38 +79,10 @@
89
79
  for i, row in zip(index, l):
90
80
  w.writerow([i] + row)
91
81
 
92
- graph_name = 'epochs:' + 'epochs'
93
- plot_everytime = True
94
82
 
95
- def plot_show_close():
96
- global plot_everytime
97
- if plot_everytime:
98
- plt.show()
99
- plt.close()
100
-
101
83
  def plot_acc():
102
- plt.rc('font', family='serif')
103
- plt.plot(hist_acc_t)
104
- plt.plot(hist_acc_v)
105
- plt.title('Accuracy ({})'.format(graph_name))
106
- plt.xlabel('epoch')
107
- plt.ylabel('accuracy')
108
- plt.legend(['acc', 'val_acc'], loc='lower right')
109
- plt.savefig('G_Acc' + '.png', dpi=300)
110
- plt.savefig('G_Acc' + '.eps')
111
- plot_show_close()
112
84
 
113
85
  def plot_loss():
114
- plt.rc('font', family='serif')
115
- plt.plot(hist_loss_t)
116
- plt.plot(hist_loss_v)
117
- plt.title('Loss ({})'.format(graph_name))
118
- plt.xlabel('epoch')
119
- plt.ylabel('loss')
120
- plt.legend(['loss', 'val_loss'], loc='upper right')
121
- plt.savefig('G_Loss' + '.png', dpi=300)
122
- plt.savefig('G_Loss' + '.eps')
123
- plot_show_close()
124
86
 
125
87
  plot_acc()
126
88
  plot_loss()

1

プログラムの修正

2019/09/30 08:09

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -80,13 +80,6 @@
80
80
 
81
81
  acc = hist.history['acc']
82
82
  loss = hist.history['loss']
83
- '''
84
- plt.rc('font', family='serif')
85
- fig = plt.figure()
86
- plt.plot(range(epochs), acc, label='acc', color='black')
87
- plt.xlabel('epochs')
88
- plt.show()
89
- '''
90
83
 
91
84
  index = ['acc_t', 'acc_v', 'loss_t', 'loss_v']
92
85
  l = [hist_acc_t, hist_acc_v, hist_loss_t, hist_loss_v]