def DataConv_click(): inputPath = __filePath__(txtConv_1.get()) learnPath = __filePath__(txtConv_2.get()) testPath = __filePath__(txtConv_3.get()) digit = str(10**-int(txtConv_4.get())) io = csvIO() v = io.open_twoD_array(inputPath) v = io.twoD_FroatToStr(v, digit=digit) l_array = io.Get_AnytwoD_array(v, col_range_end=3) t_array = io.Get_AnytwoD_array(v, col_range_first=4, col_range_end=7) io.csv_write(learnPath, l_array) io.csv_write(testPath, t_array)
def DataInput(): xPath = __filePath__(txt_6.get()) tPath = __filePath__(txt_7.get()) io = csvIO() x = io.open_twoD_array(xPath) t = io.open_twoD_array(tPath) x = io.twoD_FroatToStr(x, digit=0.01) t = io.twoD_FroatToStr(t, digit=0.01) x = io.twoD_Numpy(x) t = io.twoD_Numpy(t) print('読み込みに成功') return x, t
# cording: utf-8 import sys, os sys.path.append(os.getcwd()) from common.squential import * from common.layers import * from common.csvIO import csvIO import matplotlib.pyplot as plt # データを読み込む io = csvIO() learn_file = io.open_twoD_array('./data/learn.csv') test_file = io.open_twoD_array('./data/test.csv') learn_data = io.twoD_Numpy(learn_file) test_data = io.twoD_Numpy(test_file) model = Sequential() model.add(InputLayer(input_shape=(3, ))) #3, 128 model.add(Dense(50, activation='sigmoid', weight_initializer='sigmoid')) model.add(Dense(50, activation='sigmoid', weight_initializer='sigmoid')) model.add(Dense(3, activation='linear')) model.compile(loss='mean_squared_error', optimizer='sgd', metrics=['accuracy']) #学習 epochs = 20 batch_size = 128 history = model.fit(learn_data, test_data, batch_size, epochs) print(history['loss'])