class Ui_MainWindow的某个代码段
def massage(self):
print("按了啊")
dir_choose, filetype = QFileDialog.getOpenFileName(self.model, "选取文件", "./", "All Files (*);;Excel Files (*.xls)")
# 起始路径
if dir_choose == "":
print("\n取消选择")
return
print("\n你选择的文件夹为:")
print(dir_choose)
self.model.setText(dir_choose)
adaboost = Adaboosting()
result=adaboost.demo(dir_choose)
self.text1.setText("训练完成")
self.model_result.setText(result)
然后调用另一个类class Adaboosting的方法
def demo(result):
print("已进入到了内部函数")
# result="text1.txt"
from my_adaboosting_SVM_ROC import loadDataSet
dataArr, LabelArr = loadDataSet(result)
from my_adaboosting_SVM_ROC import adaBoostTrainDS
weakClassArr, aggClassEst = adaBoostTrainDS(dataArr, LabelArr)
from my_adaboosting_SVM_ROC import adaClassify
predictions = adaClassify(dataArr, weakClassArr)
errArr = np.mat(np.ones((len(dataArr), 1)))
number=float(errArr[predictions != np.mat(LabelArr).T].sum() / len(dataArr) * 100)
print('训练集的错误率:%.3f%%' % float(errArr[predictions != np.mat(LabelArr).T].sum() / len(dataArr) * 100))
return number
但是这两类之间传值没实现,报错如下
Process finished with exit code -1073740791 (0xC0000409)