利用支持向量机模型进行电力数据预测,其中,平均温度、最高温度、最低温度、相对湿度、星期类型为自变量,24小时的电力数据为因变量,2月15日到3月18日数据为样本数据,3月19日到4月15日为测试数据。
电力数据
日期 | 平均温度 | 最高温度 | 最低温度 | 相对湿度 | 星期类型 | 0小时 | 1小时 | 2小时 | 3小时 | 4小时 | 5小时 | 6小时 | 7小时 | 8小时 | 9小时 | 10小时 | 11小时 | 12小时 | 13小时 | 14小时 | 15小时 | 16小时 | 17小时 | 18小时 | 19小时 | 20小时 | 21小时 | 22小时 | 23小时 |
2月15日 | 11.5 | 13.5 | 10.8 | 0.77 | 0.3 | 55.52 | 51.3 | 50.08 | 48.24 | 46.1 | 45.98 | 48.78 | 56.89 | 70.98 | 69.94 | 76.21 | 78.42 | 69.24 | 76.97 | 77.49 | 76.9 | 79.72 | 79.47 | 80.31 | 81.45 | 78.76 | 75.56 | 67.75 | 61.2 |
2月16日 | 8.6 | 11.2 | 6.4 | 0.79 | 0.7 | 53.66 | 52.04 | 49.12 | 48.12 | 49.08 | 47.81 | 50.45 | 61.45 | 78.39 | 86.55 | 89.45 | 91.23 | 80.18 | 86.15 | 87.64 | 88.64 | 91.46 | 88.83 | 89.48 | 90.38 | 87.56 | 82.98 | 75.31 | 66.31 |
2月17日 | 7.1 | 8.4 | 6.1 | 0.84 | 0.8 | 57.94 | 54.28 | 52.43 | 51.02 | 52.22 | 52.23 | 54.63 | 65.49 | 83.75 | 92.9 | 96.65 | 93.62 | 82.4 | 91.57 | 91.4 | 90.35 | 94.91 | 91.33 | 92.15 | 91.7 | 88.86 | 84.91 | 78.01 | 69.32 |
2月18日 | 7.8 | 8.6 | 6.9 | 0.93 | 0.8 | 63 | 58.62 | 56.92 | 55.28 | 54.16 | 55.09 | 56.12 | 65.98 | 85.47 | 93.48 | 97.28 | 96.81 | 85.49 | 95.08 | 94.18 | 94.25 | 95.77 | 92.25 | 90.2 | 93.33 | 91.94 | 86.42 | 78.91 | 72.89 |
2月19日 | 11.4 | 15.7 | 8.4 | 0.91 | 0.8 | 62.13 | 59.62 | 55.58 | 54.73 | 55.46 | 55.05 | 57.98 | 67.01 | 84.46 | 90.88 | 89.87 | 92.64 | 81.88 | 86.44 | 85.62 | 83.95 | 86.11 | 82.58 | 85.92 | 88 | 89.16 | 85.66 | 77.06 | 70.86 |
2月20日 | 10.6 | 14.2 | 8 | 0.58 | 0.8 | 62.36 | 60.21 | 57.46 | 54.77 | 53.37 | 53.7 | 56.49 | 67.05 | 84.94 | 87.29 | 90.94 | 90.11 | 79.99 | 88.97 | 88.85 | 86.86 | 87.94 | 84.65 | 87.69 | 90.4 | 88.56 | 84.32 | 78.33 | 70.17 |
2月21日 | 9.6 | 14.2 | 4.9 | 0.72 | 0.4 | 62.79 | 58.31 | 56.29 | 54.56 | 51.83 | 52.29 | 54.69 | 63.43 | 81.45 | 87.11 | 88.5 | 88.83 | 74.39 | 83.02 | 83.61 | 83.98 | 87.19 | 89 | 85.59 | 88.32 | 86.05 | 82.37 | 76.72 | 69.5 |
2月22日 | 15.3 | 22.8 | 10.7 | 0.77 | 0.3 | 62.37 | 58.11 | 55.48 | 53.41 | 52.08 | 52.15 | 52.91 | 60.28 | 76.87 | 81.11 | 83.17 | 82.04 | 70.53 | 76.66 | 78.65 | 76.53 | 78.5 | 76.61 | 80.1 | 82.9 | 81.65 | 79.69 | 72.3 | 66.43 |
2月23日 | 11.4 | 13.5 | 10 | 0.8 | 0.7 | 61.11 | 56.95 | 54.21 | 52.51 | 53.03 | 54 | 54.78 | 64.19 | 81.8 | 88.04 | 91.58 | 91.86 | 77.13 | 89.1 | 90.69 | 91.18 | 93.67 | 90.11 | 89.09 | 91.09 | 88.56 | 84.18 | 77.85 | 70.3 |
2月24日 | 12.7 | 15 | 10 | 0.89 | 0.8 | 62.06 | 57.67 | 55.98 | 54.13 | 52.68 | 54.22 | 57.1 | 66.5 | 80.94 | 86.36 | 89.92 | 85.02 | 72.17 | 81.12 | 83.55 | 80.28 | 88.27 | 86.56 | 86.92 | 89.31 | 86.07 | 84.87 | 75.5 | 67.54 |
2月25日 | 12.6 | 15.6 | 10.2 | 0.83 | 0.8 | 60.23 | 55.74 | 52.87 | 52.52 | 50.98 | 52.25 | 55.91 | 65.87 | 84.17 | 89.64 | 92.36 | 93.34 | 82.11 | 87.98 | 89.48 | 89.61 | 90.49 | 89.93 | 87.61 | 91.46 | 88.62 | 85.41 | 76.75 | 69.64 |
2月26日 | 8.7 | 10.5 | 7.8 | 0.83 | 0.8 | 61.45 | 58.35 | 55.92 | 54.05 | 52.79 | 54.49 | 59.95 | 67.1 | 85.74 | 90.91 | 94.23 | 94.65 | 82.35 | 91.48 | 91.03 | 93.11 | 93.21 | 89.72 | 90.65 | 93.48 | 90.37 | 86.16 | 78.77 | 71.21 |
2月27日 | 8.6 | 10.3 | 7.4 | 0.78 | 0.8 | 64.02 | 59.38 | 57.55 | 55.74 | 54.77 | 55.51 | 58.21 | 68.57 | 87.27 | 95.65 | 96.96 | 97.86 | 83.21 | 91.25 | 92.88 | 91.83 | 93.05 | 92.5 | 90.7 | 94.36 | 92.35 | 88.14 | 81.59 | 73.68 |
2月28日 | 7.3 | 8.5 | 6.3 | 0.75 | 0.4 | 65.26 | 61.69 | 60.05 | 58.28 | 55.52 | 56.35 | 58.62 | 65.23 | 85.51 | 90.45 | 91.86 | 92.79 | 79.7 | 90.21 | 90.34 | 89.8 | 92.68 | 91.8 | 89.21 | 93.19 | 90.24 | 85.62 | 78.64 | 74.31 |
3月1日 | 6.9 | 9.3 | 6 | 0.77 | 0.3 | 64.68 | 60.23 | 56.79 | 55.52 | 52.94 | 52.45 | 53.93 | 60.64 | 75.38 | 82.44 | 86.23 | 84.71 | 76.68 | 84.02 | 83.95 | 84.25 | 85.96 | 86.48 | 87.37 | 90.01 | 88.69 | 85.88 | 75.13 | 70.05 |
3月2日 | 7.5 | 8.4 | 6.8 | 0.83 | 0.7 | 61.59 | 57.54 | 55.48 | 51.58 | 52.31 | 52.91 | 55.72 | 66.7 | 83.93 | 96.73 | 99.7 | 100.19 | 89.22 | 99.69 | 97.05 | 98.78 | 100.83 | 95.36 | 91.56 | 94.95 | 93.14 | 89.25 | 82.33 | 74.58 |
3月3日 | 7 | 8.8 | 4.7 | 0.84 | 0.8 | 65.82 | 61.78 | 59.84 | 58.74 | 57.2 | 57.22 | 60.32 | 70.56 | 90.42 | 97.29 | 103.35 | 101.75 | 91.04 | 99.29 | 99.28 | 98.28 | 102.47 | 100.38 | 95.55 | 100.23 | 96.61 | 92.6 | 84.2 | 74.88 |
3月4日 | 6.9 | 8.7 | 5.6 | 0.87 | 0.8 | 69.04 | 63.99 | 60.42 | 58.41 | 58.04 | 58.47 | 62.27 | 72.82 | 90.76 | 99.97 | 101.93 | 101.08 | 91.16 | 99.63 | 100.92 | 100.35 | 103.45 | 99.96 | 97.27 | 100.12 | 96.77 | 92.17 | 85.39 | 76.82 |
3月5日 | 9.6 | 12.3 | 7.4 | 0.92 | 0.8 | 67.68 | 63.62 | 61.47 | 58.83 | 60.05 | 58.85 | 61.53 | 69.28 | 90.92 | 99.71 | 103.97 | 105.53 | 91.66 | 100.31 | 100.54 | 100.24 | 102.27 | 97.68 | 93.34 | 97.97 | 95.37 | 84.89 | 83.4 | 77.75 |
3月6日 | 9.1 | 10.7 | 8.3 | 0.64 | 0.8 | 67.4 | 63.64 | 58.86 | 59.03 | 57.46 | 57.04 | 60.3 | 69.93 | 90.33 | 99.38 | 101.26 | 103.25 | 88.37 | 98.12 | 98.13 | 97.55 | 97.5 | 88.53 | 91.57 | 93.58 | 92.12 | 89.5 | 81.83 | 77.55 |
3月7日 | 6.8 | 9 | 5.1 | 0.74 | 0.4 | 67.54 | 63.56 | 61 | 58.27 | 58.28 | 58.19 | 59.65 | 67.56 | 85.89 | 90.55 | 94.49 | 96.64 | 82.43 | 92.65 | 92.37 | 92.13 | 94.26 | 94.43 | 92.34 | 96.23 | 94.45 | 89.16 | 83.75 | 77.5 |
3月8日 | 8.3 | 13.6 | 3.8 | 0.79 | 0.3 | 67.68 | 63.29 | 60.43 | 58.72 | 56.94 | 56.63 | 59.12 | 64.05 | 80.82 | 86.21 | 88.23 | 87.18 | 75.15 | 83.05 | 82.24 | 81.94 | 86.12 | 89.71 | 87.36 | 91.24 | 90.25 | 88.35 | 79.96 | 71.79 |
3月9日 | 10.9 | 16.5 | 8.5 | 0.79 | 0.7 | 64.25 | 60.5 | 56.98 | 55.31 | 54.74 | 54.06 | 59.37 | 67.41 | 86.52 | 95.07 | 99.37 | 94.91 | 79.77 | 89.56 | 87.49 | 89.03 | 89.34 | 84.73 | 86.26 | 93.58 | 92.14 | 88.94 | 82.23 | 74.08 |
3月10日 | 10.7 | 17.2 | 6.2 | 0.77 | 0.8 | 66.69 | 61.77 | 59.17 | 58.62 | 57.39 | 58.3 | 60.06 | 71.17 | 89.14 | 91.07 | 85.75 | 89.16 | 77.77 | 85.36 | 86.88 | 86.18 | 89.45 | 86.36 | 85.24 | 88.91 | 89.3 | 86.97 | 79.76 | 71.12 |
3月11日 | 12.2 | 13.1 | 10.3 | 0.78 | 0.8 | 63.86 | 59.28 | 56.17 | 53.66 | 54.64 | 53.6 | 58.72 | 64.02 | 71.01 | 77.11 | 79.41 | 80.45 | 71.29 | 77.27 | 76.36 | 75.41 | 78.12 | 76.9 | 84.1 | 89.88 | 87.83 | 82.36 | 76.63 | 71.66 |
3月12日 | 15 | 21.7 | 10.8 | 0.89 | 0.8 | 63.34 | 59.59 | 58.35 | 57.08 | 56.74 | 55.78 | 60.02 | 71.37 | 88.66 | 94.67 | 96.22 | 94.18 | 78.75 | 86.09 | 87.09 | 87.35 | 87.75 | 86 | 83.71 | 89.71 | 89.49 | 85.67 | 78.4 | 72.41 |
3月13日 | 11.2 | 15.5 | 5.5 | 0.84 | 0.8 | 64.8 | 60.21 | 58.33 | 54.12 | 55.87 | 55.66 | 60.19 | 69.98 | 87.16 | 89.18 | 95.46 | 96.29 | 83.89 | 95.64 | 93.91 | 93.31 | 95.19 | 94.8 | 91.09 | 93.68 | 93.15 | 89.69 | 82.78 | 74.83 |
3月14日 | 7.9 | 13.6 | 4.1 | 0.65 | 0.4 | 67.3 | 63.22 | 59.73 | 58.02 | 57.12 | 57.65 | 60.5 | 71.19 | 87.47 | 90.7 | 93.17 | 89.46 | 75.8 | 84.33 | 84.53 | 85.42 | 85.1 | 84.69 | 83.28 | 91.59 | 89.9 | 85.91 | 79.47 | 72.4 |
3月15日 | 9.8 | 17.3 | 3.1 | 0.67 | 0.3 | 65.74 | 60.93 | 58.84 | 57.01 | 56.1 | 54.79 | 59.2 | 66.3 | 81.07 | 83.91 | 87.25 | 86.58 | 72.5 | 82.43 | 82.05 | 81.85 | 82.6 | 82.16 | 80.97 | 86.92 | 86.7 | 84.47 | 77.19 | 68.51 |
3月16日 | 13.9 | 23.9 | 6.2 | 0.75 | 0.7 | 60.06 | 55.67 | 52.83 | 52.08 | 51.13 | 49.41 | 56.74 | 67.87 | 86.05 | 90.91 | 93.34 | 91.65 | 74.84 | 86.32 | 86.49 | 85.64 | 87.8 | 84.26 | 81.74 | 88.31 | 88.87 | 85.96 | 78.33 | 68.47 |
3月17日 | 15.9 | 24.9 | 9.7 | 0.79 | 0.8 | 61.7 | 57.07 | 53.67 | 53.08 | 53.79 | 55 | 58.27 | 67.68 | 84.68 | 89.71 | 92.04 | 89.71 | 74.46 | 85.38 | 87.47 | 86.5 | 89.53 | 86.06 | 83.69 | 89.64 | 87.63 | 85.06 | 78.16 | 69.96 |
3月18日 | 18.6 | 25.2 | 12.8 | 0.7 | 0.8 | 61.12 | 57.65 | 55.4 | 52.62 | 52.06 | 54.96 | 59.35 | 67.6 | 85.11 | 91.06 | 92.66 | 91.64 | 74.8 | 86.49 | 87.74 | 87.7 | 89.09 | 88 | 85.11 | 90.03 | 88.22 | 85.82 | 75.37 | 67.12 |
3月19日 | 20.7 | 27.6 | 17.2 | 0.74 | 0.8 | 61.14 | 55.83 | 53.9 | 53.2 | 51.23 | 51.93 | 56.91 | 65.71 | 82.83 | 88.41 | 91.46 | 90.98 | 75.92 | 85.67 | 85.64 | 86.42 | 88.83 | 87.73 | 83.58 | 89.98 | 87.57 | 84.99 | 75.8 | 68.35 |
3月20日 | 16.1 | 19.9 | 12.7 | 0.8 | 0.8 | 59.58 | 56.9 | 54.65 | 51.67 | 50.97 | 52.45 | 58.85 | 66.42 | 83.45 | 88.48 | 91.41 | 90.78 | 74.74 | 84.96 | 86.29 | 86.66 | 86.02 | 83.47 | 81.29 | 87.34 | 84.13 | 81.7 | 73.28 | 70.8 |
3月21日 | 16.5 | 20 | 12.5 | 0.78 | 0.4 | 62.34 | 56.74 | 56.1 | 54.02 | 54.43 | 53.25 | 58.15 | 65.46 | 84.17 | 87.06 | 89.33 | 89.44 | 74.77 | 84.94 | 86.22 | 85.63 | 87.61 | 86.73 | 82.84 | 86.58 | 84.57 | 82.79 | 74.42 | 68.6 |
3月22日 | 16.7 | 25.2 | 15.2 | 0.81 | 0.3 | 60.05 | 58 | 55.17 | 53.61 | 52.73 | 51.25 | 54.69 | 61.1 | 75.97 | 81.34 | 83.2 | 81.26 | 69.02 | 78.29 | 78.6 | 79.99 | 81.69 | 82.27 | 79.24 | 82.95 | 82.35 | 78.82 | 72.46 | 63.84 |
3月23日 | 10.7 | 15.7 | 8.4 | 0.74 | 0.7 | 56.9 | 54.09 | 52.44 | 50.81 | 51.59 | 49.56 | 54.98 | 62.68 | 82.19 | 88.07 | 92.53 | 92.48 | 80.35 | 89.42 | 90.69 | 91.69 | 94.03 | 93.52 | 89.65 | 91.67 | 87.74 | 83.98 | 76.19 | 67.88 |
3月24日 | 10.3 | 15.1 | 6.9 | 0.77 | 0.8 | 62.5 | 57.49 | 57.1 | 54.94 | 51.87 | 53.25 | 59.72 | 67.58 | 83.38 | 88.37 | 89.82 | 88.78 | 74.59 | 84.68 | 85.88 | 84.29 | 88.48 | 84.83 | 82.2 | 90.22 | 84.88 | 84.83 | 76.63 | 69.14 |
3月25日 | 11.1 | 16 | 7 | 0.75 | 0.8 | 61.32 | 57.79 | 53.4 | 53.01 | 51.47 | 52.71 | 60.38 | 66.49 | 81.97 | 86.49 | 88.22 | 86.68 | 72.18 | 82.03 | 84.32 | 83.54 | 85.86 | 83.72 | 81.8 | 89.26 | 86.92 | 84.5 | 78.91 | 70.27 |
3月26日 | 13.3 | 18.8 | 8 | 0.69 | 0.8 | 61.71 | 57.59 | 55 | 53.62 | 53.02 | 54.44 | 60.72 | 68.01 | 83.51 | 88.95 | 91.36 | 89.78 | 74.04 | 85.82 | 86.71 | 86.19 | 88.92 | 85.36 | 84 | 89.62 | 87.8 | 84.01 | 76.19 | 66.87 |
3月27日 | 12.1 | 13.1 | 11 | 0.9 | 0.8 | 59.17 | 55.95 | 54.97 | 52.92 | 52.78 | 52.95 | 57.18 | 62.99 | 80.56 | 87.04 | 89.53 | 89.92 | 76.68 | 86.03 | 84.85 | 86.39 | 87.51 | 85.86 | 83.23 | 86.83 | 85.43 | 81.91 | 74.97 | 67.98 |
3月28日 | 9.9 | 11 | 8.6 | 0.86 | 0.4 | 61.97 | 58.33 | 56.05 | 53.26 | 52.73 | 52.4 | 58.45 | 64.06 | 83.74 | 90.06 | 92.86 | 94.75 | 79.29 | 88.19 | 90.58 | 90.28 | 93.76 | 94.32 | 87.39 | 93.27 | 89.87 | 84.72 | 79.03 | 70.25 |
3月29日 | 9.2 | 11 | 7.6 | 0.8 | 0.3 | 63.2 | 58.37 | 57.27 | 55.4 | 53.54 | 53.95 | 57.54 | 63.37 | 79.24 | 85.38 | 88.85 | 89.75 | 76.8 | 86.24 | 87.2 | 86.1 | 89.25 | 88.72 | 83.83 | 87.59 | 86.58 | 84.49 | 79.64 | 70.43 |
3月30日 | 11.3 | 15.6 | 7 | 0.69 | 0.7 | 61.04 | 58.05 | 56.04 | 54.4 | 54.28 | 54.01 | 62.16 | 69.05 | 86.47 | 92.11 | 93.39 | 92.54 | 76.03 | 88.3 | 90.13 | 88.62 | 91.57 | 88.22 | 86.38 | 91.79 | 88.88 | 86.09 | 79.06 | 69.95 |
3月31日 | 12.9 | 17.3 | 9.2 | 0.68 | 0.8 | 60.37 | 58.9 | 56.25 | 54.05 | 54.85 | 54.09 | 61.33 | 68.51 | 87.58 | 91.37 | 92.25 | 91.4 | 75.07 | 87.89 | 90.88 | 88.99 | 91.16 | 88.16 | 85.82 | 92.37 | 89.95 | 86.96 | 76.98 | 68.77 |
4月1日 | 11.2 | 12.6 | 10.3 | 0.67 | 0.8 | 62.35 | 58.38 | 55.2 | 53.22 | 51.84 | 51.38 | 58.56 | 68.32 | 86.92 | 93.23 | 94.72 | 96.46 | 80.37 | 88.43 | 90.59 | 90.2 | 93.53 | 89.39 | 88.32 | 91.62 | 89.45 | 86.26 | 78.83 | 69.55 |
4月2日 | 10.3 | 13 | 6.8 | 0.55 | 0.8 | 61.52 | 59.56 | 57.46 | 55.72 | 53.99 | 55.3 | 61.15 | 69.4 | 85.17 | 90.35 | 93.61 | 93.14 | 77.11 | 88.43 | 88.48 | 87.87 | 87.52 | 86.96 | 84.63 | 88.91 | 88.98 | 86.26 | 77.65 | 70.25 |
4月3日 | 11.5 | 14.2 | 9.5 | 0.83 | 0.8 | 63.17 | 60.22 | 58.11 | 56.57 | 55.45 | 54.07 | 59.67 | 67.4 | 83.81 | 90.44 | 95.11 | 92.58 | 79.73 | 88.91 | 87.33 | 86.33 | 88.25 | 84.19 | 80.45 | 84.4 | 82.69 | 80.15 | 73.59 | 66.88 |
4月4日 | 15 | 20 | 12.2 | 0.85 | 0.1 | 58.72 | 55.19 | 54.88 | 51.73 | 49.79 | 50.2 | 52.73 | 54.9 | 61.95 | 63.38 | 64.48 | 66.01 | 59.44 | 60.9 | 61.8 | 61.85 | 62.33 | 65.06 | 65.66 | 70.91 | 69.7 | 68.62 | 61.47 | 55.14 |
4月5日 | 13 | 14.4 | 11.6 | 0.79 | 0.1 | 49.53 | 46.79 | 44.15 | 42.92 | 42.45 | 42.73 | 47.96 | 56.61 | 69.33 | 75.88 | 78.71 | 79.25 | 69.56 | 76.1 | 76.84 | 77.26 | 78.43 | 79.95 | 75.88 | 80.58 | 77.55 | 76.83 | 68.68 | 62.87 |
4月6日 | 14.3 | 20.6 | 10.6 | 0.61 | 0.1 | 56.34 | 52.68 | 51.21 | 49.32 | 49.93 | 49.58 | 54.05 | 62.79 | 77.03 | 81.3 | 86.26 | 86.06 | 71.78 | 81.09 | 82.95 | 82.91 | 84.45 | 81.38 | 78.89 | 84.79 | 84.75 | 80.93 | 74.33 | 66.54 |
4月7日 | 14 | 19.3 | 9.4 | 0.52 | 0.8 | 59.87 | 58.07 | 54.84 | 52.78 | 51.68 | 53.44 | 58.85 | 67.76 | 79.36 | 86.29 | 91.2 | 90.25 | 76.84 | 86.91 | 87 | 87.42 | 86.68 | 85.83 | 84.47 | 88.53 | 88.55 | 84.34 | 74.59 | 66.79 |
4月8日 | 15.1 | 20.4 | 12.3 | 0.66 | 0.8 | 58.66 | 56.85 | 56.01 | 53.93 | 52.81 | 53.1 | 60.1 | 68.71 | 85.63 | 89.32 | 92.83 | 92.07 | 76.14 | 85.78 | 86.79 | 88.28 | 89.59 | 86.14 | 82.55 | 88.09 | 87.1 | 85.06 | 75.22 | 66.57 |
4月9日 | 16 | 22.8 | 10.5 | 0.58 | 0.8 | 59.19 | 56.85 | 54.58 | 53.2 | 52.55 | 52.76 | 55.71 | 62.66 | 76.78 | 84.79 | 88.42 | 81 | 71.77 | 82.13 | 83.61 | 84.16 | 84.47 | 81.94 | 79.63 | 87.42 | 86.6 | 83.04 | 76.13 | 67.31 |
4月10日 | 15.5 | 20.7 | 10.8 | 0.7 | 0.8 | 59.75 | 56.28 | 54.14 | 52.17 | 53.56 | 54.01 | 60.16 | 66.66 | 83.6 | 88.18 | 92.26 | 91.26 | 74.08 | 84.28 | 86.67 | 86.96 | 87.75 | 83.41 | 80.49 | 86.9 | 85.37 | 82.44 | 75.46 | 67.31 |
4月11日 | 16.4 | 22.2 | 13.8 | 0.87 | 0.4 | 59.61 | 55.7 | 54.28 | 53.49 | 51.9 | 53.09 | 58.74 | 65.03 | 82.03 | 86.75 | 91.04 | 88.38 | 72.55 | 83.1 | 84.44 | 85.18 | 85 | 83.53 | 82.08 | 86.21 | 84.45 | 81.72 | 74.52 | 66.86 |
4月12日 | 19.2 | 24.1 | 16.2 | 0.84 | 0.3 | 59.73 | 55.41 | 54.67 | 53.81 | 51.41 | 51.39 | 55.76 | 62.25 | 77.28 | 80.91 | 84.35 | 84.3 | 69.08 | 76.03 | 77.62 | 77.87 | 80.6 | 79.45 | 75.69 | 80.58 | 81.94 | 79.26 | 70.39 | 62.79 |
4月13日 | 22.1 | 26.7 | 18.9 | 0.79 | 0.7 | 56.45 | 52.88 | 51.26 | 49.96 | 51.31 | 51.35 | 57.59 | 66.55 | 82.5 | 90.56 | 88.35 | 90.2 | 74.68 | 84.48 | 85.88 | 83.81 | 86.61 | 83.59 | 79.8 | 85.83 | 86.56 | 82.58 | 75.13 | 66.66 |
4月14日 | 19.5 | 24.7 | 17 | 0.69 | 0.8 | 57.97 | 56.6 | 54.21 | 51.75 | 53.34 | 50.82 | 60.38 | 64.03 | 80.19 | 86.05 | 87.17 | 86.35 | 72.86 | 83.35 | 84.04 | 83.72 | 86.39 | 82.63 | 80.2 | 86.52 | 85.73 | 82.57 | 75.71 | 69.25 |
4月15日 | 19.9 | 27.4 | 13.9 | 0.67 | 0.8 | 61.04 | 59.22 | 55.6 | 54.39 | 53.58 | 52.84 | 61.18 | 66.27 | 81.19 | 87.54 | 90.47 | 87.76 | 73.1 | 83.18 | 84.2 | 83.8 | 84.83 | 80.98 | 76.7 | 82.49 | 81.34 | 78.89 | 69.82 | 61.99 |
程序源代码
clc; % 清屏
close all; %清除内存以便加快运算速度
clear all %关闭当前所有figure图像
C = 30;
theta = 2; %C为最小二乘支持向量机的正则化参数,theta为高斯径向基的核函数参数,两个需要进行优化选择调试
NumOfPre = 28; %预测天数,在此预测本季度最后28天
Time = 24; % 代表一天24小时的数据
Data = xlsread('C:\Users\Administrator\Desktop\数据汇总\数据.xls'); %此为从excel表格读数据的命令,表示将表格的数据读到Data数组中,省略表格中的第一行第一列文字部分 可输入你要预测的表格名称
[M N] = size(Data); %计算读入数据的行和列 M行N列
for i = 1:3
maxData = max(Data(:,i));
minData = min(Data(:,i));
Data1(:,i) = (Data(:,i) - minData)/(maxData-minData); %对温度进行归一化处理
end
for i = 4:5
Data1(:,i) = Data(:,i);
end
for i = 6:N
Data1(:,i) = log10(Data(:,i)) ;%对负荷进行对数处理 温度和负荷的预处理 可采用不同的方法 可不必拘泥
end
Dim = M - 2 - NumOfPre; %训练样本数
Input = zeros(M-2,12,Time); %预先分配处理后的输入向量空间
y = zeros(Dim,Time);
for i = 3:M
for j = 1:Time
%%选取前一天温度、同一时刻的负荷,前两天的负荷,当天的温度作为输入特征
x = [Data1(i-1,1:5), Data1(i-1,j+5), Data1(i-2,j+5),Data1(i,1:5)];
Input(i-2,:,j) = x;
y(i-2,j) = Data1(i,j+5);
end
end
Dist = zeros(Dim,Dim,Time);%预先分配距离空间
for i=1:Time
for j=1:Dim
for k=1:Dim
Dist(j,k,i) = (Input(j,:,i) - Input(k,:,i))*(Input(j,:,i) - Input(k,:,i))';
end
end
end
Dist1 = exp(-Dist/(2*theta));%RBF
for i=1:Time
H = Dist1(:,:,i) + eye(Dim)/C;%最小二乘支持向量的H矩阵
f = -y(1:Dim,i);
Aeq = ones(Dim,1)';
beq = [0];
option.MaxIter=1000;
[a,fval]=quadprog(H,f,[],[],Aeq,beq);%,[],[],[],option);
b = 0;
for j = 1:Dim
b(j) = y(j,i) - a(j)/C - a'* Dist1(:,j,i);%求每个输入特征对应的b
end
b = sum(b)/Dim;%求平均b,消除误差
for j = Dim + 1:M-2
for k = 1:Dim
K(k) = exp(-(Input(j,:,i) - Input(k,:,i))*(Input(j,:,i) - Input(k,:,i))'/(2*theta));%预测输入特征与训练特征的RBF距离
end
Pre(j-Dim,i) = sum(a'*K') + b; %求解预测值
end
end
Len = M - (Dim + 3) + 1;%预测的天数 取本季度最后Len天
Pre = 10.^Pre;
for i = 1:Len
figure
plot(1:Time,Data(i+Dim+2,6:N),'r-o',1:Time,Pre(i,:),'b--+');%画出每一天的预测值和真实值
hold on
legend('真实值','预测值'); % 标注图例
axis([0 25 0 120]);
hold off
end
%计算相对误差
r=zeros(Len,Time);
r1=zeros(Len,1);
for i = 1:Len
for j=1:Time
r(i,j)=abs((Pre(i,j)-Data(i+Dim+2,5+j))/Data(i+Dim+2,5+j)); % r矩阵存储每天对应24小时的相对误差,一共28天
end
r1(i)=sum(r(i,:))/Time; % r1矩阵存储28天中,每一天的平均相对误差
end
程序仿真结果部分展示