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
9fe30681
"src/git@developer.sourcefind.cn:tianlh/lightgbm-dcu.git" did not exist on "a60d45c56d941ed90949f933acf86eae224df255"
Commit
9fe30681
authored
Mar 26, 2017
by
zhangyafeikimi
Committed by
Guolin Ke
Mar 26, 2017
Browse files
fix typos (#361)
parent
6fac4702
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
9 deletions
+7
-9
src/boosting/boosting.cpp
src/boosting/boosting.cpp
+3
-3
src/boosting/dart.hpp
src/boosting/dart.hpp
+2
-2
src/boosting/gbdt.cpp
src/boosting/gbdt.cpp
+1
-1
src/boosting/gbdt.h
src/boosting/gbdt.h
+1
-3
No files found.
src/boosting/boosting.cpp
View file @
9fe30681
...
@@ -48,11 +48,11 @@ Boosting* Boosting::CreateBoosting(const std::string& type, const char* filename
...
@@ -48,11 +48,11 @@ Boosting* Boosting::CreateBoosting(const std::string& type, const char* filename
}
else
if
(
type
==
std
::
string
(
"goss"
))
{
}
else
if
(
type
==
std
::
string
(
"goss"
))
{
ret
.
reset
(
new
GOSS
());
ret
.
reset
(
new
GOSS
());
}
else
{
}
else
{
Log
::
Fatal
(
"unknow boosting type %s"
,
type
.
c_str
());
Log
::
Fatal
(
"unknow
n
boosting type %s"
,
type
.
c_str
());
}
}
LoadFileToBoosting
(
ret
.
get
(),
filename
);
LoadFileToBoosting
(
ret
.
get
(),
filename
);
}
else
{
}
else
{
Log
::
Fatal
(
"unknow submodel type in model file %s"
,
filename
);
Log
::
Fatal
(
"unknow
n
submodel type in model file %s"
,
filename
);
}
}
return
ret
.
release
();
return
ret
.
release
();
}
}
...
@@ -64,7 +64,7 @@ Boosting* Boosting::CreateBoosting(const char* filename) {
...
@@ -64,7 +64,7 @@ Boosting* Boosting::CreateBoosting(const char* filename) {
if
(
type
==
std
::
string
(
"tree"
))
{
if
(
type
==
std
::
string
(
"tree"
))
{
ret
.
reset
(
new
GBDT
());
ret
.
reset
(
new
GBDT
());
}
else
{
}
else
{
Log
::
Fatal
(
"unknow submodel type in model file %s"
,
filename
);
Log
::
Fatal
(
"unknow
n
submodel type in model file %s"
,
filename
);
}
}
LoadFileToBoosting
(
ret
.
get
(),
filename
);
LoadFileToBoosting
(
ret
.
get
(),
filename
);
return
ret
.
release
();
return
ret
.
release
();
...
...
src/boosting/dart.hpp
View file @
9fe30681
...
@@ -84,7 +84,7 @@ private:
...
@@ -84,7 +84,7 @@ private:
void
DroppingTrees
()
{
void
DroppingTrees
()
{
drop_index_
.
clear
();
drop_index_
.
clear
();
bool
is_skip
=
random_for_drop_
.
NextFloat
()
<
gbdt_config_
->
skip_drop
;
bool
is_skip
=
random_for_drop_
.
NextFloat
()
<
gbdt_config_
->
skip_drop
;
// select dropping tree ind
ex
es based on drop_rate and tree weights
// select dropping tree ind
ic
es based on drop_rate and tree weights
if
(
!
is_skip
)
{
if
(
!
is_skip
)
{
double
drop_rate
=
gbdt_config_
->
drop_rate
;
double
drop_rate
=
gbdt_config_
->
drop_rate
;
if
(
!
gbdt_config_
->
uniform_drop
)
{
if
(
!
gbdt_config_
->
uniform_drop
)
{
...
@@ -180,7 +180,7 @@ private:
...
@@ -180,7 +180,7 @@ private:
std
::
vector
<
double
>
tree_weight_
;
std
::
vector
<
double
>
tree_weight_
;
/*! \brief sum weights of all trees */
/*! \brief sum weights of all trees */
double
sum_weight_
;
double
sum_weight_
;
/*! \brief The ind
ex
es of dropping trees */
/*! \brief The ind
ic
es of dropping trees */
std
::
vector
<
int
>
drop_index_
;
std
::
vector
<
int
>
drop_index_
;
/*! \brief Random generator, used to select dropping trees */
/*! \brief Random generator, used to select dropping trees */
Random
random_for_drop_
;
Random
random_for_drop_
;
...
...
src/boosting/gbdt.cpp
View file @
9fe30681
...
@@ -370,7 +370,7 @@ bool GBDT::TrainOneIter(const score_t* gradient, const score_t* hessian, bool is
...
@@ -370,7 +370,7 @@ bool GBDT::TrainOneIter(const score_t* gradient, const score_t* hessian, bool is
#ifdef TIMETAG
#ifdef TIMETAG
start_time
=
std
::
chrono
::
steady_clock
::
now
();
start_time
=
std
::
chrono
::
steady_clock
::
now
();
#endif
#endif
std
::
unique_ptr
<
Tree
>
new_tree
(
new
Tree
(
2
))
;
std
::
unique_ptr
<
Tree
>
new_tree
;
// train a new tree
// train a new tree
new_tree
.
reset
(
tree_learner_
->
Train
(
gradient
+
curr_class
*
num_data_
,
hessian
+
curr_class
*
num_data_
));
new_tree
.
reset
(
tree_learner_
->
Train
(
gradient
+
curr_class
*
num_data_
,
hessian
+
curr_class
*
num_data_
));
#ifdef TIMETAG
#ifdef TIMETAG
...
...
src/boosting/gbdt.h
View file @
9fe30681
...
@@ -26,11 +26,10 @@ public:
...
@@ -26,11 +26,10 @@ public:
~
GBDT
();
~
GBDT
();
/*!
/*!
* \brief Initialization logic
* \brief Initialization logic
* \param config Config for boosting
* \param
gbdt_
config Config for boosting
* \param train_data Training data
* \param train_data Training data
* \param object_function Training objective function
* \param object_function Training objective function
* \param training_metrics Training metrics
* \param training_metrics Training metrics
* \param output_model_filename Filename of output model
*/
*/
void
Init
(
const
BoostingConfig
*
gbdt_config
,
const
Dataset
*
train_data
,
const
ObjectiveFunction
*
object_function
,
void
Init
(
const
BoostingConfig
*
gbdt_config
,
const
Dataset
*
train_data
,
const
ObjectiveFunction
*
object_function
,
const
std
::
vector
<
const
Metric
*>&
training_metrics
)
const
std
::
vector
<
const
Metric
*>&
training_metrics
)
...
@@ -267,7 +266,6 @@ protected:
...
@@ -267,7 +266,6 @@ protected:
std
::
string
OutputMetric
(
int
iter
);
std
::
string
OutputMetric
(
int
iter
);
/*!
/*!
* \brief Calculate feature importances
* \brief Calculate feature importances
* \param last_iter Last tree use to calculate
*/
*/
std
::
vector
<
std
::
pair
<
size_t
,
std
::
string
>>
FeatureImportance
()
const
;
std
::
vector
<
std
::
pair
<
size_t
,
std
::
string
>>
FeatureImportance
()
const
;
/*! \brief current iteration */
/*! \brief current iteration */
...
...
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