Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Root
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
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
Admin message
为了安全,强烈建议开启2FA双因子认证:User Settings -> Account -> Enable two-factor authentication!!!
Show more breadcrumbs
cxwx
Root
Commits
add1cf63
Commit
add1cf63
authored
6 years ago
by
Xavier Valls Pla
Browse files
Options
Downloads
Patches
Plain Diff
Improve allocations in LossFunction
parent
deb288b8
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
tmva/tmva/src/LossFunction.cxx
+5
-7
5 additions, 7 deletions
tmva/tmva/src/LossFunction.cxx
with
5 additions
and
7 deletions
tmva/tmva/src/LossFunction.cxx
+
5
−
7
View file @
add1cf63
...
@@ -176,9 +176,7 @@ Double_t TMVA::HuberLossFunction::CalculateLoss(LossFunctionEventInfo& e){
...
@@ -176,9 +176,7 @@ Double_t TMVA::HuberLossFunction::CalculateLoss(LossFunctionEventInfo& e){
// If the huber loss function is uninitialized then assume a group of one
// If the huber loss function is uninitialized then assume a group of one
// and initialize the transition point and weights for this single event
// and initialize the transition point and weights for this single event
if
(
fSumOfWeights
==
-
9999
){
if
(
fSumOfWeights
==
-
9999
){
std
::
vector
<
LossFunctionEventInfo
>
evs
;
std
::
vector
<
LossFunctionEventInfo
>
evs
{
e
};
evs
.
push_back
(
e
);
SetSumOfWeights
(
evs
);
SetSumOfWeights
(
evs
);
SetTransitionPoint
(
evs
);
SetTransitionPoint
(
evs
);
}
}
...
@@ -242,7 +240,7 @@ TMVA::HuberLossFunctionBDT::HuberLossFunctionBDT(){
...
@@ -242,7 +240,7 @@ TMVA::HuberLossFunctionBDT::HuberLossFunctionBDT(){
void
TMVA
::
HuberLossFunctionBDT
::
Init
(
std
::
map
<
const
TMVA
::
Event
*
,
LossFunctionEventInfo
>&
evinfomap
,
std
::
vector
<
double
>&
boostWeights
){
void
TMVA
::
HuberLossFunctionBDT
::
Init
(
std
::
map
<
const
TMVA
::
Event
*
,
LossFunctionEventInfo
>&
evinfomap
,
std
::
vector
<
double
>&
boostWeights
){
// Run this once before building the forest. Set initial prediction to weightedMedian.
// Run this once before building the forest. Set initial prediction to weightedMedian.
std
::
vector
<
LossFunctionEventInfo
>
evinfovec
;
std
::
vector
<
LossFunctionEventInfo
>
evinfovec
(
evinfomap
.
size
())
;
for
(
auto
&
e
:
evinfomap
){
for
(
auto
&
e
:
evinfomap
){
evinfovec
.
push_back
(
LossFunctionEventInfo
(
e
.
second
.
trueValue
,
e
.
second
.
predictedValue
,
e
.
first
->
GetWeight
()));
evinfovec
.
push_back
(
LossFunctionEventInfo
(
e
.
second
.
trueValue
,
e
.
second
.
predictedValue
,
e
.
first
->
GetWeight
()));
}
}
...
@@ -315,7 +313,7 @@ void TMVA::HuberLossFunctionBDT::SetTargets(std::vector<const TMVA::Event*>& evs
...
@@ -315,7 +313,7 @@ void TMVA::HuberLossFunctionBDT::SetTargets(std::vector<const TMVA::Event*>& evs
#else
#else
void
TMVA
::
HuberLossFunctionBDT
::
SetTargets
(
std
::
vector
<
const
TMVA
::
Event
*>&
evs
,
std
::
map
<
const
TMVA
::
Event
*
,
LossFunctionEventInfo
>&
evinfomap
){
void
TMVA
::
HuberLossFunctionBDT
::
SetTargets
(
std
::
vector
<
const
TMVA
::
Event
*>&
evs
,
std
::
map
<
const
TMVA
::
Event
*
,
LossFunctionEventInfo
>&
evinfomap
){
std
::
vector
<
LossFunctionEventInfo
>
eventvec
;
std
::
vector
<
LossFunctionEventInfo
>
eventvec
(
evs
.
size
())
;
for
(
std
::
vector
<
const
TMVA
::
Event
*>::
const_iterator
e
=
evs
.
begin
();
e
!=
evs
.
end
();
e
++
){
for
(
std
::
vector
<
const
TMVA
::
Event
*>::
const_iterator
e
=
evs
.
begin
();
e
!=
evs
.
end
();
e
++
){
eventvec
.
push_back
(
LossFunctionEventInfo
(
evinfomap
[
*
e
].
trueValue
,
evinfomap
[
*
e
].
predictedValue
,
(
*
e
)
->
GetWeight
()));
eventvec
.
push_back
(
LossFunctionEventInfo
(
evinfomap
[
*
e
].
trueValue
,
evinfomap
[
*
e
].
predictedValue
,
(
*
e
)
->
GetWeight
()));
}
}
...
@@ -428,7 +426,7 @@ Least Squares BDT Loss Function.
...
@@ -428,7 +426,7 @@ Least Squares BDT Loss Function.
void
TMVA
::
LeastSquaresLossFunctionBDT
::
Init
(
std
::
map
<
const
TMVA
::
Event
*
,
LossFunctionEventInfo
>&
evinfomap
,
std
::
vector
<
double
>&
boostWeights
){
void
TMVA
::
LeastSquaresLossFunctionBDT
::
Init
(
std
::
map
<
const
TMVA
::
Event
*
,
LossFunctionEventInfo
>&
evinfomap
,
std
::
vector
<
double
>&
boostWeights
){
// Run this once before building the forest. Set initial prediction to the weightedMean
// Run this once before building the forest. Set initial prediction to the weightedMean
std
::
vector
<
LossFunctionEventInfo
>
evinfovec
;
std
::
vector
<
LossFunctionEventInfo
>
evinfovec
(
evinfomap
.
size
())
;
for
(
auto
&
e
:
evinfomap
){
for
(
auto
&
e
:
evinfomap
){
evinfovec
.
push_back
(
LossFunctionEventInfo
(
e
.
second
.
trueValue
,
e
.
second
.
predictedValue
,
e
.
first
->
GetWeight
()));
evinfovec
.
push_back
(
LossFunctionEventInfo
(
e
.
second
.
trueValue
,
e
.
second
.
predictedValue
,
e
.
first
->
GetWeight
()));
}
}
...
@@ -561,7 +559,7 @@ Absolute Deviation BDT Loss Function.
...
@@ -561,7 +559,7 @@ Absolute Deviation BDT Loss Function.
void
TMVA
::
AbsoluteDeviationLossFunctionBDT
::
Init
(
std
::
map
<
const
TMVA
::
Event
*
,
LossFunctionEventInfo
>&
evinfomap
,
std
::
vector
<
double
>&
boostWeights
){
void
TMVA
::
AbsoluteDeviationLossFunctionBDT
::
Init
(
std
::
map
<
const
TMVA
::
Event
*
,
LossFunctionEventInfo
>&
evinfomap
,
std
::
vector
<
double
>&
boostWeights
){
// Run this once before building the forest. Set initial prediction to weightedMedian.
// Run this once before building the forest. Set initial prediction to weightedMedian.
std
::
vector
<
LossFunctionEventInfo
>
evinfovec
;
std
::
vector
<
LossFunctionEventInfo
>
evinfovec
(
evinfomap
.
size
())
;
for
(
auto
&
e
:
evinfomap
){
for
(
auto
&
e
:
evinfomap
){
evinfovec
.
push_back
(
LossFunctionEventInfo
(
e
.
second
.
trueValue
,
e
.
second
.
predictedValue
,
e
.
first
->
GetWeight
()));
evinfovec
.
push_back
(
LossFunctionEventInfo
(
e
.
second
.
trueValue
,
e
.
second
.
predictedValue
,
e
.
first
->
GetWeight
()));
}
}
...
...
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