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
da59fd22
Commit
da59fd22
authored
Jan 26, 2017
by
Guolin Ke
Browse files
fix warning
parent
68bc8a61
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
8 deletions
+5
-8
include/LightGBM/bin.h
include/LightGBM/bin.h
+1
-2
src/io/bin.cpp
src/io/bin.cpp
+1
-3
src/io/dataset_loader.cpp
src/io/dataset_loader.cpp
+3
-3
No files found.
include/LightGBM/bin.h
View file @
da59fd22
...
...
@@ -129,13 +129,12 @@ public:
}
/*!
* \brief Construct feature value to bin mapper according feature values
* \param column_name name of this column
* \param values (Sampled) values of this feature, Note: not include zero.
* \param total_sample_cnt number of total sample count, equal with values.size() + num_zeros
* \param max_bin The maximal number of bin
* \param bin_type Type of this bin
*/
void
FindBin
(
const
std
::
string
&
column_name
,
std
::
vector
<
double
>*
values
,
size_t
total_sample_cnt
,
int
max_bin
,
BinType
bin_type
);
void
FindBin
(
std
::
vector
<
double
>*
values
,
size_t
total_sample_cnt
,
int
max_bin
,
BinType
bin_type
);
/*!
* \brief Use specific number of bin to calculate the size of this class
...
...
src/io/bin.cpp
View file @
da59fd22
...
...
@@ -43,7 +43,7 @@ BinMapper::~BinMapper() {
}
void
BinMapper
::
FindBin
(
const
std
::
string
&
column_name
,
std
::
vector
<
double
>*
values
,
size_t
total_sample_cnt
,
int
max_bin
,
BinType
bin_type
)
{
void
BinMapper
::
FindBin
(
std
::
vector
<
double
>*
values
,
size_t
total_sample_cnt
,
int
max_bin
,
BinType
bin_type
)
{
bin_type_
=
bin_type
;
std
::
vector
<
double
>&
ref_values
=
(
*
values
);
size_t
sample_size
=
total_sample_cnt
;
...
...
@@ -89,7 +89,6 @@ void BinMapper::FindBin(const std::string& column_name, std::vector<double>* val
max_val_
=
distinct_values
.
back
();
std
::
vector
<
int
>
cnt_in_bin
;
int
num_values
=
static_cast
<
int
>
(
distinct_values
.
size
());
int
cnt_in_bin0
=
0
;
if
(
bin_type_
==
BinType
::
NumericalBin
)
{
if
(
num_values
<=
max_bin
)
{
std
::
sort
(
distinct_values
.
begin
(),
distinct_values
.
end
());
...
...
@@ -142,7 +141,6 @@ void BinMapper::FindBin(const std::string& column_name, std::vector<double>* val
}
}
}
//
++
bin_cnt
;
// update bin upper bound
bin_upper_bound_
=
std
::
vector
<
double
>
(
bin_cnt
);
...
...
src/io/dataset_loader.cpp
View file @
da59fd22
...
...
@@ -448,7 +448,7 @@ Dataset* DatasetLoader::CostructFromSampleData(std::vector<std::vector<double>>&
if
(
categorical_features_
.
count
(
i
))
{
bin_type
=
BinType
::
CategoricalBin
;
}
bin_mappers
[
i
]
->
FindBin
(
feature_names_
[
i
],
&
sample_values
[
i
],
total_sample_size
,
io_config_
.
max_bin
,
bin_type
);
bin_mappers
[
i
]
->
FindBin
(
&
sample_values
[
i
],
total_sample_size
,
io_config_
.
max_bin
,
bin_type
);
}
auto
dataset
=
std
::
unique_ptr
<
Dataset
>
(
new
Dataset
());
...
...
@@ -668,7 +668,7 @@ void DatasetLoader::ConstructBinMappersFromTextData(int rank, int num_machines,
if
(
categorical_features_
.
count
(
i
))
{
bin_type
=
BinType
::
CategoricalBin
;
}
bin_mappers
[
i
]
->
FindBin
(
feature_names_
[
i
],
&
sample_values
[
i
],
sample_data
.
size
(),
io_config_
.
max_bin
,
bin_type
);
bin_mappers
[
i
]
->
FindBin
(
&
sample_values
[
i
],
sample_data
.
size
(),
io_config_
.
max_bin
,
bin_type
);
}
for
(
size_t
i
=
0
;
i
<
sample_values
.
size
();
++
i
)
{
...
...
@@ -722,7 +722,7 @@ void DatasetLoader::ConstructBinMappersFromTextData(int rank, int num_machines,
if
(
categorical_features_
.
count
(
start
[
rank
]
+
i
))
{
bin_type
=
BinType
::
CategoricalBin
;
}
bin_mapper
.
FindBin
(
feature_names_
[
start
[
rank
]
+
i
],
&
sample_values
[
start
[
rank
]
+
i
],
sample_data
.
size
(),
io_config_
.
max_bin
,
bin_type
);
bin_mapper
.
FindBin
(
&
sample_values
[
start
[
rank
]
+
i
],
sample_data
.
size
(),
io_config_
.
max_bin
,
bin_type
);
bin_mapper
.
CopyTo
(
input_buffer
.
data
()
+
i
*
type_size
);
}
// convert to binary size
...
...
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