# 拟合GMM出现Warning: Variances had to be floored ，求大家帮忙解答一下，谢谢！

gmm.Σ = S ./ N - gmm.μ.^2
## var flooring
tooSmall = any(gmm.Σ .< varfloor, dims=2)[:]
if (any(tooSmall))
ind = findall(tooSmall)
@warn("Variances had to be floored ", ind)
gmm.Σ[ind,:] = initc[ind, :]
end

gmm模型的理论忘得差不多了，爱莫能助

solardata 怎么获取可以贴出来吗？

gmm = GMM(5, solardata)
means(gmm)

K-means converged with 39 iterations (objv = 8.377615864125614e7)
┌ Info: Initializing GMM, 5 Gaussians diag covariance 5 dimensions using 2975 data points
└ @ GaussianMixtures /root/.julia/packages/GaussianMixtures/1pQcF/src/train.jl:79
┌ Info: K-means with 2975 data points using 39 iterations
│ 99.2 data points per parameter
└ @ GaussianMixtures /root/.julia/packages/GaussianMixtures/1pQcF/src/train.jl:140
┌ Warning: Variances had to be floored
│   ind = [1]
└ @ GaussianMixtures /root/.julia/packages/GaussianMixtures/1pQcF/src/train.jl:259
┌ Warning: Variances had to be floored
│   ind = [1]
└ @ GaussianMixtures /root/.julia/packages/GaussianMixtures/1pQcF/src/train.jl:259
5×5 Array{Float64,2}:
0.00125469     0.00162941    0.00311547     0.00174645     0.00292673
271.996        283.059       479.888        281.684        280.831
65.1878        68.6662      140.428         63.8164        62.708
1067.72        1009.85        656.021       1190.13        1235.06
632.132        618.535       658.592        673.808        675.271

covars(gmm)
┌ Info: Initializing GMM, 5 Gaussians diag covariance 5 dimensions using 2975 data points
└ @ GaussianMixtures /root/.julia/packages/GaussianMixtures/1pQcF/src/train.jl:79
K-means converged with 20 iterations (objv = 8.381541283955944e7)
┌ Info: K-means with 2975 data points using 20 iterations
│ 99.2 data points per parameter
└ @ GaussianMixtures /root/.julia/packages/GaussianMixtures/1pQcF/src/train.jl:140
┌ Warning: Variances had to be floored
│   ind = [1]
└ @ GaussianMixtures /root/.julia/packages/GaussianMixtures/1pQcF/src/train.jl:259
┌ Warning: Variances had to be floored
│   ind = [1]
└ @ GaussianMixtures /root/.julia/packages/GaussianMixtures/1pQcF/src/train.jl:259
5×5 Array{Float64,2}:
310.171    331.483   1085.37    296.477    329.601
7646.51   10819.6    53832.6    9092.55   14146.2
2806.51    3360.91   18259.9    2925.23    3803.74
9148.71   36350.6    45839.8   13268.8    23035.0
24303.3    36462.9    67745.8   31106.2    47137.0

