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
87d4ce09
Commit
87d4ce09
authored
Dec 25, 2017
by
Guolin Ke
Browse files
fix data_filename_ bug with c_api
parent
301e0a7c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
include/LightGBM/dataset.h
include/LightGBM/dataset.h
+2
-2
src/io/dataset.cpp
src/io/dataset.cpp
+1
-1
src/io/dataset_loader.cpp
src/io/dataset_loader.cpp
+2
-2
No files found.
include/LightGBM/dataset.h
View file @
87d4ce09
...
@@ -219,7 +219,7 @@ private:
...
@@ -219,7 +219,7 @@ private:
/*! \brief Load query wights */
/*! \brief Load query wights */
void
LoadQueryWeights
();
void
LoadQueryWeights
();
/*! \brief Filename of current data */
/*! \brief Filename of current data */
const
char
*
data_filename_
;
std
::
string
data_filename_
;
/*! \brief Number of data */
/*! \brief Number of data */
data_size_t
num_data_
;
data_size_t
num_data_
;
/*! \brief Number of weights, used to check correct weight file */
/*! \brief Number of weights, used to check correct weight file */
...
@@ -546,7 +546,7 @@ public:
...
@@ -546,7 +546,7 @@ public:
Dataset
(
const
Dataset
&
)
=
delete
;
Dataset
(
const
Dataset
&
)
=
delete
;
private:
private:
const
char
*
data_filename_
;
std
::
string
data_filename_
;
/*! \brief Store used features */
/*! \brief Store used features */
std
::
vector
<
std
::
unique_ptr
<
FeatureGroup
>>
feature_groups_
;
std
::
vector
<
std
::
unique_ptr
<
FeatureGroup
>>
feature_groups_
;
/*! \brief Mapper from real feature index to used index*/
/*! \brief Mapper from real feature index to used index*/
...
...
src/io/dataset.cpp
View file @
87d4ce09
...
@@ -511,7 +511,7 @@ bool Dataset::GetIntField(const char* field_name, data_size_t* out_len, const in
...
@@ -511,7 +511,7 @@ bool Dataset::GetIntField(const char* field_name, data_size_t* out_len, const in
void
Dataset
::
SaveBinaryFile
(
const
char
*
bin_filename
)
{
void
Dataset
::
SaveBinaryFile
(
const
char
*
bin_filename
)
{
if
(
bin_filename
!=
nullptr
if
(
bin_filename
!=
nullptr
&&
std
::
string
(
bin_filename
)
==
std
::
string
(
data_filename_
)
)
{
&&
std
::
string
(
bin_filename
)
==
data_filename_
)
{
Log
::
Warning
(
"Bianry file %s already existed"
,
bin_filename
);
Log
::
Warning
(
"Bianry file %s already existed"
,
bin_filename
);
return
;
return
;
}
}
...
...
src/io/dataset_loader.cpp
View file @
87d4ce09
...
@@ -608,10 +608,10 @@ Dataset* DatasetLoader::CostructFromSampleData(double** sample_values,
...
@@ -608,10 +608,10 @@ Dataset* DatasetLoader::CostructFromSampleData(double** sample_values,
void
DatasetLoader
::
CheckDataset
(
const
Dataset
*
dataset
)
{
void
DatasetLoader
::
CheckDataset
(
const
Dataset
*
dataset
)
{
if
(
dataset
->
num_data_
<=
0
)
{
if
(
dataset
->
num_data_
<=
0
)
{
Log
::
Fatal
(
"Data file %s is empty"
,
dataset
->
data_filename_
);
Log
::
Fatal
(
"Data file %s is empty"
,
dataset
->
data_filename_
.
c_str
()
);
}
}
if
(
dataset
->
feature_groups_
.
empty
())
{
if
(
dataset
->
feature_groups_
.
empty
())
{
Log
::
Fatal
(
"No usable features in data file %s"
,
dataset
->
data_filename_
);
Log
::
Fatal
(
"No usable features in data file %s"
,
dataset
->
data_filename_
.
c_str
()
);
}
}
if
(
dataset
->
feature_names_
.
size
()
!=
static_cast
<
size_t
>
(
dataset
->
num_total_features_
))
{
if
(
dataset
->
feature_names_
.
size
()
!=
static_cast
<
size_t
>
(
dataset
->
num_total_features_
))
{
Log
::
Fatal
(
"Size of feature name error, should be %d, got %d"
,
dataset
->
num_total_features_
,
Log
::
Fatal
(
"Size of feature name error, should be %d, got %d"
,
dataset
->
num_total_features_
,
...
...
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