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
714c6732
"vscode:/vscode.git/clone" did not exist on "580006836e188cf502942d08e4b07e789adf6392"
Commit
714c6732
authored
Dec 18, 2016
by
Guolin Ke
Browse files
fix bugs in reset parameters
parent
7a81f7bd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
src/c_api.cpp
src/c_api.cpp
+10
-2
No files found.
src/c_api.cpp
View file @
714c6732
...
...
@@ -41,6 +41,7 @@ public:
please use continued train with input score"
);
}
boosting_
.
reset
(
Boosting
::
CreateBoosting
(
config_
.
boosting_type
,
nullptr
));
train_data_
=
train_data
;
ConstructObjectAndTrainingMetrics
(
train_data
);
// initialize the boosting
boosting_
->
Init
(
&
config_
.
boosting_config
,
train_data
,
objective_fun_
.
get
(),
...
...
@@ -66,7 +67,6 @@ public:
}
void
ResetConfig
(
const
char
*
parameters
)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
auto
param
=
ConfigBase
::
Str2Map
(
parameters
);
if
(
param
.
count
(
"num_class"
))
{
Log
::
Fatal
(
"cannot change num class during training"
);
...
...
@@ -74,12 +74,20 @@ public:
if
(
param
.
count
(
"boosting_type"
))
{
Log
::
Fatal
(
"cannot change boosting_type during training"
);
}
if
(
param
.
count
(
"metric"
))
{
Log
::
Fatal
(
"cannot change metric during training"
);
}
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
config_
.
Set
(
param
);
}
if
(
config_
.
num_threads
>
0
)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
omp_set_num_threads
(
config_
.
num_threads
);
}
if
(
param
.
size
()
==
1
&&
(
param
.
count
(
"learning_rate"
)
||
param
.
count
(
"shrinkage_rate"
)))
{
// only need to set learning rate
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
boosting_
->
ResetShrinkageRate
(
config_
.
boosting_config
.
learning_rate
);
}
else
{
ResetTrainingData
(
train_data_
);
...
...
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