# Corrected Upscaled Measurement [MW]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
8.7
39.59
81.66
126.56
172.48
218.18
271.94
333.57
400.54
476.79
572.39
691.38
800.56
862.71
900.42
953.11
966.89
954.75
923.72
872.62
782.13
683.44
599.86
515.34
437.7
349.39
281.6
213.1
149.23
96.26
50.53
18.19
2.07
0.1
0.05
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.01
1.21
15.55
41.52
75.78
127.86
190.38
231.62
275.64
315.37
309.21
326.42
355.37
381.37
389.83
386.56
397.17
414.31
399.32
409.97
426.59
431.71
427.02
417.49
357.46
279.62
225.75
171.51
119.74
79.45
44.37
18.76
3.56
0.15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.83
2.51
11.86
27.61
44.76
64.16
84.18
111.32
140.73
166.37
189.25
206
221.37
231.08
235.34
237.78
227.05
207.94
205.48
197.82
188.48
161.71
143.22
122.57
105.37
83.58
57.34
38.25
25.88
14.04
5.54
0.99
0.12
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.06
0.82
1.58
6.89
17.4
33.63
50
67.04
78.02
85.66
95.98
104.56
119.3
132.66
155.82
162.58
156.71
164.14
170
172.16
168.35
161.3
129.22
122.49
112.1
90.72
77.35
59.78
46.8
33.17
17.78
7.59
1.75
0.32
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.02
6.98
1.97
5.5
16.25
29.55
42.28
61.34
81.06
93.02
100.42
111.25
113
118.87
117.48
117.56
117.26
117.21
110.78
107.84
100.5
94.71
86.84
77.26
67.61
56.14
46.13
35.24
24.01
14.92
6.93
1.41
0.27
0.21
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.03
0.75
4.04
15.48
33.21
58.42
87.19
115.83
138.67
149.26
151.73
170.52
188.94
199.17
223.4
245.26
262.05
264.83
279.18
297.19
285.53
259.7
245.35
228.81
215.16
202.24
182.08
162.23
125.53
94
64.64
36.09
11.78
0.92
0.07
0.04
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.08
2.73
21.22
55.24
86.25
130.99
181.45
232.08
286.63
344.4
391.35
443.28
469.98
486.82
503.11
540.76
567.7
547.23
551.63
544.63
484.89
430.61
380.72
368.06
313.47
269.71
213.12
173.39
133.28
93.15
61.05
31.72
10.2
1
0.14
0.07
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.01
2.7
15.5
39.06
73.42
110.34
151.52
207.73
254.63
297.3
327.3
428.18
473.57
480.39
493.12
516.46
511.57
553.78
531.7
483.62
434.07
379.18
319.6
284.71
245.01
196.72
157.55
128.35
105.32
71.24
47
25.11
7.05
0.81
0.29
0.15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.04
8.62
36.92
79.04
133.85
200.05
271.73
363.7
458.96
565.04
656.72
748.86
807.41
892.48
969.19
1031.9
1058.83
1049.3
1047.19
983.7
937.98
870.08
783.54
699.48
606.02
519.6
430.42
346.49
273.52
198.98
134.74
77.41
34.06
8.54
0.44
0.22
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.37
12.56
44.88
91.31
155.17
237.8
331.58
446.34
565.49
670.42
779.86
877.44
986.41
1058.36
1156.1
1208.41
1232.9
1275.32
1303.2
1237.74
1115.33
997.51
867.19
778.62
675.68
590.2
494.4
403.65
329.29
238.55
158.03
87.16
37.62
8.14
0.41
0.2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
2.93
10.22
29.89
55.41
72
89.28
122.69
149.46
172.07
206.79
232.3
268.57
272.38
270.12
263.96
266.99
291.11
320.43
346.67
321.42
321.6
304.7
257.15
228.78
200.98
163.69
131.72
108.51
79.78
50.12
27.68
10.59
1.58
0.77
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.03
0.31
1.96
10.18
24.54
54.08
94.37
125.12
174.96
211.05
252.64
324.25
360.27
392.98
480.99
515.59
592.05
676.64
722.39
682.3
648.54
642.39
544.22
468.79
434.28
397.02
363.82
334.84
294.36
210.77
149.55
96.1
46.12
9.46
0.3
0.02
0.01
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.33
10.2
41.66
86.02
150.24
212.03
279.02
372.66
449.2
527.7
591.01
648.16
767.95
961.4
1075.64
1099.81
1085.2
1030.1
980.06
895.42
776.14
674.09
586.84
425.96
317.38
255.3
208.49
158.78
110.1
75.27
50.63
31.69
11.34
1.9
0.32
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.49
4.51
15.63
29.38
52.86
73.86
104.72
116.98
154.95
201.84
249.43
246.85
284.01
262.68
247.56
266.68
254.93
258.15
262.05
257.99
247.65
231.56
208.04
201.12
186.2
169.45
147.88
125.3
102.4
73.28
47.6
26.99
11.24
1.66
0.97
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.05
0.82
8.23
20.88
39.59
62.44
88.41
113.93
141.3
162.7
176.15
192.96
214.86
221.55
225.1
235.28
256.53
269.46
271.39
281.04
285.74
277.9
263.66
239.66
219.24
195.9
167.47
135.77
104.35
75.53
50.15
27.48
10.01
1.19
0.14
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2.78
11.99
31.4
62.91
94.03
123.19
156.03
180.06
204.6
227.4
250.78
264.12
281.8
292.57
295.28
300.12
288.56
265.68
241.43
218.29
187.29
158.81
133.28
109.36
87.47
67.98
52.65
38.53
28.98
18.78
11.69
5.83
1.94
1.47
0.1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.06
2.27
11.11
28.67
56.9
94.19
132.15
179.92
259.8
327.89
410.21
500.05
569.63
607.29
599.96
648.39
643.9
671.22
595.36
526.71
549.21
513.42
493.82
460.18
427.9
384.15
387.4
308.62
246.26
177.06
110.42
58.29
20.89
4.2
0.42
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.72
12.99
40.62
83.12
137.66
198.46
282.61
359.32
459.62
534.01
613.28
656.2
723.04
835.54
834.37
879.94
849.92
827.57
761.92
698.82
619.84
545.02
499.08
437.21
364
300.46
263.26
223.84
173.9
133.7
98.77
65.96
38.98
14.18
2.67
2.79
1.4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.06
1.52
5.47
15.11
30.32
46.6
62.47
79.15
94.9
103.98
115.89
132.87
154.25
166.32
184.95
204.54
230.41
246.25
267.93
250.23
221.01
188.71
181.79
181.88
167.91
144.1
131.73
100.42
73.82
54.92
35.23
21.53
9.41
3.44
1.01
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1.13
18.96
68.55
135.43
202.83
282.52
358.86
391.94
415.86
432.55
457.63
501.31
567.21
632.45
689.06
655.39
728.24
757.78
691.78
647.87
602.82
604.83
598.73
562.13
523.64
455.18
419.53
396.92
360.98
298.45
231.52
154.87
84.01
30.24
3.02
0.12
0.06
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2.93
34.33
94.48
173.4
248.07
354.96
456.32
535
551.13
577.99
630.8
655.06
668.6
713.56
711.98
696.12
700.96
760.29
760.39
788.57
787.86
763.15
731
669.52
638.97
487.4
345.68
241.62
178.58
134.56
84.78
49.39
22.02
4.78
0.14
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.47
19.68
65.9
130.75
209.39
298.58
395.24
492.86
575.02
663.87
757.66
887.82
985.15
1068.41
1152.62
1201.72
1214.35
1274.11
1325.15
1334.96
1330.54
1315.51
1267.46
1165.03
1009.09
854.71
722.83
618.36
519.76
412.04
298.2
201.18
116.91
49.36
8.48
0.15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3.79
36.19
101.25
160.95
216.14
261.58
314.75
372.17
421.06
462.24
505.05
472.06
468.3
479.82
500.48
524.08
552.62
556.45
523.34
492.91
458.46
433.14
399.66
396.81
362.53
305.38
262.26
214.01
163.1
124.66
80.3
46.37
23.37
8.48
1.29
1.37
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.01
3.78
27.4
70.47
115.52
173.61
246.1
316.85
395.52
450.24
513.47
570.75
655
732.84
721
703.96
710.52
676.59
665.4
609.93
551.08
483.86
448.7
417.89
393.8
362.57
332.74
298.76
266.49
229.43
175.81
129.96
84.98
51.51
24.28
4.11
0.27
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.05
2.39
11.52
33.1
67.43
113.72
160.07
223.78
317.87
420.82
533.8
638.86
768.18
941.71
1008.88
1088.26
1128.19
1191.72
1259.43
1326.2
1310.15
1258.64
1245.51
1233.62
1087.24
991.48
868.82
731.77
614.43
495.89
401.66
340.57
253.75
169.89
100.09
42.95
9.53
0.11
0.05
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.47
21.48
68.29
117.28
170.68
252.83
350.34
473.55
581.39
708.91
796
878.28
926.83
1003.92
1195.12
1345.14
1469.12
1494.68
1534.01
1504.64
1454.73
1480.73
1445.96
1330.17
1217.59
1078.16
844.22
687.47
533.44
347.5
253.5
184.96
125.29
72.39
40.23
14.89
0.98
0.09
0.05
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.02
0.67
2.93
10.04
21.1
38.92
69.23
88.42
110.44
138.74
147.68
146.88
164.24
173.59
177.48
187.97
196.2
215.53
238.77
252.93
258.65
245.05
226.99
225.49
209.33
178.44
154.08
133.6
118.9
111.14
97.67
72.33
51.13
34.83
18.31
5.59
0.59
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.01
0.79
1.25
5.08
16.54
37.26
55.38
76.79
94.77
132.07
174.98
196.67
243.18
288.17
287.58
289.42
302.6
339.43
361.7
364.73
363.94
345.51
281.74
264.5
239.83
217.88
195.93
178.74
160.1
132.51
106.89
84.81
66.79
44.64
23.55
11.61
3.7
0.64
0.32
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.2
6.2
34.25
80.85
141.95
215.25
286.05
362.31
429.82
542.47
605.61
678.48
719.31
682.3
671.41
700.22
759.07
911.08
892.69
837.35
760.04
702.81
625.13
566.7
511.37
512.11
473
406.88
381.31
372.96
349.59
291.84
222.86
140.45
80.21
31.11
4.46
0.18
0.09
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.09
1
5.31
16.14
31.07
48.33
67.83
90.49
117.64
149.53
177.36
206.59
235.71
263.9
288.84
315.7
354.05
380.4
380.74
386.48
390.26
380.78
358.84
345.77
315.76
285.27
266.32
236.24
212.81
185.49
153.61
122.39
92.35
63.33
37.22
14.91
1.61
0.13
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
10.65
55.08
133.5
195.72
266.51
321.55
449.09
564.62
656.41
726.18
788.98
901.8
1025.81
1118.72
1178.38
1208.82
1235.7
1171.13
1155.3
1062.78
1009.05
925.14
847.69
679.83
576.69
495.34
431.6
342.84
289.12
256.7
217.58
177.39
129.2
79.37
40.46
12.71
0.93
0.24
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

wow太谢谢啦

plot函数里面加上xlim=(0, 50)试一下，看起来大于0的数据只出现在x轴小于50以内。这样应该就看得到曲线了