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
31b19afc
"src/git@developer.sourcefind.cn:tianlh/lightgbm-dcu.git" did not exist on "790c1e33e690c2e11c12277e30e83644af268ba1"
Commit
31b19afc
authored
Nov 08, 2016
by
Guolin Ke
Browse files
some bugs fixed
parent
4a6bdcbe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
src/c_api.cpp
src/c_api.cpp
+8
-9
src/io/dataset_loader.cpp
src/io/dataset_loader.cpp
+9
-0
No files found.
src/c_api.cpp
View file @
31b19afc
...
...
@@ -43,16 +43,15 @@ public:
ObjectiveFunction
::
CreateObjectiveFunction
(
config_
.
objective_type
,
config_
.
objective_config
);
// create training metric
if
(
config_
.
boosting_config
->
is_provide_training_metric
)
{
for
(
auto
metric_type
:
config_
.
metric_types
)
{
Metric
*
metric
=
Metric
::
CreateMetric
(
metric_type
,
config_
.
metric_config
);
if
(
metric
==
nullptr
)
{
continue
;
}
metric
->
Init
(
"training"
,
train_data_
->
metadata
(),
train_data_
->
num_data
());
train_metric_
.
push_back
(
metric
);
}
for
(
auto
metric_type
:
config_
.
metric_types
)
{
Metric
*
metric
=
Metric
::
CreateMetric
(
metric_type
,
config_
.
metric_config
);
if
(
metric
==
nullptr
)
{
continue
;
}
metric
->
Init
(
"training"
,
train_data_
->
metadata
(),
train_data_
->
num_data
());
train_metric_
.
push_back
(
metric
);
}
// add metric for validation data
for
(
size_t
i
=
0
;
i
<
valid_datas_
.
size
();
++
i
)
{
valid_metrics_
.
emplace_back
();
...
...
src/io/dataset_loader.cpp
View file @
31b19afc
...
...
@@ -437,6 +437,15 @@ Dataset* DatasetLoader::CostructFromSampleData(std::vector<std::vector<double>>&
delete
bin_mappers
[
i
];
}
}
// fill feature_names_ if not header
if
(
feature_names_
.
size
()
<=
0
)
{
for
(
int
i
=
0
;
i
<
dataset
->
num_total_features_
;
++
i
)
{
std
::
stringstream
str_buf
;
str_buf
<<
"Column_"
<<
i
;
feature_names_
.
push_back
(
str_buf
.
str
());
}
}
dataset
->
feature_names_
=
feature_names_
;
dataset
->
num_features_
=
static_cast
<
int
>
(
dataset
->
features_
.
size
());
dataset
->
metadata_
.
Init
(
dataset
->
num_data_
,
dataset
->
num_class_
,
NO_SPECIFIC
,
NO_SPECIFIC
);
return
dataset
;
...
...
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