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
834a8986
Commit
834a8986
authored
Feb 27, 2017
by
Guolin Ke
Browse files
fix bugs in goss.
parent
fd5b5916
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
src/application/application.cpp
src/application/application.cpp
+2
-2
src/boosting/goss.hpp
src/boosting/goss.hpp
+5
-2
No files found.
src/application/application.cpp
View file @
834a8986
...
@@ -226,10 +226,10 @@ void Application::Train() {
...
@@ -226,10 +226,10 @@ void Application::Train() {
int
total_iter
=
config_
.
boosting_config
.
num_iterations
;
int
total_iter
=
config_
.
boosting_config
.
num_iterations
;
bool
is_finished
=
false
;
bool
is_finished
=
false
;
bool
need_eval
=
true
;
bool
need_eval
=
true
;
auto
start_time
=
std
::
chrono
::
high_resolution
_clock
::
now
();
auto
start_time
=
std
::
chrono
::
steady
_clock
::
now
();
for
(
int
iter
=
0
;
iter
<
total_iter
&&
!
is_finished
;
++
iter
)
{
for
(
int
iter
=
0
;
iter
<
total_iter
&&
!
is_finished
;
++
iter
)
{
is_finished
=
boosting_
->
TrainOneIter
(
nullptr
,
nullptr
,
need_eval
);
is_finished
=
boosting_
->
TrainOneIter
(
nullptr
,
nullptr
,
need_eval
);
auto
end_time
=
std
::
chrono
::
high_resolution
_clock
::
now
();
auto
end_time
=
std
::
chrono
::
steady
_clock
::
now
();
// output used time per iteration
// output used time per iteration
Log
::
Info
(
"%f seconds elapsed, finished iteration %d"
,
std
::
chrono
::
duration
<
double
,
Log
::
Info
(
"%f seconds elapsed, finished iteration %d"
,
std
::
chrono
::
duration
<
double
,
std
::
milli
>
(
end_time
-
start_time
)
*
1e-3
,
iter
+
1
);
std
::
milli
>
(
end_time
-
start_time
)
*
1e-3
,
iter
+
1
);
...
...
src/boosting/goss.hpp
View file @
834a8986
...
@@ -102,8 +102,11 @@ public:
...
@@ -102,8 +102,11 @@ public:
double
prob
=
(
rest_need
)
/
static_cast
<
double
>
(
rest_all
);
double
prob
=
(
rest_need
)
/
static_cast
<
double
>
(
rest_all
);
if
(
cur_rand
.
NextFloat
()
<
prob
)
{
if
(
cur_rand
.
NextFloat
()
<
prob
)
{
buffer
[
cur_left_cnt
++
]
=
start
+
i
;
buffer
[
cur_left_cnt
++
]
=
start
+
i
;
gradients_
[
start
+
i
]
*=
multiply
;
for
(
int
curr_class
=
0
;
curr_class
<
num_class_
;
++
curr_class
)
{
hessians_
[
start
+
i
]
*=
multiply
;
int
idx
=
curr_class
*
num_data_
+
start
+
i
;
gradients_
[
idx
]
*=
multiply
;
hessians_
[
idx
]
*=
multiply
;
}
}
else
{
}
else
{
buffer_right
[
cur_right_cnt
++
]
=
start
+
i
;
buffer_right
[
cur_right_cnt
++
]
=
start
+
i
;
}
}
...
...
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