Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
1a48fd26
Unverified
Commit
1a48fd26
authored
Mar 08, 2020
by
Guolin Ke
Committed by
GitHub
Mar 08, 2020
Browse files
fix ResetConfig in FeatureHistogram (#2882)
parent
018bdd3f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
src/treelearner/feature_histogram.hpp
src/treelearner/feature_histogram.hpp
+18
-0
No files found.
src/treelearner/feature_histogram.hpp
View file @
1a48fd26
...
...
@@ -59,6 +59,10 @@ class FeatureHistogram {
void
Init
(
hist_t
*
data
,
const
FeatureMetainfo
*
meta
)
{
meta_
=
meta
;
data_
=
data
;
ResetFunc
();
}
void
ResetFunc
()
{
if
(
meta_
->
bin_type
==
BinType
::
NumericalBin
)
{
FuncForNumrical
();
}
else
{
...
...
@@ -1131,7 +1135,21 @@ class HistogramPool {
}
void
ResetConfig
(
const
Dataset
*
train_data
,
const
Config
*
config
)
{
CHECK_GT
(
train_data
->
num_features
(),
0
);
const
Config
*
old_config
=
feature_metas_
[
0
].
config
;
SetFeatureInfo
<
false
,
true
>
(
train_data
,
config
,
&
feature_metas_
);
// if need to reset the function pointers
if
(
old_config
->
lambda_l1
!=
config
->
lambda_l1
||
old_config
->
monotone_constraints
!=
config
->
monotone_constraints
||
old_config
->
extra_trees
!=
config
->
extra_trees
||
old_config
->
max_delta_step
!=
config
->
max_delta_step
)
{
#pragma omp parallel for schedule(static)
for
(
int
i
=
0
;
i
<
cache_size_
;
++
i
)
{
for
(
int
j
=
0
;
j
<
train_data
->
num_features
();
++
j
)
{
pool_
[
i
][
j
].
ResetFunc
();
}
}
}
}
/*!
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment