聚烯烃绘图逻辑更改

This commit is contained in:
liurui 2024-11-19 16:10:48 +08:00
parent 1aa60a7052
commit e29b09e7ee
64 changed files with 120 additions and 100 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

View File

@ -1,4 +1,4 @@
日度(220),周度(93),84天(1)
日度(219),周度(94),119天(1)
PP主力收盘价拟合残差/丙烷 CP M1,PE注塑开工率/周,中国华东地区市场平均价BOPP厚光膜
华南聚丙烯基差(折盘面收盘价),PP看跌比例中国,
华北聚丙烯基差(折盘面收盘价),PP看平比例中国,
@ -60,39 +60,39 @@ PP高熔共聚2240S自提价常州国家能源宁煤,PP
PP高熔共聚EP548R市场价广州中科炼化,PP粉料库存,
PP高熔共聚2240S出厂价华南地区国家能源宁煤,中国BOPP原料库存量,
PP高熔共聚EP548R出厂价华南地区中海壳牌,BOPP订单天数-产成品库存天数(隆众),
PP薄壁注塑BZ-70出厂价华北地区寿光鲁清,PP下游综合开工率/2WMA,
PP薄壁注塑PPH-MM60出厂价华北地区石家庄炼化,PP下游综合开工率同差,
PP薄壁注塑K1870-B市场价临沂榆能化,PP周度产量/4WMA,
PP薄壁注塑M60ET出厂价华东地区镇海炼化,PP粉检修减损量(周),
PP薄壁注塑1040TE出厂价华东地区宁夏神华宁煤,PP周度产量同差,
PP薄壁注塑1040TE出厂价华南地区宁夏神华宁煤,PP周度产量,
PP薄壁注塑PPH-MN60出厂价华南地区中石化北海,PP周度开工率,
PP薄壁注塑TM6000H出厂价华南地区福建联合石化,PP下游开工/PE下游开工,
PP透明PPR-B10出厂价华中地区中原中石化,PP管材开工率同差,
PP透明PPR-MT25出厂价华中地区中原中石化,PP无纺布开工率同差,
PP透明PPR-MT75N出厂价华中地区中原中石化,PP下游综合开工率/3年超季节性,
PP无规共聚HC-M700B出厂价华北地区山东东明,中国再生PP周度开工负荷率,
热水管PA14D市场价青州大庆炼化,中国再生PP周度开工负荷率同差,
CPP二元共聚膜DY-W0723F市场主流价天津独山子石化,PP粉料开工率4WMA,
PP透明R3080T出厂价华东地区浙江鸿基,PP检修减损量,
PP透明M08ETN出厂价华东地区镇海炼化,PP下游综合开工率(少注塑&CPP,
PP透明R3260T出厂价华东地区浙江鸿基,BOPP开工率同差,
热水管YPR-503出厂价华东地区扬子石化,BOPP开工率4WMA,
热水管PA14D出厂价华东地区大庆炼化,PP粉料开工率,
CPP二元共聚膜F800EDF出厂价华东地区上海石化,PP周度检修率,
CPP二元共聚膜F08EC出厂价华东地区镇海炼化,PP周度产量周环差,
PP透明HT9025NX出厂价华南地区茂名石化,PP周度产量同比,
PP透明HT9025ZK出厂价华南地区中科炼化,PP下游成品库存天数,
PP透明HT9025NX市场主流价广州中石化茂名,PP部分下游订单天数,
热水管T4401出厂价华南地区茂名石化,中国BOPP订单天数同差,
热水管PPR-4220出厂价华南地区广州石化,中国BOPP订单天数/4WMA,
PPBOPP1103K出厂价华北地区国家能源宁煤,BOPP完工订单工作量,
PPBOPPPPH-FL03-S出厂价华北地区青岛炼化,中国再生PP周度样本成交量,
PPBOPP1103K出厂价华东地区国家能源宁煤,BOPP开工率超季节性/3年,
PPBOPPF03BT出厂价华东地区镇海炼化,中国BOPP成品库存量同差,
PPBOPP1103K出厂价华南地区宁夏神华宁煤,中国CPP订单天数,
PPBOPPL5D98出厂价华南地区广东石化,BOPP 订单-成品天数,
PPBOPPPPH-F03D出厂价华南地区海南炼化装置一,,
PP薄壁注塑BZ-70出厂价华北地区寿光鲁清,BOPP开工率(隆众)同差,
PP薄壁注塑PPH-MM60出厂价华北地区石家庄炼化,PP下游综合开工率/2WMA,
PP薄壁注塑K1870-B市场价临沂榆能化,PP下游综合开工率同差,
PP薄壁注塑M60ET出厂价华东地区镇海炼化,PP周度产量/4WMA,
PP薄壁注塑1040TE出厂价华东地区宁夏神华宁煤,PP粉检修减损量(周),
PP薄壁注塑1040TE出厂价华南地区宁夏神华宁煤,PP周度产量同差,
PP薄壁注塑PPH-MN60出厂价华南地区中石化北海,PP周度产量,
PP薄壁注塑TM6000H出厂价华南地区福建联合石化,PP周度开工率,
PP透明PPR-B10出厂价华中地区中原中石化,PP下游开工/PE下游开工,
PP透明PPR-MT25出厂价华中地区中原中石化,PP管材开工率同差,
PP透明PPR-MT75N出厂价华中地区中原中石化,PP无纺布开工率同差,
PP无规共聚HC-M700B出厂价华北地区山东东明,PP下游综合开工率/3年超季节性,
热水管PA14D市场价青州大庆炼化,中国再生PP周度开工负荷率,
CPP二元共聚膜DY-W0723F市场主流价天津独山子石化,中国再生PP周度开工负荷率同差,
PP透明R3080T出厂价华东地区浙江鸿基,PP粉料开工率4WMA,
PP透明M08ETN出厂价华东地区镇海炼化,PP检修减损量,
PP透明R3260T出厂价华东地区浙江鸿基,PP下游综合开工率少注塑&CPP,
热水管YPR-503出厂价华东地区扬子石化,BOPP开工率同差,
热水管PA14D出厂价华东地区大庆炼化,BOPP开工率4WMA,
CPP二元共聚膜F800EDF出厂价华东地区上海石化,PP粉料开工率,
CPP二元共聚膜F08EC出厂价华东地区镇海炼化,PP周度检修率,
PP透明HT9025NX出厂价华南地区茂名石化,PP周度产量周环差,
PP透明HT9025ZK出厂价华南地区中科炼化,PP周度产量同比,
PP透明HT9025NX市场主流价广州中石化茂名,PP下游成品库存天数,
热水管T4401出厂价华南地区茂名石化,PP部分下游订单天数,
热水管PPR-4220出厂价华南地区广州石化,中国BOPP订单天数同差,
PPBOPP1103K出厂价华北地区国家能源宁煤,中国BOPP订单天数/4WMA,
PPBOPPPPH-FL03-S出厂价华北地区青岛炼化,BOPP完工订单工作量,
PPBOPP1103K出厂价华东地区国家能源宁煤,中国再生PP周度样本成交量,
PPBOPPF03BT出厂价华东地区镇海炼化,BOPP开工率超季节性/3年,
PPBOPP1103K出厂价华南地区宁夏神华宁煤,中国BOPP成品库存量同差,
PPBOPPL5D98出厂价华南地区广东石化,中国CPP订单天数,
PPBOPPPPH-F03D出厂价华南地区海南炼化装置一,BOPP 订单-成品天数,
CPP二元共聚膜PPR-F08M-S出厂价华南地区茂名石化,,
CPP二元共聚膜PPR-F08-S出厂价华南地区茂名石化,,
BOPP12μ光膜出厂价华北地区凯达包装,,
@ -156,7 +156,6 @@ PP现货-丙烯价差(山东),,
聚丙烯出口利润,,
PP检修损失量万吨/年),,
PP日度产量1000天百分位,,
BOPP开工率(隆众)同差,,
PP开工率/2WMA,,
PP开工率同差,,
PP日度开工率,,

