diff --git a/Qfunctions/__pycache__/loaData.cpython-312.pyc b/Qfunctions/__pycache__/loaData.cpython-312.pyc index 7439bfb..da10d4c 100644 Binary files a/Qfunctions/__pycache__/loaData.cpython-312.pyc and b/Qfunctions/__pycache__/loaData.cpython-312.pyc differ diff --git a/Qfunctions/loaData.py b/Qfunctions/loaData.py index 5d7272e..0646adf 100644 --- a/Qfunctions/loaData.py +++ b/Qfunctions/loaData.py @@ -61,6 +61,12 @@ def load_xlsx(fileName, labelName, max_row_length = 1000, fill_rule = None): # 提取偶数列 features = df.iloc[0:, 1::2] + # 计算变化率 + first_value = features.iloc[0, :] # 获取第一行的数据 + features_pct_change = (features - first_value) / first_value + + features = features_pct_change + features.dropna(inplace=True) features.reset_index(drop=True, inplace=True) diff --git a/main.py b/main.py index bcfdbb2..7f968e5 100644 --- a/main.py +++ b/main.py @@ -11,7 +11,7 @@ def main(): label_names =["Accuracy", "Compress", "Distance", "Loss", "Metal", "Python"] data = dLoader(projet_name, label_names, isDir=False) X_train, X_test, y_train, y_test, encoder = divSet( - data=data, labels=label_names, test_size= 0.5 + data=data, labels=label_names, test_size= 0.2 ) print(y_train) @@ -35,20 +35,20 @@ def main(): - # model = Qmlp( - # X_train=X_train, X_test=X_test, y_train=y_train, y_test= y_test, - # hidden_layers=[32, 32, 32], - # dropout_rate=0 - # ) - # model.fit(100) + model = Qmlp( + X_train=X_train, X_test=X_test, y_train=y_train, y_test= y_test, + hidden_layers=[64, 64], + dropout_rate=0 + ) + model.fit(100) - # cm = model.get_cm() - # epoch_data = model.get_epoch_data() + cm = model.get_cm() + epoch_data = model.get_epoch_data() - # from Qfunctions.saveToxlsx import save_to_xlsx as stx - # stx(project_name=projet_name, file_name="cm", data=cm) - # stx(project_name=projet_name, file_name="acc_and_loss", data=epoch_data) - # print("Done") + from Qfunctions.saveToxlsx import save_to_xlsx as stx + stx(project_name=projet_name, file_name="cm", data=cm) + stx(project_name=projet_name, file_name="acc_and_loss", data=epoch_data) + print("Done") if __name__ == '__main__': main()