|
@@ -234,14 +234,20 @@ class Clock(object):
|
|
self.logger.info(
|
|
self.logger.info(
|
|
"4.过去{}天的短期的考核分:{:.4f},自动确认系数后,{} 超短期的考核分:{:.4f},超短期公式:{:.4f},神经网络:{:.4f},历史功率:{:.4f}".format(
|
|
"4.过去{}天的短期的考核分:{:.4f},自动确认系数后,{} 超短期的考核分:{:.4f},超短期公式:{:.4f},神经网络:{:.4f},历史功率:{:.4f}".format(
|
|
str(self.opt.update_coe_days), dq_score, T, best_score, cdq_score, dq_fix_score, his_fix_score))
|
|
str(self.opt.update_coe_days), dq_score, T, best_score, cdq_score, dq_fix_score, his_fix_score))
|
|
- if self.opt.coe[T]['score']:
|
|
|
|
- self.opt.coe[T]['m'] = round(best_score_m, 3)
|
|
|
|
- self.opt.coe[T]['n'] = round(best_score_n, 3)
|
|
|
|
- pre_data["new"] = round(best_score_m * pre_data['dq_fix'] + best_score_n * pre_data['history'], 3)
|
|
|
|
|
|
+ if not self.opt.algorithm_platform['switch']:
|
|
|
|
+ if self.opt.coe[T]['score']:
|
|
|
|
+ self.opt.coe[T]['m'] = round(best_score_m, 3)
|
|
|
|
+ self.opt.coe[T]['n'] = round(best_score_n, 3)
|
|
|
|
+ pre_data["new"] = round(best_score_m * pre_data['dq_fix'] + best_score_n * pre_data['history'], 3)
|
|
|
|
+ else:
|
|
|
|
+ self.opt.coe[T]['m'] = round(best_coe_m, 3)
|
|
|
|
+ self.opt.coe[T]['n'] = round(best_coe_n, 3)
|
|
|
|
+ pre_data["new"] = round(best_coe_m * pre_data['dq_fix'] + best_coe_n * pre_data['history'], 3)
|
|
else:
|
|
else:
|
|
- self.opt.coe[T]['m'] = round(best_coe_m, 3)
|
|
|
|
- self.opt.coe[T]['n'] = round(best_coe_n, 3)
|
|
|
|
- pre_data["new"] = round(best_coe_m * pre_data['dq_fix'] + best_coe_n * pre_data['history'], 3)
|
|
|
|
|
|
+ self.opt.coe[T]['score_m'] = round(best_score_m, 3)
|
|
|
|
+ self.opt.coe[T]['score_n'] = round(best_score_n, 3)
|
|
|
|
+ self.opt.coe[T]['acc_m'] = round(best_coe_m, 3)
|
|
|
|
+ self.opt.coe[T]['acc_n'] = round(best_coe_n, 3)
|
|
pre_data.to_csv(current_path + '/data/测试集{}.csv'.format(point + 1), index=False)
|
|
pre_data.to_csv(current_path + '/data/测试集{}.csv'.format(point + 1), index=False)
|
|
else:
|
|
else:
|
|
best, best_coe_m, best_coe_n = 0, 0, 0
|
|
best, best_coe_m, best_coe_n = 0, 0, 0
|
|
@@ -295,8 +301,6 @@ class Clock(object):
|
|
day_start = day_end - pd.Timedelta(days=1)
|
|
day_start = day_end - pd.Timedelta(days=1)
|
|
db = DataBase(begin=day_start, end=day_end, opt=self.opt, logger=self.logger)
|
|
db = DataBase(begin=day_start, end=day_end, opt=self.opt, logger=self.logger)
|
|
db.data_process()
|
|
db.data_process()
|
|
- formula = Formulas(self.opt)
|
|
|
|
- assess = Assessment(self.opt, self.logger)
|
|
|
|
self.logger.info("------------进入测试集自动计算-------------")
|
|
self.logger.info("------------进入测试集自动计算-------------")
|
|
nwp, env, dq, rp, rp_his = self.material(day_start, day_end)
|
|
nwp, env, dq, rp, rp_his = self.material(day_start, day_end)
|
|
nwp = pd.merge(nwp, dq, on="C_TIME")
|
|
nwp = pd.merge(nwp, dq, on="C_TIME")
|
|
@@ -313,7 +317,7 @@ class Clock(object):
|
|
_, _, env_features = self.normalize(env, mean=mean, std=std)
|
|
_, _, env_features = self.normalize(env, mean=mean, std=std)
|
|
|
|
|
|
data_test, env = self.process.get_test_data(nwp_features, env_features)
|
|
data_test, env = self.process.get_test_data(nwp_features, env_features)
|
|
- test_X, data_Y = self.features.get_test_data(data_test, env)
|
|
|
|
|
|
+ test_X, test_Y, data_Y = self.features.get_test_data(data_test, env)
|
|
result = self.fmi.predict(test_X, batch_size=8)
|
|
result = self.fmi.predict(test_X, batch_size=8)
|
|
mongo_data = []
|
|
mongo_data = []
|
|
# 2.历史数据
|
|
# 2.历史数据
|
|
@@ -338,10 +342,11 @@ class Clock(object):
|
|
pre_data['history'] = self.fix.history_error_clock(pre_data, rp_his, 16 - point - 1)
|
|
pre_data['history'] = self.fix.history_error_clock(pre_data, rp_his, 16 - point - 1)
|
|
self.logger.info("第{}点的时间周期为:{}-{}".format(T, pre_data['C_TIME'][0], pre_data['C_TIME'].iloc[-1]))
|
|
self.logger.info("第{}点的时间周期为:{}-{}".format(T, pre_data['C_TIME'][0], pre_data['C_TIME'].iloc[-1]))
|
|
|
|
|
|
- pre_data = self.update_coe(pre_data, assess, formula, point, test=False)
|
|
|
|
|
|
+ pre_data["coe-ass"] = round(self.opt.coe[T]['score_m'] * pre_data['dq_fix'] + self.opt.coe[T]['score_n'] * pre_data['history'],3)
|
|
|
|
+ pre_data["coe-acc"] = round(self.opt.coe[T]['acc_m'] * pre_data['dq_fix'] + self.opt.coe[T]['acc_n'] * pre_data['history'], 3)
|
|
pre_data['howLongAgo'] = point + 1
|
|
pre_data['howLongAgo'] = point + 1
|
|
- pre_data = pre_data.loc[:,['C_TIME', 'dq_fix', 'C_FP_VALUE', 'history', 'coe-acc', 'coe-ass', 'howLongAgo']]
|
|
|
|
- df_melted = pre_data.melt(id_vars=['C_TIME', 'howLongAgo'], var_name='model', value_name='power_forecast')
|
|
|
|
|
|
+ pre_data = pre_data.loc[:,['C_TIME', 'C_REAL_VALUE', 'dq_fix', 'C_FP_VALUE', 'history', 'coe-acc', 'coe-ass', 'howLongAgo']]
|
|
|
|
+ df_melted = pre_data.melt(id_vars=['C_TIME', 'C_REAL_VALUE', 'howLongAgo'], var_name='model', value_name='power_forecast')
|
|
df_melted['farm_id'] = self.opt.algorithm_platform['farm_id']
|
|
df_melted['farm_id'] = self.opt.algorithm_platform['farm_id']
|
|
mongo_data.append(df_melted)
|
|
mongo_data.append(df_melted)
|
|
from cache.mongo import insert_data_into_mongo
|
|
from cache.mongo import insert_data_into_mongo
|