1 日度(220) 日度(219) 周度(93) 周度(94) 84天(1) 119天(1)
2 PP主力收盘价拟合残差/丙烷 CP M1 PE注塑开工率/周 中国:华东地区:市场平均价:BOPP厚光膜
3 华南聚丙烯基差(折盘面收盘价) PP:看跌比例:中国(周)
4 华北聚丙烯基差(折盘面收盘价) PP:看平比例:中国(周)
60 PP:高熔共聚:EP548R:市场价:广州:中科炼化(日) PP粉料库存
61 PP:高熔共聚:2240S:出厂价:华南地区:国家能源宁煤(日) 中国BOPP原料库存量
62 PP:高熔共聚:EP548R:出厂价:华南地区:中海壳牌(日) BOPP订单天数-产成品库存天数(隆众)
63 PP:薄壁注塑:BZ-70:出厂价:华北地区:寿光鲁清(日) PP下游综合开工率/2WMA BOPP开工率(隆众)同差
64 PP:薄壁注塑:PPH-MM60:出厂价:华北地区:石家庄炼化(日) PP下游综合开工率同差 PP下游综合开工率/2WMA
65 PP:薄壁注塑:K1870-B:市场价:临沂:榆能化(日) PP周度产量/4WMA PP下游综合开工率同差
66 PP:薄壁注塑:M60ET:出厂价:华东地区:镇海炼化(日) PP粉检修减损量(周) PP周度产量/4WMA
67 PP:薄壁注塑:1040TE:出厂价:华东地区:宁夏神华宁煤(日) PP周度产量同差 PP粉检修减损量(周)
68 PP:薄壁注塑:1040TE:出厂价:华南地区:宁夏神华宁煤(日) PP周度产量 PP周度产量同差
69 PP:薄壁注塑:PPH-MN60:出厂价:华南地区:中石化北海(日) PP周度开工率 PP周度产量
70 PP:薄壁注塑:TM6000H:出厂价:华南地区:福建联合石化(日) PP下游开工/PE下游开工 PP周度开工率
71 PP:透明:PPR-B10:出厂价:华中地区:中原中石化(日) PP管材开工率同差 PP下游开工/PE下游开工
72 PP:透明:PPR-MT25:出厂价:华中地区:中原中石化(日) PP无纺布开工率同差 PP管材开工率同差
73 PP:透明:PPR-MT75N:出厂价:华中地区:中原中石化(日) PP下游综合开工率/3年超季节性 PP无纺布开工率同差
74 PP:无规共聚:HC-M700B:出厂价:华北地区:山东东明(日) 中国再生PP周度开工负荷率 PP下游综合开工率/3年超季节性
75 热水管:PA14D:市场价:青州:大庆炼化(日) 中国再生PP周度开工负荷率同差 中国再生PP周度开工负荷率
76 CPP:二元共聚膜:DY-W0723F:市场主流价:天津:独山子石化(日) PP粉料开工率(4WMA) 中国再生PP周度开工负荷率同差
77 PP:透明:R3080T:出厂价:华东地区:浙江鸿基(日) PP检修减损量 PP粉料开工率(4WMA)
78 PP:透明:M08ETN:出厂价:华东地区:镇海炼化(日) PP下游综合开工率(少注塑&CPP) PP检修减损量
79 PP:透明:R3260T:出厂价:华东地区:浙江鸿基(日) BOPP开工率同差 PP下游综合开工率(少注塑&CPP)
80 热水管:YPR-503:出厂价:华东地区:扬子石化(日) BOPP开工率(4WMA) BOPP开工率同差
81 热水管:PA14D:出厂价:华东地区:大庆炼化(日) PP粉料开工率 BOPP开工率(4WMA)
82 CPP:二元共聚膜:F800EDF:出厂价:华东地区:上海石化(日) PP周度检修率 PP粉料开工率
83 CPP:二元共聚膜:F08EC:出厂价:华东地区:镇海炼化(日) PP周度产量周环差 PP周度检修率
84 PP:透明:HT9025NX:出厂价:华南地区:茂名石化(日) PP周度产量同比 PP周度产量周环差
85 PP:透明:HT9025ZK:出厂价:华南地区:中科炼化(日) PP下游成品库存天数 PP周度产量同比
86 PP:透明:HT9025NX:市场主流价:广州:中石化茂名(日) PP部分下游订单天数 PP下游成品库存天数
87 热水管:T4401:出厂价:华南地区:茂名石化(日) 中国BOPP订单天数同差 PP部分下游订单天数
88 热水管:PPR-4220:出厂价:华南地区:广州石化(日) 中国BOPP订单天数/4WMA 中国BOPP订单天数同差
89 PP:BOPP:1103K:出厂价:华北地区:国家能源宁煤(日) BOPP完工订单工作量(周) 中国BOPP订单天数/4WMA
90 PP:BOPP:PPH-FL03-S:出厂价:华北地区:青岛炼化(日) 中国再生PP周度样本成交量 BOPP完工订单工作量(周)
91 PP:BOPP:1103K:出厂价:华东地区:国家能源宁煤(日) BOPP开工率超季节性/3年 中国再生PP周度样本成交量
92 PP:BOPP:F03BT:出厂价:华东地区:镇海炼化(日) 中国BOPP成品库存量同差 BOPP开工率超季节性/3年
93 PP:BOPP:1103K:出厂价:华南地区:宁夏神华宁煤(日) 中国CPP订单天数 中国BOPP成品库存量同差
94 PP:BOPP:L5D98:出厂价:华南地区:广东石化(日) BOPP 订单-成品天数 中国CPP订单天数
95 PP:BOPP:PPH-F03D:出厂价:华南地区:海南炼化装置一(日) BOPP 订单-成品天数
96 CPP:二元共聚膜:PPR-F08M-S:出厂价:华南地区:茂名石化(日)
97 CPP:二元共聚膜:PPR-F08-S:出厂价:华南地区:茂名石化(日)
98 BOPP:12μ光膜:出厂价:华北地区:凯达包装(日)
156 聚丙烯出口利润
157 PP检修损失量(万吨/年)
158 PP日度产量1000天百分位
BOPP开工率(隆众)同差
159 PP开工率/2WMA
160 PP开工率同差
161 PP日度开工率

