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
0f4ea846
"...git@developer.sourcefind.cn:tianlh/lightgbm-dcu.git" did not exist on "0a4d1908289ef8b8d5b64190d1e92bd987ccc9b0"
Commit
0f4ea846
authored
Nov 11, 2016
by
Guolin Ke
Browse files
change GetTrainnigScore to non-const.
parent
a80ae694
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
5 deletions
+7
-5
include/LightGBM/boosting.h
include/LightGBM/boosting.h
+1
-1
src/boosting/gbdt.cpp
src/boosting/gbdt.cpp
+1
-1
src/boosting/gbdt.h
src/boosting/gbdt.h
+1
-1
src/c_api.cpp
src/c_api.cpp
+4
-2
No files found.
include/LightGBM/boosting.h
View file @
0f4ea846
...
@@ -64,7 +64,7 @@ public:
...
@@ -64,7 +64,7 @@ public:
* \param out_len length of returned score
* \param out_len length of returned score
* \return training score
* \return training score
*/
*/
virtual
const
score_t
*
GetTrainingScore
(
data_size_t
*
out_len
)
const
=
0
;
virtual
const
score_t
*
GetTrainingScore
(
data_size_t
*
out_len
)
=
0
;
/*!
/*!
* \brief Get prediction result at data_idx data
* \brief Get prediction result at data_idx data
...
...
src/boosting/gbdt.cpp
View file @
0f4ea846
...
@@ -294,7 +294,7 @@ std::vector<double> GBDT::GetEvalAt(int data_idx) const {
...
@@ -294,7 +294,7 @@ std::vector<double> GBDT::GetEvalAt(int data_idx) const {
}
}
/*! \brief Get training scores result */
/*! \brief Get training scores result */
const
score_t
*
GBDT
::
GetTrainingScore
(
data_size_t
*
out_len
)
const
{
const
score_t
*
GBDT
::
GetTrainingScore
(
data_size_t
*
out_len
)
{
*
out_len
=
train_score_updater_
->
num_data
()
*
num_class_
;
*
out_len
=
train_score_updater_
->
num_data
()
*
num_class_
;
return
train_score_updater_
->
score
();
return
train_score_updater_
->
score
();
}
}
...
...
src/boosting/gbdt.h
View file @
0f4ea846
...
@@ -62,7 +62,7 @@ public:
...
@@ -62,7 +62,7 @@ public:
* \param out_len lenght of returned score
* \param out_len lenght of returned score
* \return training score
* \return training score
*/
*/
const
score_t
*
GetTrainingScore
(
data_size_t
*
out_len
)
const
override
;
const
score_t
*
GetTrainingScore
(
data_size_t
*
out_len
)
override
;
/*!
/*!
* \brief Get prediction result at data_idx data
* \brief Get prediction result at data_idx data
...
...
src/c_api.cpp
View file @
0f4ea846
...
@@ -127,8 +127,11 @@ public:
...
@@ -127,8 +127,11 @@ public:
void
SaveModelToFile
(
int
num_used_model
,
const
char
*
filename
)
{
void
SaveModelToFile
(
int
num_used_model
,
const
char
*
filename
)
{
boosting_
->
SaveModelToFile
(
num_used_model
,
true
,
filename
);
boosting_
->
SaveModelToFile
(
num_used_model
,
true
,
filename
);
}
}
const
Boosting
*
GetBoosting
()
const
{
return
boosting_
;
}
const
Boosting
*
GetBoosting
()
const
{
return
boosting_
;
}
const
float
*
GetTrainingScore
(
int
*
out_len
)
const
{
return
boosting_
->
GetTrainingScore
(
out_len
);
}
const
inline
int
NumberOfClasses
()
const
{
return
boosting_
->
NumberOfClasses
();
}
const
inline
int
NumberOfClasses
()
const
{
return
boosting_
->
NumberOfClasses
();
}
private:
private:
...
@@ -478,9 +481,8 @@ DllExport int LGBM_BoosterGetScore(BoosterHandle handle,
...
@@ -478,9 +481,8 @@ DllExport int LGBM_BoosterGetScore(BoosterHandle handle,
const
float
**
out_result
)
{
const
float
**
out_result
)
{
Booster
*
ref_booster
=
reinterpret_cast
<
Booster
*>
(
handle
);
Booster
*
ref_booster
=
reinterpret_cast
<
Booster
*>
(
handle
);
auto
boosting
=
ref_booster
->
GetBoosting
();
int
len
=
0
;
int
len
=
0
;
*
out_result
=
boost
ing
->
GetTrainingScore
(
&
len
);
*
out_result
=
ref_
boost
er
->
GetTrainingScore
(
&
len
);
*
out_len
=
static_cast
<
int64_t
>
(
len
);
*
out_len
=
static_cast
<
int64_t
>
(
len
);
return
0
;
return
0
;
...
...
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