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
d90369a0
Commit
d90369a0
authored
Jan 15, 2018
by
Guolin Ke
Browse files
add notes for ArgMaxAtK and MaxK
parent
0f0eb69e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
include/LightGBM/utils/array_args.h
include/LightGBM/utils/array_args.h
+2
-1
No files found.
include/LightGBM/utils/array_args.h
View file @
d90369a0
...
@@ -126,7 +126,7 @@ public:
...
@@ -126,7 +126,7 @@ public:
*
r
=
i
;
*
r
=
i
;
};
};
// Note: k refer to index here. e.g. k=0 means get max number.
// Note: k refer to index here. e.g. k=0 means get
the
max number.
inline
static
int
ArgMaxAtK
(
std
::
vector
<
VAL_T
>*
arr
,
int
start
,
int
end
,
int
k
)
{
inline
static
int
ArgMaxAtK
(
std
::
vector
<
VAL_T
>*
arr
,
int
start
,
int
end
,
int
k
)
{
if
(
start
>=
end
-
1
)
{
if
(
start
>=
end
-
1
)
{
return
start
;
return
start
;
...
@@ -144,6 +144,7 @@ public:
...
@@ -144,6 +144,7 @@ public:
}
}
}
}
// Note: k is 1-based here. e.g. k=3 means get the top-3 numbers.
inline
static
void
MaxK
(
const
std
::
vector
<
VAL_T
>&
array
,
int
k
,
std
::
vector
<
VAL_T
>*
out
)
{
inline
static
void
MaxK
(
const
std
::
vector
<
VAL_T
>&
array
,
int
k
,
std
::
vector
<
VAL_T
>*
out
)
{
out
->
clear
();
out
->
clear
();
if
(
k
<=
0
)
{
if
(
k
<=
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