View File

@ -1,4 +1,4 @@
特征信息总共有312个,日度(220),周度(93),84天(1), 详看 附1、特征列表
特征信息总共有312个,日度(219),周度(94),119天(1), 详看 附1、特征列表
数据特征工程:
1. 数据日期排序,新日期在最后
2. 删除空列,特征数据列没有值,就删除

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

View File

@ -108,25 +108,25 @@ def predict_main():
row,col = df.shape
now = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
ex_Model(df,
horizon=horizon,
input_size=input_size,
train_steps=train_steps,
val_check_steps=val_check_steps,
early_stop_patience_steps=early_stop_patience_steps,
is_debug=is_debug,
dataset=dataset,
is_train=is_train,
is_fivemodels=is_fivemodels,
val_size=val_size,
test_size=test_size,
settings=settings,
now=now,
etadata = etadata,
modelsindex = modelsindex,
data = data,
is_eta=is_eta,
)
# ex_Model(df,
# horizon=horizon,
# input_size=input_size,
# train_steps=train_steps,
# val_check_steps=val_check_steps,
# early_stop_patience_steps=early_stop_patience_steps,
# is_debug=is_debug,
# dataset=dataset,
# is_train=is_train,
# is_fivemodels=is_fivemodels,
# val_size=val_size,
# test_size=test_size,
# settings=settings,
# now=now,
# etadata = etadata,
# modelsindex = modelsindex,
# data = data,
# is_eta=is_eta,
# )
logger.info('模型训练完成')

