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
0df38106
Unverified
Commit
0df38106
authored
Dec 21, 2021
by
James Lamb
Committed by
GitHub
Dec 22, 2021
Browse files
[R-package] remove unnecessary comments and fix typos in comments (#4902)
parent
7b10baff
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
13 deletions
+7
-13
R-package/R/lgb.Dataset.R
R-package/R/lgb.Dataset.R
+5
-11
R-package/R/lgb.cv.R
R-package/R/lgb.cv.R
+1
-1
R-package/R/utils.R
R-package/R/utils.R
+1
-1
No files found.
R-package/R/lgb.Dataset.R
View file @
0df38106
...
@@ -236,7 +236,7 @@ Dataset <- R6::R6Class(
...
@@ -236,7 +236,7 @@ Dataset <- R6::R6Class(
if
(
length
(
private
$
raw_data
@
p
)
>
2147483647L
)
{
if
(
length
(
private
$
raw_data
@
p
)
>
2147483647L
)
{
stop
(
"Cannot support large CSC matrix"
)
stop
(
"Cannot support large CSC matrix"
)
}
}
# Are we using a dgCMatrix (sparse
d
matrix column compressed)
# Are we using a dgCMatrix (sparse matrix column compressed)
handle
<-
.Call
(
handle
<-
.Call
(
LGBM_DatasetCreateFromCSC_R
LGBM_DatasetCreateFromCSC_R
,
private
$
raw_data
@
p
,
private
$
raw_data
@
p
...
@@ -462,15 +462,14 @@ Dataset <- R6::R6Class(
...
@@ -462,15 +462,14 @@ Dataset <- R6::R6Class(
,
info_len
,
info_len
)
)
# Check if info is not empty
if
(
info_len
>
0L
)
{
if
(
info_len
>
0L
)
{
# Get back fields
# Get back fields
ret
<-
NULL
ret
<-
NULL
ret
<-
if
(
field_name
==
"group"
)
{
ret
<-
if
(
field_name
==
"group"
)
{
integer
(
info_len
)
# Integer
integer
(
info_len
)
}
else
{
}
else
{
numeric
(
info_len
)
# Numeric
numeric
(
info_len
)
}
}
.Call
(
.Call
(
...
@@ -501,9 +500,9 @@ Dataset <- R6::R6Class(
...
@@ -501,9 +500,9 @@ Dataset <- R6::R6Class(
# Check for type of information
# Check for type of information
data
<-
if
(
field_name
==
"group"
)
{
data
<-
if
(
field_name
==
"group"
)
{
as.integer
(
data
)
# Integer
as.integer
(
data
)
}
else
{
}
else
{
as.numeric
(
data
)
# Numeric
as.numeric
(
data
)
}
}
# Store information privately
# Store information privately
...
@@ -531,10 +530,8 @@ Dataset <- R6::R6Class(
...
@@ -531,10 +530,8 @@ Dataset <- R6::R6Class(
},
},
# Slice dataset
slice
=
function
(
idxset
)
{
slice
=
function
(
idxset
)
{
# Perform slicing
return
(
return
(
Dataset
$
new
(
Dataset
$
new
(
data
=
NULL
data
=
NULL
...
@@ -617,7 +614,6 @@ Dataset <- R6::R6Class(
...
@@ -617,7 +614,6 @@ Dataset <- R6::R6Class(
},
},
# Set reference
set_reference
=
function
(
reference
)
{
set_reference
=
function
(
reference
)
{
# setting reference to this same Dataset object doesn't require any changes
# setting reference to this same Dataset object doesn't require any changes
...
@@ -677,7 +673,6 @@ Dataset <- R6::R6Class(
...
@@ -677,7 +673,6 @@ Dataset <- R6::R6Class(
info
=
NULL
,
info
=
NULL
,
version
=
0L
,
version
=
0L
,
# Get handle
get_handle
=
function
()
{
get_handle
=
function
()
{
# Get handle and construct if needed
# Get handle and construct if needed
...
@@ -688,7 +683,6 @@ Dataset <- R6::R6Class(
...
@@ -688,7 +683,6 @@ Dataset <- R6::R6Class(
},
},
# Set predictor
set_predictor
=
function
(
predictor
)
{
set_predictor
=
function
(
predictor
)
{
if
(
identical
(
private
$
predictor
,
predictor
))
{
if
(
identical
(
private
$
predictor
,
predictor
))
{
...
...
R-package/R/lgb.cv.R
View file @
0df38106
...
@@ -550,7 +550,7 @@ lgb.stratified.folds <- function(y, k) {
...
@@ -550,7 +550,7 @@ lgb.stratified.folds <- function(y, k) {
## Create a vector of integers from 1:k as many times as possible without
## Create a vector of integers from 1:k as many times as possible without
## going over the number of samples in the class. Note that if the number
## going over the number of samples in the class. Note that if the number
## of samples in a class is less than k, nothing is producd here.
## of samples in a class is less than k, nothing is produc
e
d here.
seqVector
<-
rep
(
seq_len
(
k
),
numInClass
[
i
]
%/%
k
)
seqVector
<-
rep
(
seq_len
(
k
),
numInClass
[
i
]
%/%
k
)
## Add enough random integers to get length(seqVector) == numInClass[i]
## Add enough random integers to get length(seqVector) == numInClass[i]
...
...
R-package/R/utils.R
View file @
0df38106
...
@@ -268,7 +268,7 @@ lgb.check.wrapper_param <- function(main_param_name, params, alternative_kwarg_v
...
@@ -268,7 +268,7 @@ lgb.check.wrapper_param <- function(main_param_name, params, alternative_kwarg_v
return
(
params
)
return
(
params
)
}
}
# if the main parameter wasn't pro
o
vided, prefer the first alias
# if the main parameter wasn't provided, prefer the first alias
if
(
length
(
aliases_provided
)
>
0L
)
{
if
(
length
(
aliases_provided
)
>
0L
)
{
first_param
<-
aliases_provided
[
1L
]
first_param
<-
aliases_provided
[
1L
]
params
[[
main_param_name
]]
<-
params
[[
first_param
]]
params
[[
main_param_name
]]
<-
params
[[
first_param
]]
...
...
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