def post(self): body = self.request.body body = eval(body) position_json = body['company'] database_name = options.database try: handleposition.insert_company(position_json, database_name) self.write({'err_code': 0}) except: self.write({'err_code': 6665}) nautil.dlog.exception('ModelTrainHandler')
def post(self): body = self.request.body body = eval(body) position_json = body['company'] database_name = options.database try: handleposition.insert_company(position_json, database_name) self.write({'err_code':0}) except: self.write({'err_code':6665}) nautil.dlog.exception('ModelTrainHandler')
def post(self): body = self.request.body body = eval(body) action = body['action'] # pdb.set_trace() if action == 'train': generate_feature.generate_train(options.path) gbdt_model.train_model() self.write({'err_code':0}) else: database = options.database position_json = body['company'] handleposition.insert_company(position_json, database, tablename='companytest') profile_json = body['profile'] handleprofile.insert_profile(profile_json, database, test='test') pos_id = position_json['position_id'] resume_id = profile_json['resume_id'] # pos_id = body['pos_id'] # resume_id = body['resume_id'] score = gbdt_model.predict_data(int(pos_id), resume_id) self.write({'err_code':0, 'predict_score':score})
def post(self): body = self.request.body body = eval(body) action = body['action'] # pdb.set_trace() if action == 'train': generate_feature.generate_train(options.path) gbdt_model.train_model() self.write({'err_code': 0}) else: database = options.database position_json = body['company'] handleposition.insert_company(position_json, database, tablename='companytest') profile_json = body['profile'] handleprofile.insert_profile(profile_json, database, test='test') pos_id = position_json['position_id'] resume_id = profile_json['resume_id'] # pos_id = body['pos_id'] # resume_id = body['resume_id'] score = gbdt_model.predict_data(int(pos_id), resume_id) self.write({'err_code': 0, 'predict_score': score})