Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
KerasROOTClassification
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
Container Registry
Model registry
Operate
Environments
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
Nikolai.Hartmann
KerasROOTClassification
Commits
5ce28def
Commit
5ce28def
authored
6 years ago
by
Nikolai.Hartmann
Browse files
Options
Downloads
Patches
Plain Diff
weighted quantile for plot_NN_2D
parent
480a7679
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/plot_NN_2D.py
+8
-3
8 additions, 3 deletions
scripts/plot_NN_2D.py
with
8 additions
and
3 deletions
scripts/plot_NN_2D.py
+
8
−
3
View file @
5ce28def
...
@@ -20,7 +20,7 @@ from KerasROOTClassification.plotting import (
...
@@ -20,7 +20,7 @@ from KerasROOTClassification.plotting import (
plot_cond_avg_actmax_2D
,
plot_cond_avg_actmax_2D
,
plot_NN_vs_var_2D_all
,
plot_NN_vs_var_2D_all
,
)
)
from
KerasROOTClassification.utils
import
get_single_neuron_function
,
get_max_activation_events
from
KerasROOTClassification.utils
import
get_single_neuron_function
,
get_max_activation_events
,
weighted_quantile
parser
=
argparse
.
ArgumentParser
(
description
=
'
Create various 2D plots for a single neuron
'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'
Create various 2D plots for a single neuron
'
)
parser
.
add_argument
(
"
project_dir
"
)
parser
.
add_argument
(
"
project_dir
"
)
...
@@ -73,8 +73,13 @@ else:
...
@@ -73,8 +73,13 @@ else:
varx_label
=
args
.
varx
varx_label
=
args
.
varx
vary_label
=
args
.
vary
vary_label
=
args
.
vary
percentilesx
=
np
.
percentile
(
c
.
x_test
[:,
varx_index
],
[
1
,
99
])
# percentilesx = np.percentile(c.x_test[:,varx_index], [1,99])
percentilesy
=
np
.
percentile
(
c
.
x_test
[:,
vary_index
],
[
1
,
99
])
# percentilesy = np.percentile(c.x_test[:,vary_index], [1,99])
total_weights
=
c
.
w_test
*
np
.
array
(
c
.
class_weight
)[
c
.
y_test
.
astype
(
int
)]
percentilesx
=
weighted_quantile
(
c
.
x_test
[:,
varx_index
],
[
0.1
,
0.99
],
sample_weight
=
total_weights
)
percentilesy
=
weighted_quantile
(
c
.
x_test
[:,
vary_index
],
[
0.1
,
0.99
],
sample_weight
=
total_weights
)
if
args
.
xrange
is
not
None
:
if
args
.
xrange
is
not
None
:
if
len
(
args
.
xrange
)
<
3
:
if
len
(
args
.
xrange
)
<
3
:
...
...
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
register
or
sign in
to comment