File tree Expand file tree Collapse file tree 3 files changed +19
-16
lines changed
ohsome_quality_api/indicators/land_cover_thematic_accuracy
tests/approvals/integrationtests/indicators/test_land_cover_thematic_accuracy.py-test_calculate_multi_class Expand file tree Collapse file tree 3 files changed +19
-16
lines changed Original file line number Diff line number Diff line change 3
3
from pathlib import Path
4
4
from string import Template
5
5
6
+ import numpy
6
7
import plotly .graph_objects as pgo
7
8
from geojson import Feature
8
9
from sklearn .metrics import classification_report , confusion_matrix , f1_score
@@ -137,15 +138,12 @@ def calculate(self) -> None:
137
138
f"{ label_description } { self .templates .result_description } "
138
139
)
139
140
140
- # TODO: UdefinedMetricWarning
141
- # Recall is ill-defined and being set to 0.0 in labels with no
142
- # true samples. Use `zero_division` parameter to control this
143
- # behavior.
144
141
# NOTE: For introspection/testing only
145
142
self .report = classification_report (
146
143
self .clc_classes_corine ,
147
144
self .clc_classes_osm ,
148
145
sample_weight = self .areas ,
146
+ zero_division = numpy .nan ,
149
147
)
150
148
151
149
def create_figure (self ) -> None :
Original file line number Diff line number Diff line change @@ -6,13 +6,18 @@ WITH bpoly AS (
6
6
SELECT
7
7
CLC_class as clc_class_corine,
8
8
osm_CLC_class as clc_class_osm,
9
- CASE WHEN ST_Within (o .geometry , b .geometry ) THEN
10
- area
11
- ELSE
12
- ST_Area (ST_Intersection (o .geometry , b .geometry )::geography)
13
- END AS area
9
+ SUM (
10
+ CASE WHEN ST_Within (o .geometry , b .geometry ) THEN
11
+ area
12
+ ELSE
13
+ ST_Area (ST_Intersection (o .geometry , b .geometry )::geography)
14
+ END) AS area
14
15
FROM
15
16
osm_corine_2021_deu_intersection o,
16
17
bpoly b
17
18
WHERE
18
- ST_Intersects (o .geometry , b .geometry );
19
+ ST_Intersects (o .geometry , b .geometry )
20
+ -- AND osm_CLC_class != 0
21
+ -- AND osm_CLC_class != 50
22
+ GROUP BY 1 ,2
23
+ ;
Original file line number Diff line number Diff line change 1
1
precision recall f1-score support
2
2
3
- 0 0.00 0.00 0.00 0.0
3
+ 0 0.00 nan 0.00 0.0
4
4
11 0.94 0.86 0.90 13.681696054340627
5
5
12 0.84 0.87 0.85 4.868706606602494
6
- 13 0.00 0.00 0.00 0.0
6
+ 13 0.00 nan 0.00 0.0
7
7
14 0.13 0.42 0.20 0.3617314972878062
8
8
21 0.86 0.91 0.89 15.526750634345152
9
9
22 0.64 0.76 0.70 2.2997486561073313
10
10
23 0.75 0.44 0.55 6.712711587504546
11
- 24 0.00 0.00 0.00 0.084999664294624
11
+ 24 nan 0.00 0.00 0.084999664294624
12
12
31 0.82 0.92 0.87 10.490463269571688
13
13
32 0.00 0.00 0.00 0.2576135038588164
14
- 50 0.00 0.00 0.00 0.0
15
- 51 0.00 0.00 0.00 0.033118424422509736
14
+ 50 0.00 nan 0.00 0.0
15
+ 51 nan 0.00 0.00 0.033118424422509736
16
16
17
17
accuracy 0.82 54.31753989833559
18
- macro avg 0.38 0.40 0.38 54.31753989833559
18
+ macro avg 0.45 0.52 0.38 54.31753989833559
19
19
weighted avg 0.84 0.82 0.82 54.31753989833559
You can’t perform that action at this time.
0 commit comments