View File

@ -534,58 +534,79 @@ def model_losss_juxiting(sqlitedb):
with open(os.path.join(dataset,"best_modelnames.txt"), 'w') as f:
f.write(','.join(modelnames) + '\n')
# 根据真实值y确定最大最小值,去掉最高最低的预测值
import heapq # 使用堆来找到最大和最小的值
# 根据最接近真实值的预测模型计算波动率,得到在波动率范围内的预测值确定通道边界
best_models = pd.read_csv(os.path.join(dataset,'best_modelnames.txt'),header=None).values.flatten().tolist()
def find_min_max_within_quantile(row):
true_value = row['y']
row.drop(['ds','y'], inplace=True)
row = row.astype(float).round(2)
max_heap = []
min_heap = []
for col in row.index:
# 对比真实值进行分类
if row[col] < true_value:
heapq.heappush(min_heap, row[col])
elif row[col] > true_value:
heapq.heappush(max_heap, -row[col]) # 使用负号来实现最大堆
if len(max_heap) == 1:
max_y = max_heap[0]
elif len(max_heap) == 0:
max_y = -min_heap[-1]
else:
max_y = heapq.nsmallest(2, max_heap)[1]
if len(min_heap) < 2 :
min_y = -max_heap[-1]
else:
min_y = heapq.nsmallest(2, min_heap)[-1]
# 获取最大和最小的值
q10 = min_y
q90 = -max_y
# 获取最大和最小的模型名称
row = row[best_models]
q10 = row.min()
q90 = row.max()
# 获取 row行最大最小值模型名称
min_model = row[row == q10].idxmin()
max_model = row[row == q90].idxmax()
max_model = row[row == q90].idxmin()
# # 判断flot值是否为空值
# if pd.isna(q10) or pd.isna(q90):
return pd.Series([q10, q90,min_model,max_model], index=['min_within_quantile','max_within_quantile','min_model','max_model'])
# 设置上下界比例
rote = 1
q10 = q10 * rote
q90 = q90 * rote
logger.info(min_model,q10,max_model,q90)
return pd.Series([q10, q90, min_model, max_model], index=['min_within_quantile', 'max_within_quantile', 'min_model', 'max_model'])
# # 遍历行
# 遍历行
df_combined3[['min_within_quantile', 'max_within_quantile','min_model','max_model']] = df_combined3.apply(find_min_max_within_quantile, axis=1)
df_combined = df_combined.round(4)
print(df_combined3)
# # 根据真实值y确定最大最小值,去掉最高最低的预测值
# import heapq # 使用堆来找到最大和最小的值
# def find_min_max_within_quantile(row):
# true_value = row['y']
# row.drop(['ds','y'], inplace=True)
# row = row.astype(float).round(2)
# max_heap = []
# min_heap = []
# for col in row.index:
# # 对比真实值进行分类
# if row[col] < true_value:
# heapq.heappush(min_heap, row[col])
# elif row[col] > true_value:
# heapq.heappush(max_heap, -row[col]) # 使用负号来实现最大堆
# if len(max_heap) == 1:
# max_y = max_heap[0]
# elif len(max_heap) == 0:
# max_y = -min_heap[-1]
# else:
# max_y = heapq.nsmallest(2, max_heap)[1]
# if len(min_heap) < 2 :
# min_y = -max_heap[-1]
# else:
# min_y = heapq.nsmallest(2, min_heap)[-1]
# # 获取最大和最小的值
# q10 = min_y
# q90 = -max_y
# # 获取最大和最小的模型名称
# min_model = row[row == q10].idxmin()
# max_model = row[row == q90].idxmax()
# # 设置上下界比例
# rote = 1
# q10 = q10 * rote
# q90 = q90 * rote
# logger.info(min_model,q10,max_model,q90)
# return pd.Series([q10, q90, min_model, max_model], index=['min_within_quantile', 'max_within_quantile', 'min_model', 'max_model'])
# # # 遍历行
# df_combined3[['min_within_quantile', 'max_within_quantile','min_model','max_model']] = df_combined3.apply(find_min_max_within_quantile, axis=1)
# df_combined = df_combined.round(4)
# print(df_combined3)
# 使用最佳五个模型进行绘图
# best_models = pd.read_csv(os.path.join(dataset,'best_modelnames.txt'),header=None).values.flatten().tolist()
# def find_min_max_within_quantile(row):