change for Sound

This commit is contained in:
newbie 2024-10-07 10:06:20 +08:00
parent 884db9b926
commit 49910f430c
3 changed files with 19 additions and 13 deletions

View File

@ -61,6 +61,12 @@ def load_xlsx(fileName, labelName, max_row_length = 1000, fill_rule = None):
# 提取偶数列 # 提取偶数列
features = df.iloc[0:, 1::2] 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.dropna(inplace=True)
features.reset_index(drop=True, inplace=True) features.reset_index(drop=True, inplace=True)

26
main.py
View File

@ -11,7 +11,7 @@ def main():
label_names =["Accuracy", "Compress", "Distance", "Loss", "Metal", "Python"] label_names =["Accuracy", "Compress", "Distance", "Loss", "Metal", "Python"]
data = dLoader(projet_name, label_names, isDir=False) data = dLoader(projet_name, label_names, isDir=False)
X_train, X_test, y_train, y_test, encoder = divSet( 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) print(y_train)
@ -35,20 +35,20 @@ def main():
# model = Qmlp( model = Qmlp(
# X_train=X_train, X_test=X_test, y_train=y_train, y_test= y_test, X_train=X_train, X_test=X_test, y_train=y_train, y_test= y_test,
# hidden_layers=[32, 32, 32], hidden_layers=[64, 64],
# dropout_rate=0 dropout_rate=0
# ) )
# model.fit(100) model.fit(100)
# cm = model.get_cm() cm = model.get_cm()
# epoch_data = model.get_epoch_data() epoch_data = model.get_epoch_data()
# from Qfunctions.saveToxlsx import save_to_xlsx as stx 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="cm", data=cm)
# stx(project_name=projet_name, file_name="acc_and_loss", data=epoch_data) stx(project_name=projet_name, file_name="acc_and_loss", data=epoch_data)
# print("Done") print("Done")
if __name__ == '__main__': if __name__ == '__main__':
main() main()