原油周度预测调试完成
This commit is contained in:
parent
4a7d07eb3b
commit
4dde6a8c4f
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -160,7 +160,7 @@ table_name = 'v_tbl_crude_oil_warning'
|
|||||||
|
|
||||||
### 开关
|
### 开关
|
||||||
is_train = False # 是否训练
|
is_train = False # 是否训练
|
||||||
is_debug = False # 是否调试
|
is_debug = True # 是否调试
|
||||||
is_eta = False # 是否使用eta接口
|
is_eta = False # 是否使用eta接口
|
||||||
is_market = True # 是否通过市场信息平台获取特征 ,在is_eta 为true 的情况下生效
|
is_market = True # 是否通过市场信息平台获取特征 ,在is_eta 为true 的情况下生效
|
||||||
is_timefurture = True # 是否使用时间特征
|
is_timefurture = True # 是否使用时间特征
|
||||||
@ -182,7 +182,7 @@ print("数据库连接成功",host,dbname,dbusername)
|
|||||||
|
|
||||||
|
|
||||||
# 数据截取日期
|
# 数据截取日期
|
||||||
start_year = 2020 # 数据开始年份
|
start_year = 2017 # 数据开始年份
|
||||||
end_time = '' # 数据截取日期
|
end_time = '' # 数据截取日期
|
||||||
freq = 'W' # 时间频率,"D": 天 "W": 周"M": 月"Q": 季度"A": 年 "H": 小时 "T": 分钟 "S": 秒 "B": 工作日
|
freq = 'W' # 时间频率,"D": 天 "W": 周"M": 月"Q": 季度"A": 年 "H": 小时 "T": 分钟 "S": 秒 "B": 工作日
|
||||||
delweekenday = True if freq == 'B' else False # 是否删除周末数据
|
delweekenday = True if freq == 'B' else False # 是否删除周末数据
|
||||||
@ -193,7 +193,7 @@ if add_kdj and is_edbnamelist:
|
|||||||
|
|
||||||
### 模型参数
|
### 模型参数
|
||||||
y = 'Brent连1合约价格' # 原油指标数据的目标变量 Brent连1合约价格 Brent活跃合约
|
y = 'Brent连1合约价格' # 原油指标数据的目标变量 Brent连1合约价格 Brent活跃合约
|
||||||
horizon =4 # 预测的步长
|
horizon =2 # 预测的步长
|
||||||
input_size = 12 # 输入序列长度
|
input_size = 12 # 输入序列长度
|
||||||
train_steps = 50 if is_debug else 1000 # 训练步数,用来限定epoch次数
|
train_steps = 50 if is_debug else 1000 # 训练步数,用来限定epoch次数
|
||||||
val_check_steps = 30 # 评估频率
|
val_check_steps = 30 # 评估频率
|
||||||
|
@ -42,9 +42,9 @@ plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号
|
|||||||
|
|
||||||
# from config_jingbo_pro import *
|
# from config_jingbo_pro import *
|
||||||
# from config_jingbo import *
|
# from config_jingbo import *
|
||||||
# from config_jingbo_zhoudu import *
|
from config_jingbo_zhoudu import *
|
||||||
# from config_yongan import *
|
# from config_yongan import *
|
||||||
from config_juxiting import *
|
# from config_juxiting import *
|
||||||
# from config_juxiting_zhoudu import *
|
# from config_juxiting_zhoudu import *
|
||||||
# from config_juxiting_pro import *
|
# from config_juxiting_pro import *
|
||||||
|
|
||||||
|
@ -197,7 +197,8 @@ def ex_Model(df,horizon,input_size,train_steps,val_check_steps,early_stop_patien
|
|||||||
#进行未来时间预测
|
#进行未来时间预测
|
||||||
df_predict=nf.predict(df_test).reset_index()
|
df_predict=nf.predict(df_test).reset_index()
|
||||||
# 去掉index列
|
# 去掉index列
|
||||||
df_predict.drop(columns=['index'], inplace=True)
|
if 'index' in df_predict.columns:
|
||||||
|
df_predict.drop(columns=['index'], inplace=True)
|
||||||
df_predict.astype({col: 'float32' for col in df_predict.columns if col not in ['ds'] })
|
df_predict.astype({col: 'float32' for col in df_predict.columns if col not in ['ds'] })
|
||||||
|
|
||||||
# 添加预测时间
|
# 添加预测时间
|
||||||
@ -859,7 +860,7 @@ def model_losss(sqlitedb,end_time):
|
|||||||
# 然后筛选出那些 cutoff 等于 max_cutoff 的行,这样就得到了每个分组中 cutoff 最大的行,并保留了其他列
|
# 然后筛选出那些 cutoff 等于 max_cutoff 的行,这样就得到了每个分组中 cutoff 最大的行,并保留了其他列
|
||||||
df_combined = df_combined[df_combined['CREAT_DATE'] == df_combined['max_cutoff']]
|
df_combined = df_combined[df_combined['CREAT_DATE'] == df_combined['max_cutoff']]
|
||||||
# 删除模型生成的cutoff列
|
# 删除模型生成的cutoff列
|
||||||
df_combined.drop(columns=['CREAT_DATE', 'max_cutoff','created_dt','min_within_quantile','max_within_quantile','id','min_price','max_price','LOW_PRICE','HIGH_PRICE','mean'], inplace=True,errors='ignore')
|
df_combined.drop(columns=['CREAT_DATE', 'max_cutoff','created_dt','min_within_quantile','max_within_quantile','id','min_price','max_price','LOW_PRICE','HIGH_PRICE'], inplace=True,errors='ignore')
|
||||||
# 获取模型名称
|
# 获取模型名称
|
||||||
modelnames = df_combined.columns.to_list()[1:]
|
modelnames = df_combined.columns.to_list()[1:]
|
||||||
if 'y' in modelnames:
|
if 'y' in modelnames:
|
||||||
|
Loading…
Reference in New Issue
Block a user