def button_event_6(): #防止未导入信息而报错 if di.global_class_names == 'null': roll_text_1.insert('insert', "\n请先导入信息,再进行标签预测!") else: #获取prediction数据的地址 prediction.predict_txt_dir = entry_2_8.get() #将myGUI传给dpp的数据同样传给precision #直接由myGUI传比较好,直接得到模型就能预测 #传入channel channel = entry_2_6.get() prediction.channel_s = int(channel.split(',')[0]) prediction.channel_e = int(channel.split(',')[1]) #传入botton_state #判断复选框状态,确定dpp.main()中是否全部运行 #裁剪 if cb_v1.get() == 0: prediction.botton_state[0] = 0 else: prediction.botton_state[0] = 1 #均值 if cb_v2.get() == 0: prediction.botton_state[1] = 0 else: prediction.botton_state[1] = 1 #去背景 if cb_v3.get() == 0: prediction.botton_state[2] = 0 else: prediction.botton_state[2] = 1 #数值缩放 if cb_v4.get() == 0: prediction.botton_state[3] = 0 else: prediction.botton_state[3] = 1 #降维 if cb_v5.get() == 0: prediction.botton_state[4] = 0 else: prediction.botton_state[4] = 1 #生成标签 if cb_v6.get() == 0: prediction.botton_state[5] = 0 else: prediction.botton_state[5] = 1 #传入其他三项 prediction.com_2_scale_state = combobox_2.get() prediction.com_3_dre_state = combobox_3.get() prediction.dred_num = int(entry_2_11.get()) #开始预测 roll_text_1.insert('end', "\n开始预测...") predict_results = prediction.main() for predict_result in predict_results: roll_text_1.insert( 'end', "\n 预测该条数据对应样本类型为:" + str(di.global_class_names[predict_result])) roll_text_1.insert('end', "\n预测完成!\n") return 0
def final_predict(): file_name = request.get_json()['file_name'] algorithm_name = request.get_json()['algorithm_name'] pred_type = request.get_json()['pred_type'] features = request.get_json()['features'] target = request.get_json()['target'] inputType = request.get_json()['inputType'] feature_values = request.get_json()['feature_values'] result = prediction.main(file_name, algorithm_name, pred_type, features, target, inputType, feature_values) return jsonify({"result": result.tolist()})
def start1(): #click.echo("HELLO") df=pd.DataFrame(columns=["S&P 50","Nasdaq","Dow-Jones","Company","DateTime","Price","Price_Difference","Moving Average"]) dj=[] nasdaq=[] sp=[] p_diff=[] u=scrape.url(df,dj,nasdaq,sp,p_diff) #output_file=df.to_csv('Stock2.csv') pred=prediction.main() return u,pred
def start1(): #click.echo("HELLO") df = pd.DataFrame(columns=[ "S&P 50", "Nasdaq", "Dow-Jones", "Company", "DateTime", "Price" ]) dj = [] nasdaq = [] sp = [] p_diff = [] u = scrape.url(df, dj, nasdaq, sp, p_diff) pred = prediction.main() return u, pred
def post(self): try: files = self.request.files file = files['file'][0]['body'] mime = files['file'][0]['content_type'] pictureid = str(uuid.uuid4()) picturefullpath = "static/uploaddata/" + pictureid + ".jpeg" with open(picturefullpath, 'wb') as f: f.write(file) # クラス判定 result = prediction.main(picturefullpath) # 結果を保存 with open('database.tsv', 'a') as f: f.write(pictureid + "\t" + str(result) + "\n") self.render("imageclass.html", pictureid=pictureid, result=result) # self.write("ファイルを保存しました") except KeyError: self.render("imageclass.html", pictureid="", result="")
def myCustomCalculation(cID, rID, cOR, y, m, d): dat = dt.datetime(year=y, month=m, day=d) print("\nCOMPANY:", cID, "RESTAURANT:", rID, "Delivery Date:", dat, '\n========================================================') PREDICTION = prediction.main(cID, rID, cOR, dat) return {'cID': cID, 'rID': rID, 'prediction': PREDICTION}
def predictions_function(): prediction.main()
def handle_pre(self, filedir, filename, index): result = main(filedir + "/", filename, index) value = result.get(index) return value
def main(): prediction.main()