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
42ddff1d
Unverified
Commit
42ddff1d
authored
Jun 18, 2021
by
shiyu1994
Committed by
GitHub
Jun 18, 2021
Browse files
fix Sample when sampling only one element (fix #4134) (#4324)
parent
4167649c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
include/LightGBM/utils/random.h
include/LightGBM/utils/random.h
+3
-0
No files found.
include/LightGBM/utils/random.h
View file @
42ddff1d
...
...
@@ -82,6 +82,9 @@ class Random {
ret
.
push_back
(
i
);
}
}
}
else
if
(
K
==
1
)
{
int
v
=
NextInt
(
0
,
N
);
ret
.
push_back
(
v
);
}
else
{
std
::
set
<
int
>
sample_set
;
for
(
int
r
=
N
-
K
;
r
<
N
;
++
r
)
{
...
...
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