def run(self):
     similar = similarityRUL.similarity()
     result = similar.test(self.n_flights, self.test_set, self.RUL_set)
     self.result_signal.emit(result)
    def operate_algorithm(self):
        self.algorithm = self.choose_algorithm.currentText()
        self.data = self.choose_data.currentText()

        if (self.algorithm != "相似模型" and self.data == "训练数据"):
            if (self.name == -1):
                self.error_output.clear()
                self.show_error("请先选择文件,再点击运行")
            elif (self.name != 1 and self.name != 2 and self.name != 3
                  and self.name != 4):
                self.error_output.clear()
                self.show_error("文件名字有误,无法判断数据形式")
            else:
                self.error_output.clear()
                self.output_widget.clear()
                self.show_message("testing...")
                lstm = convLSTM.ConvLSTM()
                if (self.algorithm[-1] == 'D'):
                    self.result = lstm.test(self.name, self.algorithm[:-3], 1)
                else:
                    self.result = lstm.test(self.name, self.algorithm, 0)
                self.output_widget.clear()
                self.show_message(self.result)
                if (self.algorithm[-1] == 'D'):
                    lstm.draw_image(self.name, self.algorithm[:-3], 1)
                else:
                    lstm.draw_image(self.name, self.algorithm, 0)
                self.output_figure.setPixmap(
                    QPixmap("./result_img/FD00" + str(self.name) + "_" +
                            self.algorithm + ".png"))

        elif (self.algorithm != "相似模型" and self.data == "真实数据"):
            if (self.name == -1):
                self.error_output.clear()
                self.show_error("请先选择文件,再点击运行")
            elif (self.name != 1 and self.name != 2 and self.name != 3
                  and self.name != 4):
                self.error_output.clear()
                self.show_error("文件名字有误,无法判断数据形式")
            else:
                self.error_output.clear()
                self.output_widget.clear()
                self.show_message("predicting...")
                lstm = convLSTM.ConvLSTM()
                if (self.algorithm[-1] == 'D'):
                    self.result = lstm.real(self.name, self.algorithm[:-3], 1)
                else:
                    self.result = lstm.real(self.name, self.algorithm, 0)
                self.output_widget.clear()
                self.show_message(self.result)

        elif (self.algorithm == "相似模型" and self.data == "训练数据"):
            if (self.name == -1):
                self.error_output.clear()
                self.show_error("请先选择文件,再点击运行")
            elif (self.name != 1 and self.name != 2 and self.name != 3
                  and self.name != 4):
                self.error_output.clear()
                self.show_error("文件名字有误,无法判断数据形式")
            elif (self.name == 3 or self.name == 4):
                self.error_output.clear()
                self.show_error("该数据集不适合用相似匹配法进行预测!")
            else:
                self.error_output.clear()
                self.output_widget.clear()
                self.show_message("testing...")
                # similar = similarityRUL.similarity()
                if (self.name == 1):
                    n_flights = 100
                else:
                    n_flights = 259
                test_set = self.path
                RUL_set = "./datafolder/RUL_FD00" + str(self.name) + ".txt"
                # self.result = similar.test(n_flights, test_set, RUL_set)
                self.SimilarTrain = SimilarTrainThread(n_flights, test_set,
                                                       RUL_set)
                self.SimilarTrain.result_signal.connect(
                    self.SimilarTrainOutput)
                self.SimilarTrain.start()
                # print(type(self.result))

        elif (self.algorithm == "相似模型" and self.data == "真实数据"):
            if (self.name == -1):
                self.error_output.clear()
                self.show_error("请先选择文件,再点击运行")
            elif (self.name != 1 and self.name != 2 and self.name != 3
                  and self.name != 4):
                self.error_output.clear()
                self.show_error("文件名字有误,无法判断数据形式")
            elif (self.name == 3 or self.name == 4):
                self.error_output.clear()
                self.show_error("该数据集不适合用相似匹配法进行预测!")
            else:
                self.error_output.clear()
                self.output_widget.clear()
                self.show_message("predicting...")
                similar = similarityRUL.similarity()
                if (self.name == 1):
                    n_flights = 100
                else:
                    n_flights = 259
                real_set = self.path
                self.result = similar.real(n_flights, real_set)
                self.output_widget.clear()
                self.show_message(self.result)

        else:
            self.error_output.clear()
            self.show_error("选择错误")
