Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tom Rink
python
Commits
03eaf0ad
Commit
03eaf0ad
authored
Dec 4, 2023
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
99de43e3
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/icing/pirep_goes.py
+28
-13
28 additions, 13 deletions
modules/icing/pirep_goes.py
with
28 additions
and
13 deletions
modules/icing/pirep_goes.py
+
28
−
13
View file @
03eaf0ad
...
@@ -2589,16 +2589,16 @@ def analyze(preds_file, labels, prob_avg, test_file):
...
@@ -2589,16 +2589,16 @@ def analyze(preds_file, labels, prob_avg, test_file):
iint
=
np
.
where
(
iint
==
-
1
,
0
,
iint
)
iint
=
np
.
where
(
iint
==
-
1
,
0
,
iint
)
iint
=
np
.
where
(
iint
!=
0
,
1
,
iint
)
iint
=
np
.
where
(
iint
!=
0
,
1
,
iint
)
nda
[
np
.
logical_and
(
nda
>=
100
,
nda
<
5
000
)]
=
0
nda
[
np
.
logical_and
(
nda
>=
100
,
nda
<
4
000
)]
=
0
nda
[
np
.
logical_and
(
nda
>=
5
000
,
nda
<
15000
)]
=
1
nda
[
np
.
logical_and
(
nda
>=
4
000
,
nda
<
15000
)]
=
1
nda
[
np
.
logical_and
(
nda
>=
15000
,
nda
<
20000
)]
=
2
nda
[
np
.
logical_and
(
nda
>=
15000
,
nda
<
20000
)]
=
2
#
nda[np.logical_and(nda >=
6
000, nda <
8
000)] = 3
nda
[
np
.
logical_and
(
nda
>=
20
000
,
nda
<
25
000
)]
=
3
# nda[np.logical_and(nda >= 8000, nda < 15000)] = 4
# nda[np.logical_and(nda >= 8000, nda < 15000)] = 4
print
(
np
.
sum
(
nda
==
0
),
np
.
sum
(
nda
==
1
),
np
.
sum
(
nda
==
2
))
print
(
np
.
sum
(
nda
==
0
),
np
.
sum
(
nda
==
1
),
np
.
sum
(
nda
==
2
))
print
(
'
No icing:
'
,
np
.
sum
((
iint
==
0
)
&
(
nda
==
0
)),
np
.
sum
((
iint
==
0
)
&
(
nda
==
1
)),
np
.
sum
((
iint
==
0
)
&
(
nda
==
2
)))
print
(
'
No icing:
'
,
np
.
sum
((
iint
==
0
)
&
(
nda
==
0
)),
np
.
sum
((
iint
==
0
)
&
(
nda
==
1
)),
np
.
sum
((
iint
==
0
)
&
(
nda
==
2
))
,
np
.
sum
((
iint
==
0
)
&
(
nda
==
3
))
)
print
(
'
---------------------------
'
)
print
(
'
---------------------------
'
)
print
(
'
Icing:
'
,
np
.
sum
((
iint
==
1
)
&
(
nda
==
0
)),
np
.
sum
((
iint
==
1
)
&
(
nda
==
1
)),
np
.
sum
((
iint
==
1
)
&
(
nda
==
2
)))
print
(
'
Icing:
'
,
np
.
sum
((
iint
==
1
)
&
(
nda
==
0
)),
np
.
sum
((
iint
==
1
)
&
(
nda
==
1
)),
np
.
sum
((
iint
==
1
)
&
(
nda
==
2
))
,
np
.
sum
((
iint
==
1
)
&
(
nda
==
3
))
)
print
(
'
---------------------------
'
)
print
(
'
---------------------------
'
)
print
(
'
----------------------------------------------------------
'
)
print
(
'
----------------------------------------------------------
'
)
...
@@ -2612,6 +2612,7 @@ def analyze(preds_file, labels, prob_avg, test_file):
...
@@ -2612,6 +2612,7 @@ def analyze(preds_file, labels, prob_avg, test_file):
num_0
=
np
.
sum
(
nda
==
0
)
num_0
=
np
.
sum
(
nda
==
0
)
num_1
=
np
.
sum
(
nda
==
1
)
num_1
=
np
.
sum
(
nda
==
1
)
num_2
=
np
.
sum
(
nda
==
2
)
num_2
=
np
.
sum
(
nda
==
2
)
num_3
=
np
.
sum
(
nda
==
3
)
true_ice
=
(
labels
==
1
)
&
(
preds
==
1
)
true_ice
=
(
labels
==
1
)
&
(
preds
==
1
)
false_ice
=
(
labels
==
0
)
&
(
preds
==
1
)
false_ice
=
(
labels
==
0
)
&
(
preds
==
1
)
...
@@ -2622,52 +2623,66 @@ def analyze(preds_file, labels, prob_avg, test_file):
...
@@ -2622,52 +2623,66 @@ def analyze(preds_file, labels, prob_avg, test_file):
tp_0
=
np
.
sum
(
true_ice
&
(
nda
==
0
))
tp_0
=
np
.
sum
(
true_ice
&
(
nda
==
0
))
tp_1
=
np
.
sum
(
true_ice
&
(
nda
==
1
))
tp_1
=
np
.
sum
(
true_ice
&
(
nda
==
1
))
tp_2
=
np
.
sum
(
true_ice
&
(
nda
==
2
))
tp_2
=
np
.
sum
(
true_ice
&
(
nda
==
2
))
tp_3
=
np
.
sum
(
true_ice
&
(
nda
==
3
))
tn_0
=
np
.
sum
(
true_no_ice
&
(
nda
==
0
))
tn_0
=
np
.
sum
(
true_no_ice
&
(
nda
==
0
))
tn_1
=
np
.
sum
(
true_no_ice
&
(
nda
==
1
))
tn_1
=
np
.
sum
(
true_no_ice
&
(
nda
==
1
))
tn_2
=
np
.
sum
(
true_no_ice
&
(
nda
==
2
))
tn_2
=
np
.
sum
(
true_no_ice
&
(
nda
==
2
))
tn_3
=
np
.
sum
(
true_no_ice
&
(
nda
==
3
))
fp_0
=
np
.
sum
(
false_ice
&
(
nda
==
0
))
fp_0
=
np
.
sum
(
false_ice
&
(
nda
==
0
))
fp_1
=
np
.
sum
(
false_ice
&
(
nda
==
1
))
fp_1
=
np
.
sum
(
false_ice
&
(
nda
==
1
))
fp_2
=
np
.
sum
(
false_ice
&
(
nda
==
2
))
fp_2
=
np
.
sum
(
false_ice
&
(
nda
==
2
))
fp_3
=
np
.
sum
(
false_ice
&
(
nda
==
3
))
fn_0
=
np
.
sum
(
false_no_ice
&
(
nda
==
0
))
fn_0
=
np
.
sum
(
false_no_ice
&
(
nda
==
0
))
fn_1
=
np
.
sum
(
false_no_ice
&
(
nda
==
1
))
fn_1
=
np
.
sum
(
false_no_ice
&
(
nda
==
1
))
fn_2
=
np
.
sum
(
false_no_ice
&
(
nda
==
2
))
fn_2
=
np
.
sum
(
false_no_ice
&
(
nda
==
2
))
fn_3
=
np
.
sum
(
false_no_ice
&
(
nda
==
3
))
recall_0
=
tp_0
/
(
tp_0
+
fn_0
)
recall_0
=
tp_0
/
(
tp_0
+
fn_0
)
recall_1
=
tp_1
/
(
tp_1
+
fn_1
)
recall_1
=
tp_1
/
(
tp_1
+
fn_1
)
recall_2
=
tp_2
/
(
tp_2
+
fn_2
)
recall_2
=
tp_2
/
(
tp_2
+
fn_2
)
recall_3
=
tp_3
/
(
tp_3
+
fn_3
)
precision_0
=
tp_0
/
(
tp_0
+
fp_0
)
precision_0
=
tp_0
/
(
tp_0
+
fp_0
)
precision_1
=
tp_1
/
(
tp_1
+
fp_1
)
precision_1
=
tp_1
/
(
tp_1
+
fp_1
)
precision_2
=
tp_2
/
(
tp_2
+
fp_2
)
precision_2
=
tp_2
/
(
tp_2
+
fp_2
)
precision_3
=
tp_3
/
(
tp_3
+
fp_3
)
f1_0
=
2
*
(
precision_0
*
recall_0
)
/
(
precision_0
+
recall_0
)
f1_1
=
2
*
(
precision_1
*
recall_1
)
/
(
precision_1
+
recall_1
)
f1_2
=
2
*
(
precision_2
*
recall_2
)
/
(
precision_2
+
recall_2
)
f1_3
=
2
*
(
precision_3
*
recall_3
)
/
(
precision_3
+
recall_3
)
mcc_0
=
((
tp_0
*
tn_0
)
-
(
fp_0
*
fn_0
))
/
np
.
sqrt
((
tp_0
+
fp_0
)
*
(
tp_0
+
fn_0
)
*
(
tn_0
+
fp_0
)
*
(
tn_0
+
fn_0
))
mcc_0
=
((
tp_0
*
tn_0
)
-
(
fp_0
*
fn_0
))
/
np
.
sqrt
((
tp_0
+
fp_0
)
*
(
tp_0
+
fn_0
)
*
(
tn_0
+
fp_0
)
*
(
tn_0
+
fn_0
))
mcc_1
=
((
tp_1
*
tn_1
)
-
(
fp_1
*
fn_1
))
/
np
.
sqrt
((
tp_1
+
fp_1
)
*
(
tp_1
+
fn_1
)
*
(
tn_1
+
fp_1
)
*
(
tn_1
+
fn_1
))
mcc_1
=
((
tp_1
*
tn_1
)
-
(
fp_1
*
fn_1
))
/
np
.
sqrt
((
tp_1
+
fp_1
)
*
(
tp_1
+
fn_1
)
*
(
tn_1
+
fp_1
)
*
(
tn_1
+
fn_1
))
mcc_2
=
((
tp_2
*
tn_2
)
-
(
fp_2
*
fn_2
))
/
np
.
sqrt
((
tp_2
+
fp_2
)
*
(
tp_2
+
fn_2
)
*
(
tn_2
+
fp_2
)
*
(
tn_2
+
fn_2
))
mcc_2
=
((
tp_2
*
tn_2
)
-
(
fp_2
*
fn_2
))
/
np
.
sqrt
((
tp_2
+
fp_2
)
*
(
tp_2
+
fn_2
)
*
(
tn_2
+
fp_2
)
*
(
tn_2
+
fn_2
))
mcc_3
=
((
tp_3
*
tn_3
)
-
(
fp_3
*
fn_3
))
/
np
.
sqrt
((
tp_3
+
fp_3
)
*
(
tp_3
+
fn_3
)
*
(
tn_3
+
fp_3
)
*
(
tn_3
+
fn_3
))
acc_0
=
np
.
sum
(
labels
[
nda
==
0
]
==
preds
[
nda
==
0
])
/
num_0
acc_0
=
np
.
sum
(
labels
[
nda
==
0
]
==
preds
[
nda
==
0
])
/
num_0
acc_1
=
np
.
sum
(
labels
[
nda
==
1
]
==
preds
[
nda
==
1
])
/
num_1
acc_1
=
np
.
sum
(
labels
[
nda
==
1
]
==
preds
[
nda
==
1
])
/
num_1
acc_2
=
np
.
sum
(
labels
[
nda
==
2
]
==
preds
[
nda
==
2
])
/
num_2
acc_2
=
np
.
sum
(
labels
[
nda
==
2
]
==
preds
[
nda
==
2
])
/
num_2
acc_3
=
np
.
sum
(
labels
[
nda
==
3
]
==
preds
[
nda
==
3
])
/
num_3
print
(
'
Total (Positive/Icing Prediction:
'
)
print
(
'
Total (Positive/Icing Prediction:
'
)
print
(
'
True icing:
'
,
np
.
sum
(
true_ice
&
(
nda
==
0
)),
np
.
sum
(
true_ice
&
(
nda
==
1
)),
np
.
sum
(
true_ice
&
(
nda
==
2
)))
print
(
'
True icing:
'
,
np
.
sum
(
true_ice
&
(
nda
==
0
)),
np
.
sum
(
true_ice
&
(
nda
==
1
)),
np
.
sum
(
true_ice
&
(
nda
==
2
))
,
np
.
sum
(
true_ice
&
(
nda
==
3
))
)
print
(
'
-------------------------
'
)
print
(
'
-------------------------
'
)
print
(
'
False no icing (False Negative/Miss):
'
,
np
.
sum
(
false_no_ice
&
(
nda
==
0
)),
np
.
sum
(
false_no_ice
&
(
nda
==
1
)),
np
.
sum
(
false_no_ice
&
(
nda
==
2
)))
print
(
'
False no icing (False Negative/Miss):
'
,
np
.
sum
(
false_no_ice
&
(
nda
==
0
)),
np
.
sum
(
false_no_ice
&
(
nda
==
1
)),
np
.
sum
(
false_no_ice
&
(
nda
==
2
))
,
np
.
sum
(
false_no_ice
&
(
nda
==
3
))
)
print
(
'
---------------------------------------------------
'
)
print
(
'
---------------------------------------------------
'
)
print
(
'
---------------------------------------------------
'
)
print
(
'
---------------------------------------------------
'
)
print
(
'
Total (Negative/No Icing Prediction:
'
)
print
(
'
Total (Negative/No Icing Prediction:
'
)
print
(
'
True no icing:
'
,
np
.
sum
(
true_no_ice
&
(
nda
==
0
)),
np
.
sum
(
true_no_ice
&
(
nda
==
1
)),
np
.
sum
(
true_no_ice
&
(
nda
==
2
)))
print
(
'
True no icing:
'
,
np
.
sum
(
true_no_ice
&
(
nda
==
0
)),
np
.
sum
(
true_no_ice
&
(
nda
==
1
)),
np
.
sum
(
true_no_ice
&
(
nda
==
2
))
,
np
.
sum
(
true_no_ice
&
(
nda
==
3
))
)
print
(
'
-------------------------
'
)
print
(
'
-------------------------
'
)
print
(
'
* False icing (False Positive/False Alarm) *:
'
,
np
.
sum
(
false_ice
&
(
nda
==
0
)),
np
.
sum
(
false_ice
&
(
nda
==
1
)),
np
.
sum
(
false_ice
&
(
nda
==
2
)))
print
(
'
* False icing (False Positive/False Alarm) *:
'
,
np
.
sum
(
false_ice
&
(
nda
==
0
)),
np
.
sum
(
false_ice
&
(
nda
==
1
)),
np
.
sum
(
false_ice
&
(
nda
==
2
))
,
np
.
sum
(
false_ice
&
(
nda
==
3
))
)
print
(
'
-------------------------
'
)
print
(
'
-------------------------
'
)
print
(
'
ACC:
'
,
acc_0
,
acc_1
,
acc_2
)
print
(
'
ACC:
'
,
acc_0
,
acc_1
,
acc_2
,
acc_3
)
print
(
'
Recall:
'
,
recall_0
,
recall_1
,
recall_2
)
print
(
'
Recall:
'
,
recall_0
,
recall_1
,
recall_2
,
recall_3
)
print
(
'
Precision:
'
,
precision_0
,
precision_1
,
precision_2
)
print
(
'
Precision:
'
,
precision_0
,
precision_1
,
precision_2
,
precision_3
)
print
(
'
MCC:
'
,
mcc_0
,
mcc_1
,
mcc_2
)
print
(
'
F1:
'
,
f1_0
,
f1_1
,
f1_2
,
f1_3
)
print
(
'
MCC:
'
,
mcc_0
,
mcc_1
,
mcc_2
,
mcc_3
)
return
labels
[
nda
==
0
],
prob_avg
[
nda
==
0
],
labels
[
nda
==
1
],
prob_avg
[
nda
==
1
],
labels
[
nda
==
2
],
prob_avg
[
nda
==
2
]
return
labels
[
nda
==
0
],
prob_avg
[
nda
==
0
],
labels
[
nda
==
1
],
prob_avg
[
nda
==
1
],
labels
[
nda
==
2
],
prob_avg
[
nda
==
2
]
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment