diff --git a/.idea/deployment.xml b/.idea/deployment.xml
new file mode 100644
index 0000000..4de79b3
--- /dev/null
+++ b/.idea/deployment.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 695b918..3141537 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/.idea/pytorch2.iml b/.idea/pytorch2.iml
index 5cfdc49..719cec4 100644
--- a/.idea/pytorch2.iml
+++ b/.idea/pytorch2.iml
@@ -2,7 +2,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/toolchains.xml b/.idea/toolchains.xml
new file mode 100644
index 0000000..4581420
--- /dev/null
+++ b/.idea/toolchains.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/杭州日电量/浙江所有地市133行业数据/丽水133行业数据(全).xlsx b/杭州日电量/浙江所有地市133行业数据/丽水133行业数据(全).xlsx
deleted file mode 100644
index 9b90065..0000000
Binary files a/杭州日电量/浙江所有地市133行业数据/丽水133行业数据(全).xlsx and /dev/null differ
diff --git a/杭州日电量/浙江所有地市133行业数据/台州133行业数据(全).xlsx b/杭州日电量/浙江所有地市133行业数据/台州133行业数据(全).xlsx
deleted file mode 100644
index 21df9fa..0000000
Binary files a/杭州日电量/浙江所有地市133行业数据/台州133行业数据(全).xlsx and /dev/null differ
diff --git a/杭州日电量/浙江所有地市133行业数据/嘉兴133行业数据(全).xlsx b/杭州日电量/浙江所有地市133行业数据/嘉兴133行业数据(全).xlsx
deleted file mode 100644
index 6144b56..0000000
Binary files a/杭州日电量/浙江所有地市133行业数据/嘉兴133行业数据(全).xlsx and /dev/null differ
diff --git a/杭州日电量/浙江所有地市133行业数据/宁波133行业数据(全).xlsx b/杭州日电量/浙江所有地市133行业数据/宁波133行业数据(全).xlsx
deleted file mode 100644
index f90e8ac..0000000
Binary files a/杭州日电量/浙江所有地市133行业数据/宁波133行业数据(全).xlsx and /dev/null differ
diff --git a/杭州日电量/浙江所有地市133行业数据/杭州133行业数据(全).xlsx b/杭州日电量/浙江所有地市133行业数据/杭州133行业数据(全).xlsx
deleted file mode 100644
index a894cef..0000000
Binary files a/杭州日电量/浙江所有地市133行业数据/杭州133行业数据(全).xlsx and /dev/null differ
diff --git a/杭州日电量/浙江所有地市133行业数据/温州133行业数据(全).xlsx b/杭州日电量/浙江所有地市133行业数据/温州133行业数据(全).xlsx
deleted file mode 100644
index 12e4bfa..0000000
Binary files a/杭州日电量/浙江所有地市133行业数据/温州133行业数据(全).xlsx and /dev/null differ
diff --git a/杭州日电量/浙江所有地市133行业数据/湖州133行业数据(全).xlsx b/杭州日电量/浙江所有地市133行业数据/湖州133行业数据(全).xlsx
deleted file mode 100644
index 14f27eb..0000000
Binary files a/杭州日电量/浙江所有地市133行业数据/湖州133行业数据(全).xlsx and /dev/null differ
diff --git a/杭州日电量/浙江所有地市133行业数据/绍兴133行业数据(全).xlsx b/杭州日电量/浙江所有地市133行业数据/绍兴133行业数据(全).xlsx
deleted file mode 100644
index 7c7e04b..0000000
Binary files a/杭州日电量/浙江所有地市133行业数据/绍兴133行业数据(全).xlsx and /dev/null differ
diff --git a/杭州日电量/浙江所有地市133行业数据/舟山133行业数据(全).xlsx b/杭州日电量/浙江所有地市133行业数据/舟山133行业数据(全).xlsx
deleted file mode 100644
index 97d56b9..0000000
Binary files a/杭州日电量/浙江所有地市133行业数据/舟山133行业数据(全).xlsx and /dev/null differ
diff --git a/杭州日电量/浙江所有地市133行业数据/衢州133行业数据(全).xlsx b/杭州日电量/浙江所有地市133行业数据/衢州133行业数据(全).xlsx
deleted file mode 100644
index e03d91f..0000000
Binary files a/杭州日电量/浙江所有地市133行业数据/衢州133行业数据(全).xlsx and /dev/null differ
diff --git a/杭州日电量/industry_elec.py b/浙江行业电量/industry_elec.py
similarity index 100%
rename from 杭州日电量/industry_elec.py
rename to 浙江行业电量/industry_elec.py
diff --git a/杭州日电量/industry_elec_cws.py b/浙江行业电量/industry_elec_cws.py
similarity index 100%
rename from 杭州日电量/industry_elec_cws.py
rename to 浙江行业电量/industry_elec_cws.py
diff --git a/杭州日电量/偏差/7月底偏差率.txt b/浙江行业电量/偏差/7月底偏差率.txt
similarity index 100%
rename from 杭州日电量/偏差/7月底偏差率.txt
rename to 浙江行业电量/偏差/7月底偏差率.txt
diff --git a/杭州日电量/偏差/8月底偏差率.txt b/浙江行业电量/偏差/8月底偏差率.txt
similarity index 100%
rename from 杭州日电量/偏差/8月底偏差率.txt
rename to 浙江行业电量/偏差/8月底偏差率.txt
diff --git a/杭州日电量/偏差/9月底偏差率.txt b/浙江行业电量/偏差/9月底偏差率.txt
similarity index 100%
rename from 杭州日电量/偏差/9月底偏差率.txt
rename to 浙江行业电量/偏差/9月底偏差率.txt
diff --git a/杭州日电量/月底预测结果/7月丽水.txt b/浙江行业电量/月底预测结果/7月丽水.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/7月丽水.txt
rename to 浙江行业电量/月底预测结果/7月丽水.txt
diff --git a/杭州日电量/月底预测结果/7月台州.txt b/浙江行业电量/月底预测结果/7月台州.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/7月台州.txt
rename to 浙江行业电量/月底预测结果/7月台州.txt
diff --git a/杭州日电量/月底预测结果/7月嘉兴.txt b/浙江行业电量/月底预测结果/7月嘉兴.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/7月嘉兴.txt
rename to 浙江行业电量/月底预测结果/7月嘉兴.txt
diff --git a/杭州日电量/月底预测结果/7月宁波.txt b/浙江行业电量/月底预测结果/7月宁波.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/7月宁波.txt
rename to 浙江行业电量/月底预测结果/7月宁波.txt
diff --git a/杭州日电量/月底预测结果/7月杭州.txt b/浙江行业电量/月底预测结果/7月杭州.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/7月杭州.txt
rename to 浙江行业电量/月底预测结果/7月杭州.txt
diff --git a/杭州日电量/月底预测结果/7月温州.txt b/浙江行业电量/月底预测结果/7月温州.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/7月温州.txt
rename to 浙江行业电量/月底预测结果/7月温州.txt
diff --git a/杭州日电量/月底预测结果/7月湖州.txt b/浙江行业电量/月底预测结果/7月湖州.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/7月湖州.txt
rename to 浙江行业电量/月底预测结果/7月湖州.txt
diff --git a/杭州日电量/月底预测结果/7月绍兴.txt b/浙江行业电量/月底预测结果/7月绍兴.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/7月绍兴.txt
rename to 浙江行业电量/月底预测结果/7月绍兴.txt
diff --git a/杭州日电量/月底预测结果/7月舟山.txt b/浙江行业电量/月底预测结果/7月舟山.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/7月舟山.txt
rename to 浙江行业电量/月底预测结果/7月舟山.txt
diff --git a/杭州日电量/月底预测结果/7月衢州.txt b/浙江行业电量/月底预测结果/7月衢州.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/7月衢州.txt
rename to 浙江行业电量/月底预测结果/7月衢州.txt
diff --git a/杭州日电量/月底预测结果/7月金华.txt b/浙江行业电量/月底预测结果/7月金华.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/7月金华.txt
rename to 浙江行业电量/月底预测结果/7月金华.txt
diff --git a/杭州日电量/月底预测结果/8月丽水.txt b/浙江行业电量/月底预测结果/8月丽水.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/8月丽水.txt
rename to 浙江行业电量/月底预测结果/8月丽水.txt
diff --git a/杭州日电量/月底预测结果/8月台州.txt b/浙江行业电量/月底预测结果/8月台州.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/8月台州.txt
rename to 浙江行业电量/月底预测结果/8月台州.txt
diff --git a/杭州日电量/月底预测结果/8月嘉兴.txt b/浙江行业电量/月底预测结果/8月嘉兴.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/8月嘉兴.txt
rename to 浙江行业电量/月底预测结果/8月嘉兴.txt
diff --git a/杭州日电量/月底预测结果/8月宁波.txt b/浙江行业电量/月底预测结果/8月宁波.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/8月宁波.txt
rename to 浙江行业电量/月底预测结果/8月宁波.txt
diff --git a/杭州日电量/月底预测结果/8月杭州.txt b/浙江行业电量/月底预测结果/8月杭州.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/8月杭州.txt
rename to 浙江行业电量/月底预测结果/8月杭州.txt
diff --git a/杭州日电量/月底预测结果/8月温州.txt b/浙江行业电量/月底预测结果/8月温州.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/8月温州.txt
rename to 浙江行业电量/月底预测结果/8月温州.txt
diff --git a/杭州日电量/月底预测结果/8月湖州.txt b/浙江行业电量/月底预测结果/8月湖州.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/8月湖州.txt
rename to 浙江行业电量/月底预测结果/8月湖州.txt
diff --git a/杭州日电量/月底预测结果/8月绍兴.txt b/浙江行业电量/月底预测结果/8月绍兴.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/8月绍兴.txt
rename to 浙江行业电量/月底预测结果/8月绍兴.txt
diff --git a/杭州日电量/月底预测结果/8月舟山.txt b/浙江行业电量/月底预测结果/8月舟山.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/8月舟山.txt
rename to 浙江行业电量/月底预测结果/8月舟山.txt
diff --git a/杭州日电量/月底预测结果/8月衢州.txt b/浙江行业电量/月底预测结果/8月衢州.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/8月衢州.txt
rename to 浙江行业电量/月底预测结果/8月衢州.txt
diff --git a/杭州日电量/月底预测结果/8月金华.txt b/浙江行业电量/月底预测结果/8月金华.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/8月金华.txt
rename to 浙江行业电量/月底预测结果/8月金华.txt
diff --git a/杭州日电量/月底预测结果/9月丽水.txt b/浙江行业电量/月底预测结果/9月丽水.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/9月丽水.txt
rename to 浙江行业电量/月底预测结果/9月丽水.txt
diff --git a/杭州日电量/月底预测结果/9月台州.txt b/浙江行业电量/月底预测结果/9月台州.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/9月台州.txt
rename to 浙江行业电量/月底预测结果/9月台州.txt
diff --git a/杭州日电量/月底预测结果/9月嘉兴.txt b/浙江行业电量/月底预测结果/9月嘉兴.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/9月嘉兴.txt
rename to 浙江行业电量/月底预测结果/9月嘉兴.txt
diff --git a/杭州日电量/月底预测结果/9月宁波.txt b/浙江行业电量/月底预测结果/9月宁波.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/9月宁波.txt
rename to 浙江行业电量/月底预测结果/9月宁波.txt
diff --git a/杭州日电量/月底预测结果/9月杭州.txt b/浙江行业电量/月底预测结果/9月杭州.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/9月杭州.txt
rename to 浙江行业电量/月底预测结果/9月杭州.txt
diff --git a/杭州日电量/月底预测结果/9月温州.txt b/浙江行业电量/月底预测结果/9月温州.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/9月温州.txt
rename to 浙江行业电量/月底预测结果/9月温州.txt
diff --git a/杭州日电量/月底预测结果/9月湖州.txt b/浙江行业电量/月底预测结果/9月湖州.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/9月湖州.txt
rename to 浙江行业电量/月底预测结果/9月湖州.txt
diff --git a/杭州日电量/月底预测结果/9月绍兴.txt b/浙江行业电量/月底预测结果/9月绍兴.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/9月绍兴.txt
rename to 浙江行业电量/月底预测结果/9月绍兴.txt
diff --git a/杭州日电量/月底预测结果/9月舟山.txt b/浙江行业电量/月底预测结果/9月舟山.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/9月舟山.txt
rename to 浙江行业电量/月底预测结果/9月舟山.txt
diff --git a/杭州日电量/月底预测结果/9月衢州.txt b/浙江行业电量/月底预测结果/9月衢州.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/9月衢州.txt
rename to 浙江行业电量/月底预测结果/9月衢州.txt
diff --git a/杭州日电量/月底预测结果/9月金华.txt b/浙江行业电量/月底预测结果/9月金华.txt
similarity index 100%
rename from 杭州日电量/月底预测结果/9月金华.txt
rename to 浙江行业电量/月底预测结果/9月金华.txt
diff --git a/杭州日电量/杭州日电量数据预处理.py b/浙江行业电量/杭州日电量数据预处理.py
similarity index 96%
rename from 杭州日电量/杭州日电量数据预处理.py
rename to 浙江行业电量/杭州日电量数据预处理.py
index aaa6555..d6937de 100644
--- a/杭州日电量/杭州日电量数据预处理.py
+++ b/浙江行业电量/杭州日电量数据预处理.py
@@ -1,79 +1,79 @@
-import pandas as pd
-import datetime
-from sklearn.preprocessing import LabelEncoder
-import os
-import math
-import chinese_calendar as cc
-is_holiday = cc.is_workday(datetime.date(2023, 10, 7))
-print(is_holiday)
-
-def holiday_work(x):
- if cc.is_workday(x):
- return 0
- if cc.is_holiday(x):
- return 1
-
-tq_df = pd.read_excel(r'C:\Users\鸽子\Desktop\杭州\杭州气象数据.xlsx',sheet_name=0)
-pd.set_option('display.width',None)
-tq_df.columns = tq_df.columns.map(lambda x:x.strip())
-tq_df = tq_df[['city_name','dtdate','tem_max','tem_min','rh','rh_max','rh_min','pre','prs','prs_max','prs_min','win_s_max','win_s_min']]
-tq_df.drop_duplicates(subset='dtdate',inplace=True)
-tq_df = tq_df.sort_values(by='dtdate',ascending=True)
-tq_df.reset_index(inplace=True,drop=True)
-
-tq_df['dtdate'] = pd.to_datetime(tq_df['dtdate'],format='%Y%m%d')
-tq_df['holiday'] = tq_df['dtdate'].apply(holiday_work)
-print(tq_df.columns)
-print(tq_df.head())
-
-
-
-print(tq_df.info())
-def jq(y,x):
- a=365.242 * (y - 1900) + 6.2 + 15.22 * x - 1.9 * math.sin(0.262 * x)
- return datetime.date(1899,12,31)+datetime.timedelta(days=int(a))
-# print(jq(2020,0))
-jq_list=['小寒', '大寒', '立春', '雨水', '惊蛰', '春分', '清明', '谷雨', '立夏', '小满', '芒种', '夏至', '小暑', '大暑', '立秋', '处暑', '白露', '秋分', '寒露', '霜降', '立冬', '小雪', '大雪','冬至']
-jq_dict={}
-for j in range(2019,2024):
- for i in range(24):
- jq_dict[jq(j,i).strftime('%Y-%m-%d')]=jq_list[i]
-# print(jq_dict)
-
-tq_df['24ST']=tq_df.dtdate
-tq_df['24ST']=tq_df['24ST'].astype('string').map(jq_dict)
-tq_df['24ST'].fillna(method='ffill',inplace=True)
-tq_df['24ST'].fillna('冬至',inplace=True)
-
-
-# data为数据集 product_tags为需要编码的特征列(假设为第一列)
-le = LabelEncoder()
-tq_df['24ST'] = le.fit_transform(tq_df['24ST'])
-print(tq_df)
-
-file2=os.getcwd()+'/气象数据.csv'
-try:
- tq_df.to_csv(file2,encoding='gbk')
-except:
- tq_df.to_csv(file2,encoding='utf-8')
-
-elec_df = pd.read_excel(r'C:\Users\鸽子\Desktop\杭州\杭州日电量.xlsx')
-elec_df['售电量'] = (elec_df['售电量']/10000).map(lambda x:round(x,2))
-
-print(elec_df.columns)
-elec_df.sort_values(by=' 天 ',ascending=True,inplace=True)
-elec_df[' 天 '] = pd.to_datetime(elec_df[' 天 '],format='%Y%m%d')
-print(elec_df.info())
-print(elec_df)
-
-df = pd.merge(tq_df,elec_df,left_on='dtdate',right_on=' 天 ')
-df.drop(columns=' 天 ',inplace=True)
-
-df.set_index('dtdate',inplace=True,drop=True)
-print(df)
-df.to_csv(os.getcwd()+'\入模数据.csv',encoding='gbk')
-
-
-
-
-
+import pandas as pd
+import datetime
+from sklearn.preprocessing import LabelEncoder
+import os
+import math
+import chinese_calendar as cc
+is_holiday = cc.is_workday(datetime.date(2023, 10, 7))
+print(is_holiday)
+
+def holiday_work(x):
+ if cc.is_workday(x):
+ return 0
+ if cc.is_holiday(x):
+ return 1
+
+tq_df = pd.read_excel(r'C:\Users\鸽子\Desktop\杭州\杭州气象数据.xlsx',sheet_name=0)
+pd.set_option('display.width',None)
+tq_df.columns = tq_df.columns.map(lambda x:x.strip())
+tq_df = tq_df[['city_name','dtdate','tem_max','tem_min','rh','rh_max','rh_min','pre','prs','prs_max','prs_min','win_s_max','win_s_min']]
+tq_df.drop_duplicates(subset='dtdate',inplace=True)
+tq_df = tq_df.sort_values(by='dtdate',ascending=True)
+tq_df.reset_index(inplace=True,drop=True)
+
+tq_df['dtdate'] = pd.to_datetime(tq_df['dtdate'],format='%Y%m%d')
+tq_df['holiday'] = tq_df['dtdate'].apply(holiday_work)
+print(tq_df.columns)
+print(tq_df.head())
+
+
+
+print(tq_df.info())
+def jq(y,x):
+ a=365.242 * (y - 1900) + 6.2 + 15.22 * x - 1.9 * math.sin(0.262 * x)
+ return datetime.date(1899,12,31)+datetime.timedelta(days=int(a))
+# print(jq(2020,0))
+jq_list=['小寒', '大寒', '立春', '雨水', '惊蛰', '春分', '清明', '谷雨', '立夏', '小满', '芒种', '夏至', '小暑', '大暑', '立秋', '处暑', '白露', '秋分', '寒露', '霜降', '立冬', '小雪', '大雪','冬至']
+jq_dict={}
+for j in range(2019,2024):
+ for i in range(24):
+ jq_dict[jq(j,i).strftime('%Y-%m-%d')]=jq_list[i]
+print(jq_dict)
+
+tq_df['24ST']=tq_df.dtdate
+tq_df['24ST']=tq_df['24ST'].astype('string').map(jq_dict)
+tq_df['24ST'].fillna(method='ffill',inplace=True)
+tq_df['24ST'].fillna('冬至',inplace=True)
+
+
+# data为数据集 product_tags为需要编码的特征列(假设为第一列)
+le = LabelEncoder()
+tq_df['24ST'] = le.fit_transform(tq_df['24ST'])
+print(tq_df)
+
+file2=os.getcwd()+'/气象数据.csv'
+try:
+ tq_df.to_csv(file2,encoding='gbk')
+except:
+ tq_df.to_csv(file2,encoding='utf-8')
+
+elec_df = pd.read_excel(r'C:\Users\鸽子\Desktop\杭州\杭州日电量.xlsx')
+elec_df['售电量'] = (elec_df['售电量']/10000).map(lambda x:round(x,2))
+
+print(elec_df.columns)
+elec_df.sort_values(by=' 天 ',ascending=True,inplace=True)
+elec_df[' 天 '] = pd.to_datetime(elec_df[' 天 '],format='%Y%m%d')
+print(elec_df.info())
+print(elec_df)
+
+df = pd.merge(tq_df,elec_df,left_on='dtdate',right_on=' 天 ')
+df.drop(columns=' 天 ',inplace=True)
+
+df.set_index('dtdate',inplace=True,drop=True)
+print(df)
+df.to_csv(os.getcwd()+'\入模数据.csv',encoding='gbk')
+
+
+
+
+
diff --git a/浙江行业电量/浙江所有地市133行业数据/丽水133行业数据(全).xlsx b/浙江行业电量/浙江所有地市133行业数据/丽水133行业数据(全).xlsx
new file mode 100644
index 0000000..802bea9
Binary files /dev/null and b/浙江行业电量/浙江所有地市133行业数据/丽水133行业数据(全).xlsx differ
diff --git a/浙江行业电量/浙江所有地市133行业数据/台州133行业数据(全).xlsx b/浙江行业电量/浙江所有地市133行业数据/台州133行业数据(全).xlsx
new file mode 100644
index 0000000..abf88f4
Binary files /dev/null and b/浙江行业电量/浙江所有地市133行业数据/台州133行业数据(全).xlsx differ
diff --git a/浙江行业电量/浙江所有地市133行业数据/嘉兴133行业数据(全).xlsx b/浙江行业电量/浙江所有地市133行业数据/嘉兴133行业数据(全).xlsx
new file mode 100644
index 0000000..d050fe1
Binary files /dev/null and b/浙江行业电量/浙江所有地市133行业数据/嘉兴133行业数据(全).xlsx differ
diff --git a/浙江行业电量/浙江所有地市133行业数据/宁波133行业数据(全).xlsx b/浙江行业电量/浙江所有地市133行业数据/宁波133行业数据(全).xlsx
new file mode 100644
index 0000000..e57dd5c
Binary files /dev/null and b/浙江行业电量/浙江所有地市133行业数据/宁波133行业数据(全).xlsx differ
diff --git a/浙江行业电量/浙江所有地市133行业数据/杭州133行业数据(全).xlsx b/浙江行业电量/浙江所有地市133行业数据/杭州133行业数据(全).xlsx
new file mode 100644
index 0000000..9d29e5e
Binary files /dev/null and b/浙江行业电量/浙江所有地市133行业数据/杭州133行业数据(全).xlsx differ
diff --git a/浙江行业电量/浙江所有地市133行业数据/温州133行业数据(全).xlsx b/浙江行业电量/浙江所有地市133行业数据/温州133行业数据(全).xlsx
new file mode 100644
index 0000000..ad8cab4
Binary files /dev/null and b/浙江行业电量/浙江所有地市133行业数据/温州133行业数据(全).xlsx differ
diff --git a/浙江行业电量/浙江所有地市133行业数据/湖州133行业数据(全).xlsx b/浙江行业电量/浙江所有地市133行业数据/湖州133行业数据(全).xlsx
new file mode 100644
index 0000000..7972a34
Binary files /dev/null and b/浙江行业电量/浙江所有地市133行业数据/湖州133行业数据(全).xlsx differ
diff --git a/浙江行业电量/浙江所有地市133行业数据/绍兴133行业数据(全).xlsx b/浙江行业电量/浙江所有地市133行业数据/绍兴133行业数据(全).xlsx
new file mode 100644
index 0000000..81696d1
Binary files /dev/null and b/浙江行业电量/浙江所有地市133行业数据/绍兴133行业数据(全).xlsx differ
diff --git a/浙江行业电量/浙江所有地市133行业数据/舟山133行业数据(全).xlsx b/浙江行业电量/浙江所有地市133行业数据/舟山133行业数据(全).xlsx
new file mode 100644
index 0000000..2601aa5
Binary files /dev/null and b/浙江行业电量/浙江所有地市133行业数据/舟山133行业数据(全).xlsx differ
diff --git a/浙江行业电量/浙江所有地市133行业数据/衢州133行业数据(全).xlsx b/浙江行业电量/浙江所有地市133行业数据/衢州133行业数据(全).xlsx
new file mode 100644
index 0000000..61b975f
Binary files /dev/null and b/浙江行业电量/浙江所有地市133行业数据/衢州133行业数据(全).xlsx differ
diff --git a/杭州日电量/浙江所有地市133行业数据/金华133行业数据(全).xlsx b/浙江行业电量/浙江所有地市133行业数据/金华133行业数据(全).xlsx
similarity index 85%
rename from 杭州日电量/浙江所有地市133行业数据/金华133行业数据(全).xlsx
rename to 浙江行业电量/浙江所有地市133行业数据/金华133行业数据(全).xlsx
index 4222aee..f59214c 100644
Binary files a/杭州日电量/浙江所有地市133行业数据/金华133行业数据(全).xlsx and b/浙江行业电量/浙江所有地市133行业数据/金华133行业数据(全).xlsx differ
diff --git a/杭州日电量/滚动预测.py b/浙江行业电量/滚动预测.py
similarity index 100%
rename from 杭州日电量/滚动预测.py
rename to 浙江行业电量/滚动预测.py
diff --git a/浙江行业电量/输出为3.py b/浙江行业电量/输出为3.py
new file mode 100644
index 0000000..de6655c
--- /dev/null
+++ b/浙江行业电量/输出为3.py
@@ -0,0 +1,160 @@
+import numpy as np
+import pandas as pd
+import torch
+from torch import nn
+from multiprocessing import Pool
+import matplotlib.pyplot as plt
+import os
+os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
+DAYS_FOR_TRAIN = 10
+torch.manual_seed(42)
+class LSTM_Regression(nn.Module):
+
+ def __init__(self, input_size, hidden_size, output_size=1, num_layers=2):
+ super().__init__()
+
+ self.lstm = nn.LSTM(input_size, hidden_size, num_layers)
+ self.fc = nn.Linear(hidden_size, output_size)
+
+ def forward(self, _x):
+ x, _ = self.lstm(_x) # _x is input, size (seq_len, batch, input_size)
+ s, b, h = x.shape # x is output, size (seq_len, batch, hidden_size)
+ x = x.view(s * b, h)
+ x = self.fc(x)
+ x = x.view(s, b, -1) # 把形状改回来
+ return x
+
+
+def create_dataset(data, days_for_train=5) -> (np.array, np.array):
+ dataset_x, dataset_y = [], []
+ for i in range(len(data) - days_for_train-3):
+ _x = data[i:(i + days_for_train)]
+ dataset_x.append(_x)
+ dataset_y.append(data[i + days_for_train:i + days_for_train+3])
+ return (np.array(dataset_x), np.array(dataset_y))
+
+def normal(nd):
+ high = nd.describe()['75%'] + 1.5*(nd.describe()['75%']-nd.describe()['25%'])
+ low = nd.describe()['25%'] - 1.5*(nd.describe()['75%']-nd.describe()['25%'])
+ return nd[(ndlow)]
+
+def run(file_dir,excel):
+ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
+
+ data = pd.read_excel(os.path.join(file_dir,excel), sheet_name=0,index_col=' stat_date ')
+
+ data.columns = data.columns.map(lambda x: x.strip())
+
+ data.index = pd.to_datetime(data.index,format='%Y%m%d')
+ data.sort_index(inplace=True)
+ print(data.head())
+ data = data.loc['2021-01':'2023-09']
+
+ data.drop(columns=[i for i in data.columns if (data[i] == 0).sum() / len(data) >= 0.5], inplace=True) # 去除0值列
+ print('len(data):', len(data))
+ for industry in data.columns:
+ df = data[industry]
+ df = df[df.values != 0] # 去除0值行
+ df = normal(df)
+ df = df.astype('float32').values # 转换数据类型
+
+
+ # 标准化到0~1
+ max_value = np.max(df)
+ min_value = np.min(df)
+ df = (df - min_value) / (max_value - min_value)
+
+ dataset_x, dataset_y = create_dataset(df, DAYS_FOR_TRAIN)
+ print('len(dataset_x:)', len(dataset_x))
+
+ # 划分训练集和测试集
+ train_size = len(dataset_x) - 3
+ train_x = dataset_x[:train_size]
+ train_y = dataset_y[:train_size]
+
+ # 将数据改变形状,RNN 读入的数据维度是 (seq_size, batch_size, feature_size)
+ train_x = train_x.reshape(-1, 1, DAYS_FOR_TRAIN)
+ train_y = train_y.reshape(-1, 1, 3)
+
+ # 转为pytorch的tensor对象
+ train_x = torch.from_numpy(train_x).to(device)
+ train_y = torch.from_numpy(train_y).to(device)
+
+ model = LSTM_Regression(DAYS_FOR_TRAIN, 32, output_size=3, num_layers=2).to(device) # 导入模型并设置模型的参数输入输出层、隐藏层等
+
+
+ train_loss = []
+ loss_function = nn.MSELoss()
+ optimizer = torch.optim.Adam(model.parameters(), lr=0.005, betas=(0.9, 0.999), eps=1e-08, weight_decay=0)
+ for i in range(1500):
+ out = model(train_x)
+ loss = loss_function(out, train_y)
+ loss.backward()
+ optimizer.step()
+ optimizer.zero_grad()
+ train_loss.append(loss.item())
+ # print(loss)
+ # 保存模型
+ # torch.save(model.state_dict(),save_filename)
+ # torch.save(model.state_dict(),os.path.join(model_save_dir,model_file))
+
+ # for test
+ model = model.eval() # 转换成测试模式
+ # model.load_state_dict(torch.load(os.path.join(model_save_dir,model_file))) # 读取参数
+ dataset_x = dataset_x.reshape(-1, 1, DAYS_FOR_TRAIN) # (seq_size, batch_size, feature_size)
+ dataset_x = torch.from_numpy(dataset_x).to(device)
+
+ pred_test = model(dataset_x) # 全量训练集
+ # 模型输出 (seq_size, batch_size, output_size)
+ pred_test = pred_test.view(-1)
+ pred_test = np.concatenate((np.zeros(DAYS_FOR_TRAIN), pred_test.cpu().detach().numpy()))
+
+ # plt.plot(pred_test, 'r', label='prediction')
+ # plt.plot(df, 'b', label='real')
+ # plt.plot((train_size, train_size), (0, 1), 'g--') # 分割线 左边是训练数据 右边是测试数据的输出
+ # plt.legend(loc='best')
+ # plt.show()
+
+
+ # 创建测试集
+ result_list = []
+ # 以x为基础实际数据,滚动预测未来3天
+ x = torch.from_numpy(df[-14:-4]).to(device)
+ pred = model(x.reshape(-1,1,DAYS_FOR_TRAIN)).view(-1).detach().numpy()
+
+
+ # for i in range(3):
+ # next_1_8 = x[1:]
+ # next_9 = model(x.reshape(-1,1,DAYS_FOR_TRAIN))
+ # # print(next_9,next_1_8)
+ # x = torch.concatenate((next_1_8, next_9.view(-1)))
+ # result_list.append(next_9.view(-1).item())
+
+
+ # 反归一化
+ pred = pred * (max_value - min_value) + min_value
+ df = df * (max_value - min_value) + min_value
+
+ print(pred)
+ # 打印指标
+ print(abs(pred - df[-3:]).mean() / df[-3:].mean())
+ result_eight = pd.DataFrame({'pred': np.round(pred,1),'real': df[-3:]})
+ target = (result_eight['pred'].sum() - result_eight['real'].sum()) / df[-31:].sum()
+ result_eight['loss_rate'] = round(target, 5)
+ print(target)
+ print(result_eight)
+
+
+ # result_eight.to_csv(f'./月底预测结果/9月{excel[:2]}.txt', sep='\t', mode='a')
+ # with open(fr'./偏差/9月底偏差率.txt', 'a', encoding='utf-8') as f:
+ # f.write(f'{excel[:2]}{industry}:{round(target, 5)}\n')
+
+if __name__ == '__main__':
+ file_dir = r'C:\python-project\pytorch3\浙江行业电量\浙江所有地市133行业数据'
+
+ run(file_dir,'丽水133行业数据(全).xlsx')
+ # p = Pool(4)
+ # for excel in os.listdir(file_dir):
+ # p.apply_async(func=run,args=(file_dir,excel))
+ # p.close()
+ # p.join()
\ No newline at end of file