Esempio n. 3
0
    def operate_algorithm(self):
        self.algorithm = self.choose_algorithm.currentText()
        self.data = self.choose_data.currentText()

        if (self.algorithm == "LSTM" and self.data == "训练数据"):
            if (self.name == -1):
                self.error_output.clear()
                self.show_error("请先选择文件,再点击运行")
            elif (self.name != 1 and self.name != 2 and self.name != 3
                  and self.name != 4):
                self.error_output.clear()
                self.show_error("文件名字有误,无法判断数据形式")
            else:
                self.error_output.clear()
                self.output_widget.clear()
                self.show_message("testing...")
                lstm = convLSTM.ConvLSTM()
                self.result = lstm.test(self.name, 'JANET', 0)
                self.output_widget.clear()
                self.show_message(self.result)
                lstm.draw_image(self.name, 'JANET', 0)

        elif (self.algorithm == "LSTM" and self.data == "真实数据"):
            if (self.name == -1):
                self.error_output.clear()
                self.show_error("请先选择文件,再点击运行")
            elif (self.name != 1 and self.name != 2 and self.name != 3
                  and self.name != 4):
                self.error_output.clear()
                self.show_error("文件名字有误,无法判断数据形式")
            else:
                self.error_output.clear()
                self.output_widget.clear()
                self.show_message("predicting...")
                lstm = convLSTM.ConvLSTM()
                self.result = lstm.real(self.name, 'JANET', 0)
                self.output_widget.clear()
                self.show_message(self.result)

        elif (self.algorithm == "相似模型" and self.data == "训练数据"):
            if (self.name == -1):
                self.error_output.clear()
                self.show_error("请先选择文件,再点击运行")
            elif (self.name != 1 and self.name != 2 and self.name != 3
                  and self.name != 4):
                self.error_output.clear()
                self.show_error("文件名字有误,无法判断数据形式")
            elif (self.name == 3 or self.name == 4):
                self.error_output.clear()
                self.show_error("该数据集不适合用相似匹配法进行预测!")
            else:
                self.error_output.clear()
                self.output_widget.clear()
                self.show_message("testing...")
                similar = similarityRUL.similarity()
                if (self.name == 1):
                    n_flights = 100
                else:
                    n_flights = 259
                test_set = self.path
                RUL_set = "./datafolder/RUL_FD00" + str(self.name) + ".txt"
                self.result = similar.test(n_flights, test_set, RUL_set)
                self.output_widget.clear()
                self.show_message(self.result)

        elif (self.algorithm == "相似模型" and self.data == "真实数据"):
            if (self.name == -1):
                self.error_output.clear()
                self.show_error("请先选择文件,再点击运行")
            elif (self.name != 1 and self.name != 2 and self.name != 3
                  and self.name != 4):
                self.error_output.clear()
                self.show_error("文件名字有误,无法判断数据形式")
            elif (self.name == 3 or self.name == 4):
                self.error_output.clear()
                self.show_error("该数据集不适合用相似匹配法进行预测!")
            else:
                self.error_output.clear()
                self.output_widget.clear()
                self.show_message("predicting...")
                similar = similarityRUL.similarity()
                if (self.name == 1):
                    n_flights = 100
                else:
                    n_flights = 259
                real_set = self.path
                self.result = similar.real(n_flights, real_set)
                self.output_widget.clear()
                self.show_message(self.result)

        else:
            self.error_output.clear()
            self.show_error("选择错误")