Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.pad.base
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.pad.base
Merge requests
!37
WIP: initial implementation of harmonised plots
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
WIP: initial implementation of harmonised plots
vulnerability
into
master
Overview
4
Commits
6
Pipelines
7
Changes
9
1 unresolved thread
Hide all comments
Closed
Amir MOHAMMADI
requested to merge
vulnerability
into
master
7 years ago
Overview
4
Commits
6
Pipelines
7
Changes
9
1 unresolved thread
Hide all comments
Expand
0
0
Merge request reports
Compare
master
version 6
ae7974fd
7 years ago
version 5
165fcc9d
7 years ago
version 4
fef8aa1d
7 years ago
version 3
ca1775b7
7 years ago
version 2
d01aada2
7 years ago
version 1
9a8bafee
7 years ago
master (base)
and
latest version
latest version
ae7974fd
6 commits,
7 years ago
version 6
ae7974fd
6 commits,
7 years ago
version 5
165fcc9d
5 commits,
7 years ago
version 4
fef8aa1d
4 commits,
7 years ago
version 3
ca1775b7
3 commits,
7 years ago
version 2
d01aada2
2 commits,
7 years ago
version 1
9a8bafee
1 commit,
7 years ago
9 files
+
2070
−
19
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
9
Search (e.g. *.vue) (Ctrl+P)
bob/pad/base/script/__init__.py
+
53
−
0
Options
import
numpy
as
np
def
remove_nan
(
scores
):
"""
Removes the NaNs from the scores
Parameters
----------
scores : numpy.array
The scores.
Returns
-------
scores : numpy.array
The scores excluding the NaNs.
sum_nans : int
The number of NaNs in the scores.
total : int
The total number of scores before removing the NaNs.
"""
nans
=
np
.
isnan
(
scores
)
return
scores
[
np
.
where
(
~
nans
)],
sum
(
nans
),
len
(
scores
)
def
fta
(
neg_pos
):
"""
Calculates the Failure To Acquire (FtA) rate.
Calculates how many NaNs are in neg and pos in total and returns the rate.
Parameters
----------
neg_pos : (numpy.array, numpy.array)
A tuple of negative and positive scores
Returns
-------
neg : numpy.array
The negative scores with NaNs removed.
pos : numpy.array
The positive scores with NaNs removed.
fta : float
The FTA rate.
"""
fta_sum
,
fta_total
=
0
,
0
neg
,
sum_nans
,
total
=
remove_nan
(
neg_pos
[
0
])
fta_sum
+=
sum_nans
fta_total
+=
total
pos
,
sum_nans
,
total
=
remove_nan
(
neg_pos
[
1
])
fta_sum
+=
sum_nans
fta_total
+=
total
return
(
neg
,
pos
,
fta_sum
/
fta_total
)
from
.
import
spoof
Loading