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
c4c88456
Commit
c4c88456
authored
6 years ago
by
Nikolai
Browse files
Options
Downloads
Patches
Plain Diff
single neuron output works with multiple inputs
parent
0024d69c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/plot_NN_2D.py
+5
-1
5 additions, 1 deletion
scripts/plot_NN_2D.py
utils.py
+10
-3
10 additions, 3 deletions
utils.py
with
15 additions
and
4 deletions
scripts/plot_NN_2D.py
+
5
−
1
View file @
c4c88456
...
@@ -126,11 +126,15 @@ if args.mode.startswith("mean"):
...
@@ -126,11 +126,15 @@ if args.mode.startswith("mean"):
logscale
=
args
.
log
,
only_pixels
=
(
not
args
.
contour
)
logscale
=
args
.
log
,
only_pixels
=
(
not
args
.
contour
)
)
)
else
:
else
:
if
hasattr
(
c
,
"
get_input_list
"
):
transform_function
=
lambda
inp
:
c
.
get_input_list
(
c
.
scaler
.
transform
(
inp
))
else
:
transform_function
=
c
.
scaler
.
transform
(
inp
)
plot_NN_vs_var_2D_all
(
plot_NN_vs_var_2D_all
(
args
.
output_filename
,
args
.
output_filename
,
means
=
means
,
means
=
means
,
model
=
c
.
model
,
model
=
c
.
model
,
transform_function
=
c
.
scaler
.
transform
,
transform_function
=
transform
_function
,
varx_index
=
varx_index
,
varx_index
=
varx_index
,
vary_index
=
vary_index
,
vary_index
=
vary_index
,
xmin
=
varx_range
[
0
],
xmax
=
varx_range
[
1
],
nbinsx
=
varx_range
[
2
],
xmin
=
varx_range
[
0
],
xmax
=
varx_range
[
1
],
nbinsx
=
varx_range
[
2
],
...
...
This diff is collapsed.
Click to expand it.
utils.py
+
10
−
3
View file @
c4c88456
...
@@ -15,14 +15,21 @@ logger.addHandler(logging.NullHandler())
...
@@ -15,14 +15,21 @@ logger.addHandler(logging.NullHandler())
def
get_single_neuron_function
(
model
,
layer
,
neuron
,
scaler
=
None
,
input_transform
=
None
):
def
get_single_neuron_function
(
model
,
layer
,
neuron
,
scaler
=
None
,
input_transform
=
None
):
f
=
K
.
function
([
model
.
input
]
+
[
K
.
learning_phase
()],
[
model
.
layers
[
layer
].
output
[:,
neuron
]])
inp
=
model
.
input
if
not
isinstance
(
inp
,
list
):
inp
=
[
inp
]
f
=
K
.
function
(
inp
+
[
K
.
learning_phase
()],
[
model
.
layers
[
layer
].
output
[:,
neuron
]])
def
eval_single_neuron
(
x
):
def
eval_single_neuron
(
x
):
x_eval
=
x
if
scaler
is
not
None
:
if
scaler
is
not
None
:
x_eval
=
scaler
.
transform
(
x
)
x_eval
=
scaler
.
transform
(
x
)
if
input_transform
is
not
None
:
x_eval
=
input_transform
(
x_eval
)
else
:
else
:
x_eval
=
x
x_eval
=
[
x_eval
]
return
f
(
[
x_eval
]
)[
0
]
return
f
(
x_eval
)[
0
]
return
eval_single_neuron
return
eval_single_neuron
...
...
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