Accuracy_Data = list()
Accuracy = KNN(features_train, features_test, label_train, label_test)
print("KNN algorithm:", str(Accuracy * 100),"%")
Accuracy = DecisionTree(features_train, features_test, label_train, label_test)
print("Decision Tree:", str(Accuracy * 100,"%")
Accuracy = SVM(features_train, features_test, label_train, label_test)
print("The accuracy of SVM algorithm is", str(Accuracy * 100,"%"), "%")
Accuracy = GNB(features_train, features_test, label_train, label_test)
print("The accuracy of Gaussian Naive Bayes is", str(Accuracy * 100,"%"), "%")
Accuracy = RFC(features_train, features_test, label_train, label_test)
print("The accuracy of Random Forest is", str(Accuracy * 100,"%"), "%")
Accuracy = ADC(features_train, features_test, label_train, label_test)
print("The accuracy of Ada Boost Classifier is", str(Accuracy * 100,"%"), "%")
for x in Accuracy:
Accuracy_Data.append(x)
我的精度值是从不同的函数返回的,我希望列表(Accuracy_Data)收集每个精度值,而不需要更改每个精度值的变量名,然后将它们添加到列表中。
3条答案
按热度按时间s3fp2yjn1#
据我所知,你可以试试这样的方法:
等等。
3okqufwl2#
你可以在调用函数Accuracy_Data之后,将Accuracy附加到Accuracy_Data中。
mlnl4t2r3#
你知道装饰图案吗?
我认为你应该试试类似的例子:
返回:
["1 2 3"、"1 - 2 - 3"、"1 = 2 = 3"]