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
Eric.Schanet
KerasROOTClassification
Commits
0bd404e7
Commit
0bd404e7
authored
6 years ago
by
Nikolai.Hartmann
Browse files
Options
Downloads
Patches
Plain Diff
adding class_weight_target property
parent
1e44f56c
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
toolkit.py
+21
-0
21 additions, 0 deletions
toolkit.py
with
21 additions
and
0 deletions
toolkit.py
+
21
−
0
View file @
0bd404e7
...
@@ -2038,6 +2038,7 @@ class ClassificationProjectDecorr(ClassificationProject):
...
@@ -2038,6 +2038,7 @@ class ClassificationProjectDecorr(ClassificationProject):
self
.
_class_output
=
None
self
.
_class_output
=
None
self
.
_adv_outputs
=
None
self
.
_adv_outputs
=
None
self
.
_model_adv
=
None
self
.
_model_adv
=
None
self
.
_class_weight_target
=
None
def
load
(
self
,
*
args
,
**
kwargs
):
def
load
(
self
,
*
args
,
**
kwargs
):
...
@@ -2059,6 +2060,26 @@ class ClassificationProjectDecorr(ClassificationProject):
...
@@ -2059,6 +2060,26 @@ class ClassificationProjectDecorr(ClassificationProject):
)
)
@property
def
class_weight_target
(
self
):
if
self
.
_class_weight_target
is
None
:
self
.
_class_weight_target
=
[]
for
var_i
,
binning
in
enumerate
(
self
.
decorr_binnings
,
1
):
sumw
=
self
.
w_train
[
self
.
l_train
==
0
].
sum
()
class_weight
=
[
sumw
/
(
len
(
binning
)
*
self
.
w_train
[
(
np
.
argmax
(
self
.
get_output_list
(
self
.
y_train
)[
var_i
],
axis
=
1
)
==
label
)
&
(
self
.
l_train
==
0
)
].
sum
()
)
for
label
in
range
(
len
(
binning
))
]
self
.
_class_weight_target
.
append
(
class_weight
)
return
self
.
_class_weight_target
def
get_output_list
(
self
,
y
):
def
get_output_list
(
self
,
y
):
out_list
=
super
(
ClassificationProjectDecorr
,
self
).
get_output_list
(
y
)
out_list
=
super
(
ClassificationProjectDecorr
,
self
).
get_output_list
(
y
)
for
i
,
(
out
,
binning
)
in
enumerate
(
for
i
,
(
out
,
binning
)
in
enumerate
(
...
...
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