Exemple #1
0
 def test_prediction_return_type(self):
     check_none = pd.prediction(pnd.read_csv(self.path),
                                ['Temperature', 'Error'], "Failure", 1)
     self.assertIsNone(check_none)
     check_none = pd.prediction(pnd.read_csv(self.path), ['Temperature'],
                                "Failure", 2)
     self.assertIsNotNone(check_none)
     self.assertEqual(type(check_none), str)
Exemple #2
0
 def test_save_model_file(self):
     home = str(Path.home())
     count_file_after = 0
     list_dir = os.listdir(home)
     for file in list_dir:
         if file.endswith('.pkl'):
             os.remove(home + "\\" + file)
     pd.prediction(pnd.read_csv(self.path), ['Temperature'], "Failure", 1)
     for file in list_dir:
         if file.endswith('.pkl'):
             count_file_after += 1
     self.assertTrue(count_file_after > 0)
    def init_result_window(self):
        self.title("Result prediction window")
        self.geometry("400x240+300+200")
        self.focus_get()
        self.resizable(False, False)
        self.var.set(0)

        result_label = Label(self, text="Result prediction", font="Arial 15", pady=15, padx=120)
        result_label.grid(row=0, column=0, sticky=W)

        btn_back = tkinter.Button(self, text="Back", command=self.exit_window, anchor=SW, padx=10)
        btn_back.place(x=3, y=210)

        success_label = Label(text="\nResult was written\nin file prediction_data_<algorithm>")
        text = Text(self, width=400, height=8)
        text.insert(1.0, pd.prediction(self.data, self.params, self.fail_col_name, self.algorithm))
        text.tag_config('info', foreground="green")
        text.insert(END, success_label['text'], 'info')
        text.configure(state=DISABLED)
        text.grid(row=1, column=0, sticky=W)
        home = str(Path.home())

        if self.algorithm == 2:
            dw.DataWindow(self.root, home + "\\prediction_data_lr.csv")
        else:
            dw.DataWindow(self.root, home + "\\prediction_data_rf.csv")
Exemple #4
0
 def prediction(self):
     params = []
     for el in self.lst:
         params.append(el.get())
     try:
         flag = pd.prediction(dpm.read_file_prediction(self.file), params,
                              self.fail_col_name, self.algorithm)
         if flag is None:
             raise Exception("Please, enter correct name of column")
         rpw.ResultPredictionWindow(self,
                                    dpm.read_file_prediction(self.file),
                                    params, self.fail_col_name,
                                    self.algorithm, self.file)
         self.withdraw()
     except Exception as e:
         messagebox.showerror(title="Error", message=e)
Exemple #5
0
 def test_out_predict_data_save_file(self):
     home = str(Path.home())
     pd.prediction(pnd.read_csv(self.path), ['Temperature'], "Failure", 1)
     pd.prediction(pnd.read_csv(self.path), ['Temperature'], "Failure", 2)
     self.assertTrue(os.path.exists(home + "\\prediction_data_lr.csv"))
     self.assertTrue(os.path.exists(home + "\\prediction_data_rf.csv"))