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
0eb99219
Commit
0eb99219
authored
Apr 24, 2017
by
Guolin Ke
Browse files
remove some files.
parent
dbfa16c3
Changes
32
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
368 additions
and
896 deletions
+368
-896
R-package/man/lgb.save.Rd
R-package/man/lgb.save.Rd
+0
-44
R-package/man/lgb.train.Rd
R-package/man/lgb.train.Rd
+0
-185
R-package/man/lgb.unloader.Rd
R-package/man/lgb.unloader.Rd
+0
-49
R-package/man/predict.lgb.Booster.Rd
R-package/man/predict.lgb.Booster.Rd
+0
-62
R-package/man/readRDS.lgb.Booster.Rd
R-package/man/readRDS.lgb.Booster.Rd
+0
-43
R-package/man/saveRDS.lgb.Booster.Rd
R-package/man/saveRDS.lgb.Booster.Rd
+0
-53
R-package/man/setinfo.Rd
R-package/man/setinfo.Rd
+0
-53
R-package/man/slice.Rd
R-package/man/slice.Rd
+0
-38
R-package/src/R_object_helper.h
R-package/src/R_object_helper.h
+47
-47
R-package/src/lightgbm_R.cpp
R-package/src/lightgbm_R.cpp
+161
-161
R-package/src/lightgbm_R.h
R-package/src/lightgbm_R.h
+160
-160
src/network/socket_wrapper.hpp
src/network/socket_wrapper.hpp
+0
-1
No files found.
R-package/man/lgb.save.Rd
deleted
100644 → 0
View file @
dbfa16c3
%
Generated
by
roxygen2
:
do
not
edit
by
hand
%
Please
edit
documentation
in
R
/
lgb
.
Booster
.
R
\
name
{
lgb
.
save
}
\
alias
{
lgb
.
save
}
\
title
{
Save
LightGBM
model
}
\
usage
{
lgb
.
save
(
booster
,
filename
,
num_iteration
=
NULL
)
}
\
arguments
{
\
item
{
booster
}{
Object
of
class
\
code
{
lgb
.
Booster
}}
\
item
{
filename
}{
saved
filename
}
\
item
{
num_iteration
}{
number
of
iteration
want
to
predict
with
,
NULL
or
<=
0
means
use
best
iteration
}
}
\
value
{
booster
}
\
description
{
Save
LightGBM
model
}
\
examples
{
\
dontrun
{
library
(
lightgbm
)
data
(
agaricus
.
train
,
package
=
"lightgbm"
)
train
<-
agaricus
.
train
dtrain
<-
lgb
.
Dataset
(
train
$
data
,
label
=
train
$
label
)
data
(
agaricus
.
test
,
package
=
"lightgbm"
)
test
<-
agaricus
.
test
dtest
<-
lgb
.
Dataset
.
create
.
valid
(
dtrain
,
test
$
data
,
label
=
test
$
label
)
params
<-
list
(
objective
=
"regression"
,
metric
=
"l2"
)
valids
<-
list
(
test
=
dtest
)
model
<-
lgb
.
train
(
params
,
dtrain
,
100
,
valids
,
min_data
=
1
,
learning_rate
=
1
,
early_stopping_rounds
=
10
)
lgb
.
save
(
model
,
"model.txt"
)
}
}
R-package/man/lgb.train.Rd
deleted
100644 → 0
View file @
dbfa16c3
%
Generated
by
roxygen2
:
do
not
edit
by
hand
%
Please
edit
documentation
in
R
/
lgb
.
cv
.
R
,
R
/
lgb
.
train
.
R
,
R
/
lightgbm
.
R
\
name
{
lgb
.
cv
}
\
alias
{
lgb
.
cv
}
\
alias
{
lgb
.
train
}
\
alias
{
lightgbm
}
\
title
{
Main
CV
logic
for
LightGBM
}
\
usage
{
lgb
.
cv
(
params
=
list
(),
data
,
nrounds
=
10
,
nfold
=
3
,
label
=
NULL
,
weight
=
NULL
,
obj
=
NULL
,
eval
=
NULL
,
verbose
=
1
,
record
=
TRUE
,
eval_freq
=
1L
,
showsd
=
TRUE
,
stratified
=
TRUE
,
folds
=
NULL
,
init_model
=
NULL
,
colnames
=
NULL
,
categorical_feature
=
NULL
,
early_stopping_rounds
=
NULL
,
callbacks
=
list
(),
...)
lgb
.
train
(
params
=
list
(),
data
,
nrounds
=
10
,
valids
=
list
(),
obj
=
NULL
,
eval
=
NULL
,
verbose
=
1
,
record
=
TRUE
,
eval_freq
=
1L
,
init_model
=
NULL
,
colnames
=
NULL
,
categorical_feature
=
NULL
,
early_stopping_rounds
=
NULL
,
callbacks
=
list
(),
...)
lightgbm
(
data
,
label
=
NULL
,
weight
=
NULL
,
params
=
list
(),
nrounds
=
10
,
verbose
=
1
,
eval_freq
=
1L
,
early_stopping_rounds
=
NULL
,
save_name
=
"lightgbm.model"
,
init_model
=
NULL
,
callbacks
=
list
(),
...)
}
\
arguments
{
\
item
{
params
}{
List
of
parameters
}
\
item
{
data
}{
a
\
code
{
lgb
.
Dataset
}
object
,
used
for
CV
}
\
item
{
nrounds
}{
number
of
CV
rounds
}
\
item
{
nfold
}{
the
original
dataset
is
randomly
partitioned
into
\
code
{
nfold
}
equal
size
subsamples
.}
\
item
{
label
}{
vector
of
response
values
.
Should
be
provided
only
when
data
is
an
R
-
matrix
.}
\
item
{
weight
}{
vector
of
response
values
.
If
not
NULL
,
will
set
to
dataset
}
\
item
{
obj
}{
objective
function
,
can
be
character
or
custom
objective
function
.
Examples
include
\
code
{
regression
},
\
code
{
regression_l1
},
\
code
{
huber
},
\
code
{
binary
},
\
code
{
lambdarank
},
\
code
{
multiclass
},
\
code
{
multiclass
}}
\
item
{
eval
}{
evaluation
function
,
can
be
(
list
of
)
character
or
custom
eval
function
}
\
item
{
verbose
}{
verbosity
for
output
,
if
<=
0
,
also
will
disable
the
print
of
evalutaion
during
training
}
\
item
{
record
}{
Boolean
,
TRUE
will
record
iteration
message
to
\
code
{
booster
$
record_evals
}}
\
item
{
eval_freq
}{
evalutaion
output
frequence
,
only
effect
when
verbose
>
0
}
\
item
{
showsd
}{\
code
{
boolean
},
whether
to
show
standard
deviation
of
cross
validation
}
\
item
{
stratified
}{
a
\
code
{
boolean
}
indicating
whether
sampling
of
folds
should
be
stratified
by
the
values
of
outcome
labels
.}
\
item
{
folds
}{\
code
{
list
}
provides
a
possibility
to
use
a
list
of
pre
-
defined
CV
folds
(
each
element
must
be
a
vector
of
test
fold
's indices). When folds are supplied,
the \code{nfold} and \code{stratified} parameters are ignored.}
\item{init_model}{path of model file of \code{lgb.Booster} object, will continue train from this model}
\item{colnames}{feature names, if not null, will use this to overwrite the names in dataset}
\item{categorical_feature}{list of str or int
type int represents index,
type str represents feature names}
\item{early_stopping_rounds}{int
Activates early stopping.
Requires at least one validation data and one metric
If there'
s
more
than
one
,
will
check
all
of
them
Returns
the
model
with
(
best_iter
+
early_stopping_rounds
)
If
early
stopping
occurs
,
the
model
will
have
'best_iter'
field
}
\
item
{
callbacks
}{
list
of
callback
functions
List
of
callback
functions
that
are
applied
at
each
iteration
.}
\
item
{...}{
other
parameters
,
see
parameters
.
md
for
more
informations
}
\
item
{
valids
}{
a
list
of
\
code
{
lgb
.
Dataset
}
objects
,
used
for
validation
}
\
item
{
boosting
}{
boosting
type
.
\
code
{
gbdt
},
\
code
{
dart
}}
\
item
{
num_leaves
}{
number
of
leaves
in
one
tree
.
defaults
to
127
}
\
item
{
max_depth
}{
Limit
the
max
depth
for
tree
model
.
This
is
used
to
deal
with
overfit
when
#
data
is
small
.
Tree
still
grow
by
leaf
-
wise
.}
\
item
{
num_threads
}{
Number
of
threads
for
LightGBM
.
For
the
best
speed
,
set
this
to
the
number
of
real
CPU
cores
,
not
the
number
of
threads
(
most
CPU
using
hyper
-
threading
to
generate
2
threads
per
CPU
core
).}
\
item
{
params
}{
List
of
parameters
}
\
item
{
data
}{
a
\
code
{
lgb
.
Dataset
}
object
,
used
for
training
}
\
item
{
nrounds
}{
number
of
training
rounds
}
\
item
{
obj
}{
objective
function
,
can
be
character
or
custom
objective
function
.
Examples
include
\
code
{
regression
},
\
code
{
regression_l1
},
\
code
{
huber
},
\
code
{
binary
},
\
code
{
lambdarank
},
\
code
{
multiclass
},
\
code
{
multiclass
}}
\
item
{
boosting
}{
boosting
type
.
\
code
{
gbdt
},
\
code
{
dart
}}
\
item
{
num_leaves
}{
number
of
leaves
in
one
tree
.
defaults
to
127
}
\
item
{
max_depth
}{
Limit
the
max
depth
for
tree
model
.
This
is
used
to
deal
with
overfit
when
#
data
is
small
.
Tree
still
grow
by
leaf
-
wise
.}
\
item
{
num_threads
}{
Number
of
threads
for
LightGBM
.
For
the
best
speed
,
set
this
to
the
number
of
real
CPU
cores
,
not
the
number
of
threads
(
most
CPU
using
hyper
-
threading
to
generate
2
threads
per
CPU
core
).}
\
item
{
eval
}{
evaluation
function
,
can
be
(
a
list
of
)
character
or
custom
eval
function
}
\
item
{
verbose
}{
verbosity
for
output
,
if
<=
0
,
also
will
disable
the
print
of
evalutaion
during
training
}
\
item
{
record
}{
Boolean
,
TRUE
will
record
iteration
message
to
\
code
{
booster
$
record_evals
}}
\
item
{
eval_freq
}{
evalutaion
output
frequency
,
only
effect
when
verbose
>
0
}
\
item
{
init_model
}{
path
of
model
file
of
\
code
{
lgb
.
Booster
}
object
,
will
continue
training
from
this
model
}
\
item
{
colnames
}{
feature
names
,
if
not
null
,
will
use
this
to
overwrite
the
names
in
dataset
}
\
item
{
categorical_feature
}{
list
of
str
or
int
type
int
represents
index
,
type
str
represents
feature
names
}
\
item
{
early_stopping_rounds
}{
int
Activates
early
stopping
.
Requires
at
least
one
validation
data
and
one
metric
If
there
's more than one, will check all of them
Returns the model with (best_iter + early_stopping_rounds)
If early stopping occurs, the model will have '
best_iter
' field}
\item{callbacks}{list of callback functions
List of callback functions that are applied at each iteration.}
\item{...}{other parameters, see parameters.md for more informations}
}
\value{
a trained model \code{lgb.CVBooster}.
a trained booster model \code{lgb.Booster}.
}
\description{
Main CV logic for LightGBM
Main training logic for LightGBM
Simple interface for training an lightgbm model.
Its documentation is combined with lgb.train.
}
\examples{
\dontrun{
library(lightgbm)
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
params <- list(objective = "regression", metric = "l2")
model <- lgb.cv(params,
dtrain,
10,
nfold = 5,
min_data = 1,
learning_rate = 1,
early_stopping_rounds = 10)
}
\dontrun{
library(lightgbm)
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
data(agaricus.test, package = "lightgbm")
test <- agaricus.test
dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label)
params <- list(objective = "regression", metric = "l2")
valids <- list(test = dtest)
model <- lgb.train(params,
dtrain,
100,
valids,
min_data = 1,
learning_rate = 1,
early_stopping_rounds = 10)
}
}
R-package/man/lgb.unloader.Rd
deleted
100644 → 0
View file @
dbfa16c3
%
Generated
by
roxygen2
:
do
not
edit
by
hand
%
Please
edit
documentation
in
R
/
lgb
.
unloader
.
R
\
name
{
lgb
.
unloader
}
\
alias
{
lgb
.
unloader
}
\
title
{
LightGBM
unloading
error
fix
}
\
usage
{
lgb
.
unloader
(
restore
=
TRUE
,
wipe
=
FALSE
,
envir
=
.
GlobalEnv
)
}
\
arguments
{
\
item
{
wipe
}{
Whether
to
wipe
all
\
code
{
lgb
.
Dataset
}
and
\
code
{
lgb
.
Booster
}
from
the
global
environment
.
Defaults
to
\
code
{
FALSE
}
which
means
to
not
remove
them
.}
\
item
{
envir
}{
The
environment
to
perform
wiping
on
if
\
code
{
wipe
==
TRUE
}.
Defaults
to
\
code
{.
GlobalEnv
}
which
is
the
global
environment
.}
\
item
{
restart
}{
Whether
to
reload
\
code
{
LightGBM
}
immediately
after
detaching
from
R
.
Defaults
to
\
code
{
TRUE
}
which
means
automatically
reload
\
code
{
LightGBM
}
once
unloading
is
performed
.}
}
\
value
{
NULL
invisibly
.
}
\
description
{
Attempts
to
unload
LightGBM
packages
so
you
can
remove
objects
cleanly
without
having
to
restart
R
.
This
is
useful
for
instance
if
an
object
becomes
stuck
for
no
apparent
reason
and
you
do
not
want
to
restart
R
to
fix
the
lost
object
.
}
\
examples
{
\
dontrun
{
library
(
lightgbm
)
data
(
agaricus
.
train
,
package
=
"lightgbm"
)
train
<-
agaricus
.
train
dtrain
<-
lgb
.
Dataset
(
train
$
data
,
label
=
train
$
label
)
data
(
agaricus
.
test
,
package
=
"lightgbm"
)
test
<-
agaricus
.
test
dtest
<-
lgb
.
Dataset
.
create
.
valid
(
dtrain
,
test
$
data
,
label
=
test
$
label
)
params
<-
list
(
objective
=
"regression"
,
metric
=
"l2"
)
valids
<-
list
(
test
=
dtest
)
model
<-
lgb
.
train
(
params
,
dtrain
,
100
,
valids
,
min_data
=
1
,
learning_rate
=
1
,
early_stopping_rounds
=
10
)
lgb
.
unloader
(
restore
=
FALSE
,
wipe
=
FALSE
,
envir
=
.
GlobalEnv
)
rm
(
model
,
dtrain
,
dtest
)
#
Not
needed
if
wipe
=
TRUE
gc
()
#
Not
needed
if
wipe
=
TRUE
library
(
lightgbm
)
#
Do
whatever
you
want
again
with
LightGBM
without
object
clashing
}
}
R-package/man/predict.lgb.Booster.Rd
deleted
100644 → 0
View file @
dbfa16c3
%
Generated
by
roxygen2
:
do
not
edit
by
hand
%
Please
edit
documentation
in
R
/
lgb
.
Booster
.
R
\
name
{
predict
.
lgb
.
Booster
}
\
alias
{
predict
.
lgb
.
Booster
}
\
title
{
Predict
method
for
LightGBM
model
}
\
usage
{
\
method
{
predict
}{
lgb
.
Booster
}(
object
,
data
,
num_iteration
=
NULL
,
rawscore
=
FALSE
,
predleaf
=
FALSE
,
header
=
FALSE
,
reshape
=
FALSE
)
}
\
arguments
{
\
item
{
object
}{
Object
of
class
\
code
{
lgb
.
Booster
}}
\
item
{
data
}{
a
\
code
{
matrix
}
object
,
a
\
code
{
dgCMatrix
}
object
or
a
character
representing
a
filename
}
\
item
{
num_iteration
}{
number
of
iteration
want
to
predict
with
,
NULL
or
<=
0
means
use
best
iteration
}
\
item
{
rawscore
}{
whether
the
prediction
should
be
returned
in
the
for
of
original
untransformed
sum
of
predictions
from
boosting
iterations
' results. E.g., setting \code{rawscore=TRUE} for
logistic regression would result in predictions for log-odds instead of probabilities.}
\item{predleaf}{whether predict leaf index instead.}
\item{header}{only used for prediction for text file. True if text file has header}
\item{reshape}{whether to reshape the vector of predictions to a matrix form when there are several
prediction outputs per case.}
}
\value{
For regression or binary classification, it returns a vector of length \code{nrows(data)}.
For multiclass classification, either a \code{num_class * nrows(data)} vector or
a \code{(nrows(data), num_class)} dimension matrix is returned, depending on
the \code{reshape} value.
When \code{predleaf = TRUE}, the output is a matrix object with the
number of columns corresponding to the number of trees.
}
\description{
Predicted values based on class \code{lgb.Booster}
}
\examples{
\dontrun{
library(lightgbm)
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
data(agaricus.test, package = "lightgbm")
test <- agaricus.test
dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label)
params <- list(objective = "regression", metric = "l2")
valids <- list(test = dtest)
model <- lgb.train(params,
dtrain,
100,
valids,
min_data = 1,
learning_rate = 1,
early_stopping_rounds = 10)
preds <- predict(model, test$data)
}
}
R-package/man/readRDS.lgb.Booster.Rd
deleted
100644 → 0
View file @
dbfa16c3
%
Generated
by
roxygen2
:
do
not
edit
by
hand
%
Please
edit
documentation
in
R
/
readRDS
.
lgb
.
Booster
.
R
\
name
{
readRDS
.
lgb
.
Booster
}
\
alias
{
readRDS
.
lgb
.
Booster
}
\
title
{
readRDS
for
lgb
.
Booster
models
}
\
usage
{
readRDS
.
lgb
.
Booster
(
file
=
""
,
refhook
=
NULL
)
}
\
arguments
{
\
item
{
file
}{
a
connection
or
the
name
of
the
file
where
the
R
object
is
saved
to
or
read
from
.}
\
item
{
refhook
}{
a
hook
function
for
handling
reference
objects
.}
}
\
value
{
an
R
object
.
}
\
description
{
Attemps
to
load
a
model
using
RDS
.
}
\
examples
{
\
dontrun
{
library
(
lightgbm
)
data
(
agaricus
.
train
,
package
=
"lightgbm"
)
train
<-
agaricus
.
train
dtrain
<-
lgb
.
Dataset
(
train
$
data
,
label
=
train
$
label
)
data
(
agaricus
.
test
,
package
=
"lightgbm"
)
test
<-
agaricus
.
test
dtest
<-
lgb
.
Dataset
.
create
.
valid
(
dtrain
,
test
$
data
,
label
=
test
$
label
)
params
<-
list
(
objective
=
"regression"
,
metric
=
"l2"
)
valids
<-
list
(
test
=
dtest
)
model
<-
lgb
.
train
(
params
,
dtrain
,
100
,
valids
,
min_data
=
1
,
learning_rate
=
1
,
early_stopping_rounds
=
10
)
saveRDS
.
lgb
.
Booster
(
model
,
"model.rds"
)
new_model
<-
readRDS
.
lgb
.
Booster
(
"model.rds"
)
}
}
R-package/man/saveRDS.lgb.Booster.Rd
deleted
100644 → 0
View file @
dbfa16c3
%
Generated
by
roxygen2
:
do
not
edit
by
hand
%
Please
edit
documentation
in
R
/
saveRDS
.
lgb
.
Booster
.
R
\
name
{
saveRDS
.
lgb
.
Booster
}
\
alias
{
saveRDS
.
lgb
.
Booster
}
\
title
{
saveRDS
for
lgb
.
Booster
models
}
\
usage
{
saveRDS
.
lgb
.
Booster
(
object
,
file
=
""
,
ascii
=
FALSE
,
version
=
NULL
,
compress
=
TRUE
,
refhook
=
NULL
,
raw
=
TRUE
)
}
\
arguments
{
\
item
{
object
}{
R
object
to
serialize
.}
\
item
{
file
}{
a
connection
or
the
name
of
the
file
where
the
R
object
is
saved
to
or
read
from
.}
\
item
{
ascii
}{
a
logical
.
If
TRUE
or
NA
,
an
ASCII
representation
is
written
;
otherwise
(
default
),
a
binary
one
is
used
.
See
the
comments
in
the
help
for
save
.}
\
item
{
version
}{
the
workspace
format
version
to
use
.
\
code
{
NULL
}
specifies
the
current
default
version
(
2
).
Versions
prior
to
2
are
not
supported
,
so
this
will
only
be
relevant
when
there
are
later
versions
.}
\
item
{
compress
}{
a
logical
specifying
whether
saving
to
a
named
file
is
to
use
"gzip"
compression
,
or
one
of
\
code
{
"gzip"
},
\
code
{
"bzip2"
}
or
\
code
{
"xz"
}
to
indicate
the
type
of
compression
to
be
used
.
Ignored
if
file
is
a
connection
.}
\
item
{
refhook
}{
a
hook
function
for
handling
reference
objects
.}
\
item
{
raw
}{
whether
to
save
the
model
in
a
raw
variable
or
not
,
recommended
to
leave
it
to
\
code
{
TRUE
}.}
}
\
value
{
NULL
invisibly
.
}
\
description
{
Attemps
to
save
a
model
using
RDS
.
Has
an
additional
parameter
(\
code
{
raw
})
which
decides
whether
to
save
the
raw
model
or
not
.
}
\
examples
{
\
dontrun
{
library
(
lightgbm
)
data
(
agaricus
.
train
,
package
=
"lightgbm"
)
train
<-
agaricus
.
train
dtrain
<-
lgb
.
Dataset
(
train
$
data
,
label
=
train
$
label
)
data
(
agaricus
.
test
,
package
=
"lightgbm"
)
test
<-
agaricus
.
test
dtest
<-
lgb
.
Dataset
.
create
.
valid
(
dtrain
,
test
$
data
,
label
=
test
$
label
)
params
<-
list
(
objective
=
"regression"
,
metric
=
"l2"
)
valids
<-
list
(
test
=
dtest
)
model
<-
lgb
.
train
(
params
,
dtrain
,
100
,
valids
,
min_data
=
1
,
learning_rate
=
1
,
early_stopping_rounds
=
10
)
saveRDS
.
lgb
.
Booster
(
model
,
"model.rds"
)
}
}
R-package/man/setinfo.Rd
deleted
100644 → 0
View file @
dbfa16c3
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lgb.Dataset.R
\name{setinfo}
\alias{setinfo}
\alias{setinfo.lgb.Dataset}
\title{Set information of an lgb.Dataset object}
\usage{
setinfo(dataset, ...)
\method{setinfo}{lgb.Dataset}(dataset, name, info, ...)
}
\arguments{
\item{dataset}{Object of class "lgb.Dataset"}
\item{...}{other parameters}
\item{name}{the name of the field to get}
\item{info}{the specific field of information to set}
}
\value{
passed object
}
\description{
Set information of an lgb.Dataset object
}
\details{
The \code{name} field can be one of the following:
\itemize{
\item \code{label}: label lightgbm learn from ;
\item \code{weight}: to do a weight rescale ;
\item \code{init_score}: initial score is the base prediction lightgbm will boost from ;
\item \code{group}.
}
}
\examples{
\dontrun{
library(lightgbm)
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
lgb.Dataset.construct(dtrain)
labels <- lightgbm::getinfo(dtrain, "label")
lightgbm::setinfo(dtrain, "label", 1 - labels)
labels2 <- lightgbm::getinfo(dtrain, "label")
stopifnot(all.equal(labels2, 1 - labels))
}
}
R-package/man/slice.Rd
deleted
100644 → 0
View file @
dbfa16c3
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lgb.Dataset.R
\name{slice}
\alias{slice}
\alias{slice.lgb.Dataset}
\title{Slice a dataset}
\usage{
slice(dataset, ...)
\method{slice}{lgb.Dataset}(dataset, idxset, ...)
}
\arguments{
\item{dataset}{Object of class "lgb.Dataset"}
\item{...}{other parameters (currently not used)}
\item{idxset}{a integer vector of indices of rows needed}
}
\value{
constructed sub dataset
}
\description{
Get a new \code{lgb.Dataset} containing the specified rows of
orginal lgb.Dataset object
}
\examples{
\dontrun{
library(lightgbm)
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
dsub <- lightgbm::slice(dtrain, 1:42)
labels <- lightgbm::getinfo(dsub, "label")
}
}
R-package/src/R_object_helper.h
View file @
0eb99219
/*
/*
* A simple wrapper for accessing data in R object.
* A simple wrapper for accessing data in R object.
* Due to license issue
(GPLv2)
, we cannot include R's header file, so use this simple wrapper instead.
* Due to license issue, we cannot include R's header file, so use this simple wrapper instead.
* However, if R changes the way it defines objects, this file will need to be updated as well.
* However, if R changes the way it defines objects, this file will need to be updated as well.
*/
*/
#ifndef R_OBJECT_HELPER_H_
#ifndef R_OBJECT_HELPER_H_
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
#include <cstdint>
#include <cstdint>
#define TYPE_BITS 5
#define TYPE_BITS 5
struct
sxpinfo
_struct
{
struct
lgbm_
sxpinfo
{
unsigned
int
type
:
5
;
unsigned
int
type
:
5
;
unsigned
int
obj
:
1
;
unsigned
int
obj
:
1
;
unsigned
int
named
:
2
;
unsigned
int
named
:
2
;
...
@@ -22,67 +22,67 @@ struct sxpinfo_struct {
...
@@ -22,67 +22,67 @@ struct sxpinfo_struct {
unsigned
int
gccls
:
3
;
unsigned
int
gccls
:
3
;
};
};
struct
primsxp
_struct
{
struct
lgbm_
primsxp
{
int
offset
;
int
offset
;
};
};
struct
symsxp
_struct
{
struct
lgbm_
symsxp
{
struct
SEXPREC
*
pname
;
struct
LGBM_SER
*
pname
;
struct
SEXPREC
*
value
;
struct
LGBM_SER
*
value
;
struct
SEXPREC
*
internal
;
struct
LGBM_SER
*
internal
;
};
};
struct
listsxp
_struct
{
struct
lgbm_
listsxp
{
struct
SEXPREC
*
carval
;
struct
LGBM_SER
*
carval
;
struct
SEXPREC
*
cdrval
;
struct
LGBM_SER
*
cdrval
;
struct
SEXPREC
*
tagval
;
struct
LGBM_SER
*
tagval
;
};
};
struct
envsxp
_struct
{
struct
lgbm_
envsxp
{
struct
SEXPREC
*
frame
;
struct
LGBM_SER
*
frame
;
struct
SEXPREC
*
enclos
;
struct
LGBM_SER
*
enclos
;
struct
SEXPREC
*
hashtab
;
struct
LGBM_SER
*
hashtab
;
};
};
struct
closxp
_struct
{
struct
lgbm_
closxp
{
struct
SEXPREC
*
formals
;
struct
LGBM_SER
*
formals
;
struct
SEXPREC
*
body
;
struct
LGBM_SER
*
body
;
struct
SEXPREC
*
env
;
struct
LGBM_SER
*
env
;
};
};
struct
promsxp
_struct
{
struct
lgbm_
promsxp
{
struct
SEXPREC
*
value
;
struct
LGBM_SER
*
value
;
struct
SEXPREC
*
expr
;
struct
LGBM_SER
*
expr
;
struct
SEXPREC
*
env
;
struct
LGBM_SER
*
env
;
};
};
typedef
struct
SEXPREC
{
typedef
struct
LGBM_SER
{
struct
sxpinfo
_struct
sxpinfo
;
struct
lgbm_
sxpinfo
sxpinfo
;
struct
SEXPREC
*
attrib
;
struct
LGBM_SER
*
attrib
;
struct
SEXPREC
*
gengc_next_node
,
*
gengc_prev_node
;
struct
LGBM_SER
*
gengc_next_node
,
*
gengc_prev_node
;
union
{
union
{
struct
primsxp
_struct
primsxp
;
struct
lgbm_
primsxp
primsxp
;
struct
symsxp
_struct
symsxp
;
struct
lgbm_
symsxp
symsxp
;
struct
listsxp
_struct
listsxp
;
struct
lgbm_
listsxp
listsxp
;
struct
envsxp
_struct
envsxp
;
struct
lgbm_
envsxp
envsxp
;
struct
closxp
_struct
closxp
;
struct
lgbm_
closxp
closxp
;
struct
promsxp
_struct
promsxp
;
struct
lgbm_
promsxp
promsxp
;
}
u
;
}
u
;
}
SEXPREC
,
*
SEXP
;
}
LGBM_SER
,
*
LGBM_SE
;
struct
vecsxp
_struct
{
struct
lgbm_
vecsxp
{
int
length
;
int
length
;
int
truelength
;
int
truelength
;
};
};
typedef
struct
VECTOR_SE
XPREC
{
typedef
struct
VECTOR_SE
R
{
struct
sxpinfo
_struct
sxpinfo
;
struct
lgbm_
sxpinfo
sxpinfo
;
struct
SEXPREC
*
attrib
;
struct
LGBM_SER
*
attrib
;
struct
SEXPREC
*
gengc_next_node
,
*
gengc_prev_node
;
struct
LGBM_SER
*
gengc_next_node
,
*
gengc_prev_node
;
struct
vecsxp
_struct
vecsxp
;
struct
lgbm_
vecsxp
vecsxp
;
}
VECTOR_SE
XPREC
,
*
VECSE
XP
;
}
VECTOR_SE
R
,
*
VECSE
;
typedef
union
{
VECTOR_SE
XPREC
s
;
double
align
;
}
SEXPREC_ALIGN
;
typedef
union
{
VECTOR_SE
R
s
;
double
align
;
}
SEXPREC_ALIGN
;
#define DATAPTR(x) (((SEXPREC_ALIGN *) (x)) + 1)
#define DATAPTR(x) (((SEXPREC_ALIGN *) (x)) + 1)
...
@@ -94,7 +94,7 @@ typedef union { VECTOR_SEXPREC s; double align; } SEXPREC_ALIGN;
...
@@ -94,7 +94,7 @@ typedef union { VECTOR_SEXPREC s; double align; } SEXPREC_ALIGN;
#define R_AS_INT(x) (*((int *) DATAPTR(x)))
#define R_AS_INT(x) (*((int *) DATAPTR(x)))
#define R_IS_NULL(x) ((*(SE
XP
)(x)).sxpinfo.type == 0)
#define R_IS_NULL(x) ((*(
LGBM_
SE)(x)).sxpinfo.type == 0)
// 64bit pointer
// 64bit pointer
...
@@ -102,7 +102,7 @@ typedef union { VECTOR_SEXPREC s; double align; } SEXPREC_ALIGN;
...
@@ -102,7 +102,7 @@ typedef union { VECTOR_SEXPREC s; double align; } SEXPREC_ALIGN;
#define R_ADDR(x) ((int64_t *) DATAPTR(x))
#define R_ADDR(x) ((int64_t *) DATAPTR(x))
inline
void
R_SET_PTR
(
SE
XP
x
,
void
*
ptr
)
{
inline
void
R_SET_PTR
(
LGBM_
SE
x
,
void
*
ptr
)
{
if
(
ptr
==
nullptr
)
{
if
(
ptr
==
nullptr
)
{
R_ADDR
(
x
)[
0
]
=
(
int64_t
)(
NULL
);
R_ADDR
(
x
)[
0
]
=
(
int64_t
)(
NULL
);
}
else
{
}
else
{
...
@@ -110,7 +110,7 @@ inline void R_SET_PTR(SEXP x, void* ptr) {
...
@@ -110,7 +110,7 @@ inline void R_SET_PTR(SEXP x, void* ptr) {
}
}
}
}
inline
void
*
R_GET_PTR
(
SE
XP
x
)
{
inline
void
*
R_GET_PTR
(
LGBM_
SE
x
)
{
if
(
R_IS_NULL
(
x
))
{
if
(
R_IS_NULL
(
x
))
{
return
nullptr
;
return
nullptr
;
}
else
{
}
else
{
...
@@ -126,7 +126,7 @@ inline void* R_GET_PTR(SEXP x) {
...
@@ -126,7 +126,7 @@ inline void* R_GET_PTR(SEXP x) {
#define R_ADDR(x) ((int32_t *) DATAPTR(x))
#define R_ADDR(x) ((int32_t *) DATAPTR(x))
inline
void
R_SET_PTR
(
SE
XP
x
,
void
*
ptr
)
{
inline
void
R_SET_PTR
(
LGBM_
SE
x
,
void
*
ptr
)
{
if
(
ptr
==
nullptr
)
{
if
(
ptr
==
nullptr
)
{
R_ADDR
(
x
)[
0
]
=
(
int32_t
)(
NULL
);
R_ADDR
(
x
)[
0
]
=
(
int32_t
)(
NULL
);
}
else
{
}
else
{
...
@@ -134,7 +134,7 @@ inline void R_SET_PTR(SEXP x, void* ptr) {
...
@@ -134,7 +134,7 @@ inline void R_SET_PTR(SEXP x, void* ptr) {
}
}
}
}
inline
void
*
R_GET_PTR
(
SE
XP
x
)
{
inline
void
*
R_GET_PTR
(
LGBM_
SE
x
)
{
if
(
R_IS_NULL
(
x
))
{
if
(
R_IS_NULL
(
x
))
{
return
nullptr
;
return
nullptr
;
}
else
{
}
else
{
...
...
R-package/src/lightgbm_R.cpp
View file @
0eb99219
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
using
namespace
LightGBM
;
using
namespace
LightGBM
;
SE
XP
EncodeChar
(
SE
XP
dest
,
const
char
*
src
,
SE
XP
buf_len
,
SE
XP
actual_len
)
{
LGBM_
SE
EncodeChar
(
LGBM_
SE
dest
,
const
char
*
src
,
LGBM_
SE
buf_len
,
LGBM_
SE
actual_len
)
{
int
str_len
=
static_cast
<
int
>
(
std
::
strlen
(
src
));
int
str_len
=
static_cast
<
int
>
(
std
::
strlen
(
src
));
R_INT_PTR
(
actual_len
)[
0
]
=
str_len
;
R_INT_PTR
(
actual_len
)[
0
]
=
str_len
;
if
(
R_AS_INT
(
buf_len
)
<
str_len
)
{
return
dest
;
}
if
(
R_AS_INT
(
buf_len
)
<
str_len
)
{
return
dest
;
}
...
@@ -45,15 +45,15 @@ SEXP EncodeChar(SEXP dest, const char* src, SEXP buf_len, SEXP actual_len) {
...
@@ -45,15 +45,15 @@ SEXP EncodeChar(SEXP dest, const char* src, SEXP buf_len, SEXP actual_len) {
return
dest
;
return
dest
;
}
}
SE
XP
LGBM_GetLastError_R
(
SE
XP
buf_len
,
SE
XP
actual_len
,
SE
XP
err_msg
)
{
LGBM_
SE
LGBM_GetLastError_R
(
LGBM_
SE
buf_len
,
LGBM_
SE
actual_len
,
LGBM_
SE
err_msg
)
{
return
EncodeChar
(
err_msg
,
LGBM_GetLastError
(),
buf_len
,
actual_len
);
return
EncodeChar
(
err_msg
,
LGBM_GetLastError
(),
buf_len
,
actual_len
);
}
}
SE
XP
LGBM_DatasetCreateFromFile_R
(
SE
XP
filename
,
LGBM_
SE
LGBM_DatasetCreateFromFile_R
(
LGBM_
SE
filename
,
SE
XP
parameters
,
LGBM_
SE
parameters
,
SE
XP
reference
,
LGBM_
SE
reference
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
DatasetHandle
handle
;
DatasetHandle
handle
;
...
@@ -63,16 +63,16 @@ SEXP LGBM_DatasetCreateFromFile_R(SEXP filename,
...
@@ -63,16 +63,16 @@ SEXP LGBM_DatasetCreateFromFile_R(SEXP filename,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_DatasetCreateFromCSC_R
(
SE
XP
indptr
,
LGBM_
SE
LGBM_DatasetCreateFromCSC_R
(
LGBM_
SE
indptr
,
SE
XP
indices
,
LGBM_
SE
indices
,
SE
XP
data
,
LGBM_
SE
data
,
SE
XP
num_indptr
,
LGBM_
SE
num_indptr
,
SE
XP
nelem
,
LGBM_
SE
nelem
,
SE
XP
num_row
,
LGBM_
SE
num_row
,
SE
XP
parameters
,
LGBM_
SE
parameters
,
SE
XP
reference
,
LGBM_
SE
reference
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
const
int
*
p_indptr
=
R_INT_PTR
(
indptr
);
const
int
*
p_indptr
=
R_INT_PTR
(
indptr
);
const
int
*
p_indices
=
R_INT_PTR
(
indices
);
const
int
*
p_indices
=
R_INT_PTR
(
indices
);
...
@@ -89,13 +89,13 @@ SEXP LGBM_DatasetCreateFromCSC_R(SEXP indptr,
...
@@ -89,13 +89,13 @@ SEXP LGBM_DatasetCreateFromCSC_R(SEXP indptr,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_DatasetCreateFromMat_R
(
SE
XP
data
,
LGBM_
SE
LGBM_DatasetCreateFromMat_R
(
LGBM_
SE
data
,
SE
XP
num_row
,
LGBM_
SE
num_row
,
SE
XP
num_col
,
LGBM_
SE
num_col
,
SE
XP
parameters
,
LGBM_
SE
parameters
,
SE
XP
reference
,
LGBM_
SE
reference
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
int32_t
nrow
=
static_cast
<
int32_t
>
(
R_AS_INT
(
num_row
));
int32_t
nrow
=
static_cast
<
int32_t
>
(
R_AS_INT
(
num_row
));
...
@@ -108,12 +108,12 @@ SEXP LGBM_DatasetCreateFromMat_R(SEXP data,
...
@@ -108,12 +108,12 @@ SEXP LGBM_DatasetCreateFromMat_R(SEXP data,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_DatasetGetSubset_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_DatasetGetSubset_R
(
LGBM_
SE
handle
,
SE
XP
used_row_indices
,
LGBM_
SE
used_row_indices
,
SE
XP
len_used_row_indices
,
LGBM_
SE
len_used_row_indices
,
SE
XP
parameters
,
LGBM_
SE
parameters
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
int
len
=
R_AS_INT
(
len_used_row_indices
);
int
len
=
R_AS_INT
(
len_used_row_indices
);
...
@@ -131,9 +131,9 @@ SEXP LGBM_DatasetGetSubset_R(SEXP handle,
...
@@ -131,9 +131,9 @@ SEXP LGBM_DatasetGetSubset_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_DatasetSetFeatureNames_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_DatasetSetFeatureNames_R
(
LGBM_
SE
handle
,
SE
XP
feature_names
,
LGBM_
SE
feature_names
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
auto
vec_names
=
Common
::
Split
(
R_CHAR_PTR
(
feature_names
),
"
\t
"
);
auto
vec_names
=
Common
::
Split
(
R_CHAR_PTR
(
feature_names
),
"
\t
"
);
std
::
vector
<
const
char
*>
vec_sptr
;
std
::
vector
<
const
char
*>
vec_sptr
;
...
@@ -146,11 +146,11 @@ SEXP LGBM_DatasetSetFeatureNames_R(SEXP handle,
...
@@ -146,11 +146,11 @@ SEXP LGBM_DatasetSetFeatureNames_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_DatasetGetFeatureNames_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_DatasetGetFeatureNames_R
(
LGBM_
SE
handle
,
SE
XP
buf_len
,
LGBM_
SE
buf_len
,
SE
XP
actual_len
,
LGBM_
SE
actual_len
,
SE
XP
feature_names
,
LGBM_
SE
feature_names
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
int
len
=
0
;
int
len
=
0
;
...
@@ -170,17 +170,17 @@ SEXP LGBM_DatasetGetFeatureNames_R(SEXP handle,
...
@@ -170,17 +170,17 @@ SEXP LGBM_DatasetGetFeatureNames_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_DatasetSaveBinary_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_DatasetSaveBinary_R
(
LGBM_
SE
handle
,
SE
XP
filename
,
LGBM_
SE
filename
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
CHECK_CALL
(
LGBM_DatasetSaveBinary
(
R_GET_PTR
(
handle
),
CHECK_CALL
(
LGBM_DatasetSaveBinary
(
R_GET_PTR
(
handle
),
R_CHAR_PTR
(
filename
)));
R_CHAR_PTR
(
filename
)));
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_DatasetFree_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_DatasetFree_R
(
LGBM_
SE
handle
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
if
(
R_GET_PTR
(
handle
)
!=
nullptr
)
{
if
(
R_GET_PTR
(
handle
)
!=
nullptr
)
{
CHECK_CALL
(
LGBM_DatasetFree
(
R_GET_PTR
(
handle
)));
CHECK_CALL
(
LGBM_DatasetFree
(
R_GET_PTR
(
handle
)));
...
@@ -189,11 +189,11 @@ SEXP LGBM_DatasetFree_R(SEXP handle,
...
@@ -189,11 +189,11 @@ SEXP LGBM_DatasetFree_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_DatasetSetField_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_DatasetSetField_R
(
LGBM_
SE
handle
,
SE
XP
field_name
,
LGBM_
SE
field_name
,
SE
XP
field_data
,
LGBM_
SE
field_data
,
SE
XP
num_element
,
LGBM_
SE
num_element
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
int
len
=
static_cast
<
int
>
(
R_AS_INT
(
num_element
));
int
len
=
static_cast
<
int
>
(
R_AS_INT
(
num_element
));
const
char
*
name
=
R_CHAR_PTR
(
field_name
);
const
char
*
name
=
R_CHAR_PTR
(
field_name
);
...
@@ -217,10 +217,10 @@ SEXP LGBM_DatasetSetField_R(SEXP handle,
...
@@ -217,10 +217,10 @@ SEXP LGBM_DatasetSetField_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_DatasetGetField_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_DatasetGetField_R
(
LGBM_
SE
handle
,
SE
XP
field_name
,
LGBM_
SE
field_name
,
SE
XP
field_data
,
LGBM_
SE
field_data
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
const
char
*
name
=
R_CHAR_PTR
(
field_name
);
const
char
*
name
=
R_CHAR_PTR
(
field_name
);
...
@@ -252,10 +252,10 @@ SEXP LGBM_DatasetGetField_R(SEXP handle,
...
@@ -252,10 +252,10 @@ SEXP LGBM_DatasetGetField_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_DatasetGetFieldSize_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_DatasetGetFieldSize_R
(
LGBM_
SE
handle
,
SE
XP
field_name
,
LGBM_
SE
field_name
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
const
char
*
name
=
R_CHAR_PTR
(
field_name
);
const
char
*
name
=
R_CHAR_PTR
(
field_name
);
...
@@ -270,8 +270,8 @@ SEXP LGBM_DatasetGetFieldSize_R(SEXP handle,
...
@@ -270,8 +270,8 @@ SEXP LGBM_DatasetGetFieldSize_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_DatasetGetNumData_R
(
SE
XP
handle
,
SE
XP
out
,
LGBM_
SE
LGBM_DatasetGetNumData_R
(
LGBM_
SE
handle
,
LGBM_
SE
out
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
int
nrow
;
int
nrow
;
R_API_BEGIN
();
R_API_BEGIN
();
CHECK_CALL
(
LGBM_DatasetGetNumData
(
R_GET_PTR
(
handle
),
&
nrow
));
CHECK_CALL
(
LGBM_DatasetGetNumData
(
R_GET_PTR
(
handle
),
&
nrow
));
...
@@ -279,9 +279,9 @@ SEXP LGBM_DatasetGetNumData_R(SEXP handle, SEXP out,
...
@@ -279,9 +279,9 @@ SEXP LGBM_DatasetGetNumData_R(SEXP handle, SEXP out,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_DatasetGetNumFeature_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_DatasetGetNumFeature_R
(
LGBM_
SE
handle
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
int
nfeature
;
int
nfeature
;
R_API_BEGIN
();
R_API_BEGIN
();
CHECK_CALL
(
LGBM_DatasetGetNumFeature
(
R_GET_PTR
(
handle
),
&
nfeature
));
CHECK_CALL
(
LGBM_DatasetGetNumFeature
(
R_GET_PTR
(
handle
),
&
nfeature
));
...
@@ -291,8 +291,8 @@ SEXP LGBM_DatasetGetNumFeature_R(SEXP handle,
...
@@ -291,8 +291,8 @@ SEXP LGBM_DatasetGetNumFeature_R(SEXP handle,
// --- start Booster interfaces
// --- start Booster interfaces
SE
XP
LGBM_BoosterFree_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterFree_R
(
LGBM_
SE
handle
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
if
(
R_GET_PTR
(
handle
)
!=
nullptr
)
{
if
(
R_GET_PTR
(
handle
)
!=
nullptr
)
{
CHECK_CALL
(
LGBM_BoosterFree
(
R_GET_PTR
(
handle
)));
CHECK_CALL
(
LGBM_BoosterFree
(
R_GET_PTR
(
handle
)));
...
@@ -301,10 +301,10 @@ SEXP LGBM_BoosterFree_R(SEXP handle,
...
@@ -301,10 +301,10 @@ SEXP LGBM_BoosterFree_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterCreate_R
(
SE
XP
train_data
,
LGBM_
SE
LGBM_BoosterCreate_R
(
LGBM_
SE
train_data
,
SE
XP
parameters
,
LGBM_
SE
parameters
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
BoosterHandle
handle
;
BoosterHandle
handle
;
CHECK_CALL
(
LGBM_BoosterCreate
(
R_GET_PTR
(
train_data
),
R_CHAR_PTR
(
parameters
),
&
handle
));
CHECK_CALL
(
LGBM_BoosterCreate
(
R_GET_PTR
(
train_data
),
R_CHAR_PTR
(
parameters
),
&
handle
));
...
@@ -312,9 +312,9 @@ SEXP LGBM_BoosterCreate_R(SEXP train_data,
...
@@ -312,9 +312,9 @@ SEXP LGBM_BoosterCreate_R(SEXP train_data,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterCreateFromModelfile_R
(
SE
XP
filename
,
LGBM_
SE
LGBM_BoosterCreateFromModelfile_R
(
LGBM_
SE
filename
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
int
out_num_iterations
=
0
;
int
out_num_iterations
=
0
;
...
@@ -324,41 +324,41 @@ SEXP LGBM_BoosterCreateFromModelfile_R(SEXP filename,
...
@@ -324,41 +324,41 @@ SEXP LGBM_BoosterCreateFromModelfile_R(SEXP filename,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterMerge_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterMerge_R
(
LGBM_
SE
handle
,
SE
XP
other_handle
,
LGBM_
SE
other_handle
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
CHECK_CALL
(
LGBM_BoosterMerge
(
R_GET_PTR
(
handle
),
R_GET_PTR
(
other_handle
)));
CHECK_CALL
(
LGBM_BoosterMerge
(
R_GET_PTR
(
handle
),
R_GET_PTR
(
other_handle
)));
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterAddValidData_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterAddValidData_R
(
LGBM_
SE
handle
,
SE
XP
valid_data
,
LGBM_
SE
valid_data
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
CHECK_CALL
(
LGBM_BoosterAddValidData
(
R_GET_PTR
(
handle
),
R_GET_PTR
(
valid_data
)));
CHECK_CALL
(
LGBM_BoosterAddValidData
(
R_GET_PTR
(
handle
),
R_GET_PTR
(
valid_data
)));
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterResetTrainingData_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterResetTrainingData_R
(
LGBM_
SE
handle
,
SE
XP
train_data
,
LGBM_
SE
train_data
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
CHECK_CALL
(
LGBM_BoosterResetTrainingData
(
R_GET_PTR
(
handle
),
R_GET_PTR
(
train_data
)));
CHECK_CALL
(
LGBM_BoosterResetTrainingData
(
R_GET_PTR
(
handle
),
R_GET_PTR
(
train_data
)));
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterResetParameter_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterResetParameter_R
(
LGBM_
SE
handle
,
SE
XP
parameters
,
LGBM_
SE
parameters
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
CHECK_CALL
(
LGBM_BoosterResetParameter
(
R_GET_PTR
(
handle
),
R_CHAR_PTR
(
parameters
)));
CHECK_CALL
(
LGBM_BoosterResetParameter
(
R_GET_PTR
(
handle
),
R_CHAR_PTR
(
parameters
)));
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterGetNumClasses_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterGetNumClasses_R
(
LGBM_
SE
handle
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
int
num_class
;
int
num_class
;
R_API_BEGIN
();
R_API_BEGIN
();
CHECK_CALL
(
LGBM_BoosterGetNumClasses
(
R_GET_PTR
(
handle
),
&
num_class
));
CHECK_CALL
(
LGBM_BoosterGetNumClasses
(
R_GET_PTR
(
handle
),
&
num_class
));
...
@@ -366,19 +366,19 @@ SEXP LGBM_BoosterGetNumClasses_R(SEXP handle,
...
@@ -366,19 +366,19 @@ SEXP LGBM_BoosterGetNumClasses_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterUpdateOneIter_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterUpdateOneIter_R
(
LGBM_
SE
handle
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
int
is_finished
=
0
;
int
is_finished
=
0
;
R_API_BEGIN
();
R_API_BEGIN
();
CHECK_CALL
(
LGBM_BoosterUpdateOneIter
(
R_GET_PTR
(
handle
),
&
is_finished
));
CHECK_CALL
(
LGBM_BoosterUpdateOneIter
(
R_GET_PTR
(
handle
),
&
is_finished
));
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterUpdateOneIterCustom_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterUpdateOneIterCustom_R
(
LGBM_
SE
handle
,
SE
XP
grad
,
LGBM_
SE
grad
,
SE
XP
hess
,
LGBM_
SE
hess
,
SE
XP
len
,
LGBM_
SE
len
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
int
is_finished
=
0
;
int
is_finished
=
0
;
R_API_BEGIN
();
R_API_BEGIN
();
int
int_len
=
R_AS_INT
(
len
);
int
int_len
=
R_AS_INT
(
len
);
...
@@ -392,16 +392,16 @@ SEXP LGBM_BoosterUpdateOneIterCustom_R(SEXP handle,
...
@@ -392,16 +392,16 @@ SEXP LGBM_BoosterUpdateOneIterCustom_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterRollbackOneIter_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterRollbackOneIter_R
(
LGBM_
SE
handle
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
CHECK_CALL
(
LGBM_BoosterRollbackOneIter
(
R_GET_PTR
(
handle
)));
CHECK_CALL
(
LGBM_BoosterRollbackOneIter
(
R_GET_PTR
(
handle
)));
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterGetCurrentIteration_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterGetCurrentIteration_R
(
LGBM_
SE
handle
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
int
out_iteration
;
int
out_iteration
;
R_API_BEGIN
();
R_API_BEGIN
();
...
@@ -410,11 +410,11 @@ SEXP LGBM_BoosterGetCurrentIteration_R(SEXP handle,
...
@@ -410,11 +410,11 @@ SEXP LGBM_BoosterGetCurrentIteration_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterGetEvalNames_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterGetEvalNames_R
(
LGBM_
SE
handle
,
SE
XP
buf_len
,
LGBM_
SE
buf_len
,
SE
XP
actual_len
,
LGBM_
SE
actual_len
,
SE
XP
eval_names
,
LGBM_
SE
eval_names
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
int
len
;
int
len
;
...
@@ -433,10 +433,10 @@ SEXP LGBM_BoosterGetEvalNames_R(SEXP handle,
...
@@ -433,10 +433,10 @@ SEXP LGBM_BoosterGetEvalNames_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterGetEval_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterGetEval_R
(
LGBM_
SE
handle
,
SE
XP
data_idx
,
LGBM_
SE
data_idx
,
SE
XP
out_result
,
LGBM_
SE
out_result
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
int
len
;
int
len
;
CHECK_CALL
(
LGBM_BoosterGetEvalCounts
(
R_GET_PTR
(
handle
),
&
len
));
CHECK_CALL
(
LGBM_BoosterGetEvalCounts
(
R_GET_PTR
(
handle
),
&
len
));
...
@@ -447,10 +447,10 @@ SEXP LGBM_BoosterGetEval_R(SEXP handle,
...
@@ -447,10 +447,10 @@ SEXP LGBM_BoosterGetEval_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterGetNumPredict_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterGetNumPredict_R
(
LGBM_
SE
handle
,
SE
XP
data_idx
,
LGBM_
SE
data_idx
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
int64_t
len
;
int64_t
len
;
CHECK_CALL
(
LGBM_BoosterGetNumPredict
(
R_GET_PTR
(
handle
),
R_AS_INT
(
data_idx
),
&
len
));
CHECK_CALL
(
LGBM_BoosterGetNumPredict
(
R_GET_PTR
(
handle
),
R_AS_INT
(
data_idx
),
&
len
));
...
@@ -458,10 +458,10 @@ SEXP LGBM_BoosterGetNumPredict_R(SEXP handle,
...
@@ -458,10 +458,10 @@ SEXP LGBM_BoosterGetNumPredict_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterGetPredict_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterGetPredict_R
(
LGBM_
SE
handle
,
SE
XP
data_idx
,
LGBM_
SE
data_idx
,
SE
XP
out_result
,
LGBM_
SE
out_result
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
double
*
ptr_ret
=
R_REAL_PTR
(
out_result
);
double
*
ptr_ret
=
R_REAL_PTR
(
out_result
);
int64_t
out_len
;
int64_t
out_len
;
...
@@ -469,7 +469,7 @@ SEXP LGBM_BoosterGetPredict_R(SEXP handle,
...
@@ -469,7 +469,7 @@ SEXP LGBM_BoosterGetPredict_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
int
GetPredictType
(
SE
XP
is_rawscore
,
SE
XP
is_leafidx
)
{
int
GetPredictType
(
LGBM_
SE
is_rawscore
,
LGBM_
SE
is_leafidx
)
{
int
pred_type
=
C_API_PREDICT_NORMAL
;
int
pred_type
=
C_API_PREDICT_NORMAL
;
if
(
R_AS_INT
(
is_rawscore
))
{
if
(
R_AS_INT
(
is_rawscore
))
{
pred_type
=
C_API_PREDICT_RAW_SCORE
;
pred_type
=
C_API_PREDICT_RAW_SCORE
;
...
@@ -480,14 +480,14 @@ int GetPredictType(SEXP is_rawscore, SEXP is_leafidx) {
...
@@ -480,14 +480,14 @@ int GetPredictType(SEXP is_rawscore, SEXP is_leafidx) {
return
pred_type
;
return
pred_type
;
}
}
SE
XP
LGBM_BoosterPredictForFile_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterPredictForFile_R
(
LGBM_
SE
handle
,
SE
XP
data_filename
,
LGBM_
SE
data_filename
,
SE
XP
data_has_header
,
LGBM_
SE
data_has_header
,
SE
XP
is_rawscore
,
LGBM_
SE
is_rawscore
,
SE
XP
is_leafidx
,
LGBM_
SE
is_leafidx
,
SE
XP
num_iteration
,
LGBM_
SE
num_iteration
,
SE
XP
result_filename
,
LGBM_
SE
result_filename
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
int
pred_type
=
GetPredictType
(
is_rawscore
,
is_leafidx
);
int
pred_type
=
GetPredictType
(
is_rawscore
,
is_leafidx
);
CHECK_CALL
(
LGBM_BoosterPredictForFile
(
R_GET_PTR
(
handle
),
R_CHAR_PTR
(
data_filename
),
CHECK_CALL
(
LGBM_BoosterPredictForFile
(
R_GET_PTR
(
handle
),
R_CHAR_PTR
(
data_filename
),
...
@@ -496,13 +496,13 @@ SEXP LGBM_BoosterPredictForFile_R(SEXP handle,
...
@@ -496,13 +496,13 @@ SEXP LGBM_BoosterPredictForFile_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterCalcNumPredict_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterCalcNumPredict_R
(
LGBM_
SE
handle
,
SE
XP
num_row
,
LGBM_
SE
num_row
,
SE
XP
is_rawscore
,
LGBM_
SE
is_rawscore
,
SE
XP
is_leafidx
,
LGBM_
SE
is_leafidx
,
SE
XP
num_iteration
,
LGBM_
SE
num_iteration
,
SE
XP
out_len
,
LGBM_
SE
out_len
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
int
pred_type
=
GetPredictType
(
is_rawscore
,
is_leafidx
);
int
pred_type
=
GetPredictType
(
is_rawscore
,
is_leafidx
);
int64_t
len
=
0
;
int64_t
len
=
0
;
...
@@ -512,18 +512,18 @@ SEXP LGBM_BoosterCalcNumPredict_R(SEXP handle,
...
@@ -512,18 +512,18 @@ SEXP LGBM_BoosterCalcNumPredict_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterPredictForCSC_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterPredictForCSC_R
(
LGBM_
SE
handle
,
SE
XP
indptr
,
LGBM_
SE
indptr
,
SE
XP
indices
,
LGBM_
SE
indices
,
SE
XP
data
,
LGBM_
SE
data
,
SE
XP
num_indptr
,
LGBM_
SE
num_indptr
,
SE
XP
nelem
,
LGBM_
SE
nelem
,
SE
XP
num_row
,
LGBM_
SE
num_row
,
SE
XP
is_rawscore
,
LGBM_
SE
is_rawscore
,
SE
XP
is_leafidx
,
LGBM_
SE
is_leafidx
,
SE
XP
num_iteration
,
LGBM_
SE
num_iteration
,
SE
XP
out_result
,
LGBM_
SE
out_result
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
int
pred_type
=
GetPredictType
(
is_rawscore
,
is_leafidx
);
int
pred_type
=
GetPredictType
(
is_rawscore
,
is_leafidx
);
...
@@ -544,15 +544,15 @@ SEXP LGBM_BoosterPredictForCSC_R(SEXP handle,
...
@@ -544,15 +544,15 @@ SEXP LGBM_BoosterPredictForCSC_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterPredictForMat_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterPredictForMat_R
(
LGBM_
SE
handle
,
SE
XP
data
,
LGBM_
SE
data
,
SE
XP
num_row
,
LGBM_
SE
num_row
,
SE
XP
num_col
,
LGBM_
SE
num_col
,
SE
XP
is_rawscore
,
LGBM_
SE
is_rawscore
,
SE
XP
is_leafidx
,
LGBM_
SE
is_leafidx
,
SE
XP
num_iteration
,
LGBM_
SE
num_iteration
,
SE
XP
out_result
,
LGBM_
SE
out_result
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
int
pred_type
=
GetPredictType
(
is_rawscore
,
is_leafidx
);
int
pred_type
=
GetPredictType
(
is_rawscore
,
is_leafidx
);
...
@@ -570,21 +570,21 @@ SEXP LGBM_BoosterPredictForMat_R(SEXP handle,
...
@@ -570,21 +570,21 @@ SEXP LGBM_BoosterPredictForMat_R(SEXP handle,
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterSaveModel_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterSaveModel_R
(
LGBM_
SE
handle
,
SE
XP
num_iteration
,
LGBM_
SE
num_iteration
,
SE
XP
filename
,
LGBM_
SE
filename
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
CHECK_CALL
(
LGBM_BoosterSaveModel
(
R_GET_PTR
(
handle
),
R_AS_INT
(
num_iteration
),
R_CHAR_PTR
(
filename
)));
CHECK_CALL
(
LGBM_BoosterSaveModel
(
R_GET_PTR
(
handle
),
R_AS_INT
(
num_iteration
),
R_CHAR_PTR
(
filename
)));
R_API_END
();
R_API_END
();
}
}
SE
XP
LGBM_BoosterDumpModel_R
(
SE
XP
handle
,
LGBM_
SE
LGBM_BoosterDumpModel_R
(
LGBM_
SE
handle
,
SE
XP
num_iteration
,
LGBM_
SE
num_iteration
,
SE
XP
buffer_len
,
LGBM_
SE
buffer_len
,
SE
XP
actual_len
,
LGBM_
SE
actual_len
,
SE
XP
out_str
,
LGBM_
SE
out_str
,
SE
XP
call_state
)
{
LGBM_
SE
call_state
)
{
R_API_BEGIN
();
R_API_BEGIN
();
int
out_len
=
0
;
int
out_len
=
0
;
std
::
vector
<
char
>
inner_char_buf
(
R_AS_INT
(
buffer_len
));
std
::
vector
<
char
>
inner_char_buf
(
R_AS_INT
(
buffer_len
));
...
...
R-package/src/lightgbm_R.h
View file @
0eb99219
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
* \return err_msg error inforomation
* \return err_msg error inforomation
* \return error inforomation
* \return error inforomation
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_GetLastError_R
(
SE
XP
buf_len
,
SE
XP
actual_len
,
SE
XP
err_msg
);
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_GetLastError_R
(
LGBM_
SE
buf_len
,
LGBM_
SE
actual_len
,
LGBM_
SE
err_msg
);
// --- start Dataset interface
// --- start Dataset interface
...
@@ -27,11 +27,11 @@ LIGHTGBM_C_EXPORT SEXP LGBM_GetLastError_R(SEXP buf_len, SEXP actual_len, SEXP e
...
@@ -27,11 +27,11 @@ LIGHTGBM_C_EXPORT SEXP LGBM_GetLastError_R(SEXP buf_len, SEXP actual_len, SEXP e
* \param out created dataset
* \param out created dataset
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_DatasetCreateFromFile_R
(
SE
XP
filename
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_DatasetCreateFromFile_R
(
LGBM_
SE
filename
,
SE
XP
parameters
,
LGBM_
SE
parameters
,
SE
XP
reference
,
LGBM_
SE
reference
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief create a dataset from CSC format
* \brief create a dataset from CSC format
...
@@ -46,16 +46,16 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetCreateFromFile_R(SEXP filename,
...
@@ -46,16 +46,16 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetCreateFromFile_R(SEXP filename,
* \param out created dataset
* \param out created dataset
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_DatasetCreateFromCSC_R
(
SE
XP
indptr
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_DatasetCreateFromCSC_R
(
LGBM_
SE
indptr
,
SE
XP
indices
,
LGBM_
SE
indices
,
SE
XP
data
,
LGBM_
SE
data
,
SE
XP
nindptr
,
LGBM_
SE
nindptr
,
SE
XP
nelem
,
LGBM_
SE
nelem
,
SE
XP
num_row
,
LGBM_
SE
num_row
,
SE
XP
parameters
,
LGBM_
SE
parameters
,
SE
XP
reference
,
LGBM_
SE
reference
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
...
@@ -68,13 +68,13 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetCreateFromCSC_R(SEXP indptr,
...
@@ -68,13 +68,13 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetCreateFromCSC_R(SEXP indptr,
* \param out created dataset
* \param out created dataset
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_DatasetCreateFromMat_R
(
SE
XP
data
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_DatasetCreateFromMat_R
(
LGBM_
SE
data
,
SE
XP
nrow
,
LGBM_
SE
nrow
,
SE
XP
ncol
,
LGBM_
SE
ncol
,
SE
XP
parameters
,
LGBM_
SE
parameters
,
SE
XP
reference
,
LGBM_
SE
reference
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief Create subset of a data
* \brief Create subset of a data
...
@@ -85,12 +85,12 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetCreateFromMat_R(SEXP data,
...
@@ -85,12 +85,12 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetCreateFromMat_R(SEXP data,
* \param out created dataset
* \param out created dataset
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_DatasetGetSubset_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_DatasetGetSubset_R
(
LGBM_
SE
handle
,
SE
XP
used_row_indices
,
LGBM_
SE
used_row_indices
,
SE
XP
len_used_row_indices
,
LGBM_
SE
len_used_row_indices
,
SE
XP
parameters
,
LGBM_
SE
parameters
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief save feature names to Dataset
* \brief save feature names to Dataset
...
@@ -98,9 +98,9 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetSubset_R(SEXP handle,
...
@@ -98,9 +98,9 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetSubset_R(SEXP handle,
* \param feature_names feature names
* \param feature_names feature names
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_DatasetSetFeatureNames_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_DatasetSetFeatureNames_R
(
LGBM_
SE
handle
,
SE
XP
feature_names
,
LGBM_
SE
feature_names
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief save feature names to Dataset
* \brief save feature names to Dataset
...
@@ -108,11 +108,11 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetSetFeatureNames_R(SEXP handle,
...
@@ -108,11 +108,11 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetSetFeatureNames_R(SEXP handle,
* \param feature_names feature names
* \param feature_names feature names
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_DatasetGetFeatureNames_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_DatasetGetFeatureNames_R
(
LGBM_
SE
handle
,
SE
XP
buf_len
,
LGBM_
SE
buf_len
,
SE
XP
actual_len
,
LGBM_
SE
actual_len
,
SE
XP
feature_names
,
LGBM_
SE
feature_names
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief save dateset to binary file
* \brief save dateset to binary file
...
@@ -120,17 +120,17 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetFeatureNames_R(SEXP handle,
...
@@ -120,17 +120,17 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetFeatureNames_R(SEXP handle,
* \param filename file name
* \param filename file name
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_DatasetSaveBinary_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_DatasetSaveBinary_R
(
LGBM_
SE
handle
,
SE
XP
filename
,
LGBM_
SE
filename
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief free dataset
* \brief free dataset
* \param handle an instance of dataset
* \param handle an instance of dataset
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_DatasetFree_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_DatasetFree_R
(
LGBM_
SE
handle
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief set vector to a content in info
* \brief set vector to a content in info
...
@@ -142,11 +142,11 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetFree_R(SEXP handle,
...
@@ -142,11 +142,11 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetFree_R(SEXP handle,
* \param num_element number of element in field_data
* \param num_element number of element in field_data
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_DatasetSetField_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_DatasetSetField_R
(
LGBM_
SE
handle
,
SE
XP
field_name
,
LGBM_
SE
field_name
,
SE
XP
field_data
,
LGBM_
SE
field_data
,
SE
XP
num_element
,
LGBM_
SE
num_element
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief get size of info vector from dataset
* \brief get size of info vector from dataset
...
@@ -155,10 +155,10 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetSetField_R(SEXP handle,
...
@@ -155,10 +155,10 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetSetField_R(SEXP handle,
* \param out size of info vector from dataset
* \param out size of info vector from dataset
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_DatasetGetFieldSize_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_DatasetGetFieldSize_R
(
LGBM_
SE
handle
,
SE
XP
field_name
,
LGBM_
SE
field_name
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief get info vector from dataset
* \brief get info vector from dataset
...
@@ -167,10 +167,10 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetFieldSize_R(SEXP handle,
...
@@ -167,10 +167,10 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetFieldSize_R(SEXP handle,
* \param field_data pointer to vector
* \param field_data pointer to vector
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_DatasetGetField_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_DatasetGetField_R
(
LGBM_
SE
handle
,
SE
XP
field_name
,
LGBM_
SE
field_name
,
SE
XP
field_data
,
LGBM_
SE
field_data
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief get number of data.
* \brief get number of data.
...
@@ -178,9 +178,9 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetField_R(SEXP handle,
...
@@ -178,9 +178,9 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetField_R(SEXP handle,
* \param out The address to hold number of data
* \param out The address to hold number of data
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_DatasetGetNumData_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_DatasetGetNumData_R
(
LGBM_
SE
handle
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief get number of features
* \brief get number of features
...
@@ -188,9 +188,9 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetNumData_R(SEXP handle,
...
@@ -188,9 +188,9 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetNumData_R(SEXP handle,
* \param out The output of number of features
* \param out The output of number of features
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_DatasetGetNumFeature_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_DatasetGetNumFeature_R
(
LGBM_
SE
handle
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
// --- start Booster interfaces
// --- start Booster interfaces
...
@@ -201,18 +201,18 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetNumFeature_R(SEXP handle,
...
@@ -201,18 +201,18 @@ LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetNumFeature_R(SEXP handle,
* \prama out handle of created Booster
* \prama out handle of created Booster
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterCreate_R
(
SE
XP
train_data
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterCreate_R
(
LGBM_
SE
train_data
,
SE
XP
parameters
,
LGBM_
SE
parameters
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief free obj in handle
* \brief free obj in handle
* \param handle handle to be freed
* \param handle handle to be freed
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterFree_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterFree_R
(
LGBM_
SE
handle
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief load an existing boosting from model file
* \brief load an existing boosting from model file
...
@@ -220,9 +220,9 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterFree_R(SEXP handle,
...
@@ -220,9 +220,9 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterFree_R(SEXP handle,
* \prama out handle of created Booster
* \prama out handle of created Booster
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterCreateFromModelfile_R
(
SE
XP
filename
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterCreateFromModelfile_R
(
LGBM_
SE
filename
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief Merge model in two boosters to first handle
* \brief Merge model in two boosters to first handle
...
@@ -230,9 +230,9 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterCreateFromModelfile_R(SEXP filename,
...
@@ -230,9 +230,9 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterCreateFromModelfile_R(SEXP filename,
* \param other_handle
* \param other_handle
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterMerge_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterMerge_R
(
LGBM_
SE
handle
,
SE
XP
other_handle
,
LGBM_
SE
other_handle
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief Add new validation to booster
* \brief Add new validation to booster
...
@@ -240,9 +240,9 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterMerge_R(SEXP handle,
...
@@ -240,9 +240,9 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterMerge_R(SEXP handle,
* \param valid_data validation data set
* \param valid_data validation data set
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterAddValidData_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterAddValidData_R
(
LGBM_
SE
handle
,
SE
XP
valid_data
,
LGBM_
SE
valid_data
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief Reset training data for booster
* \brief Reset training data for booster
...
@@ -250,9 +250,9 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterAddValidData_R(SEXP handle,
...
@@ -250,9 +250,9 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterAddValidData_R(SEXP handle,
* \param train_data training data set
* \param train_data training data set
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterResetTrainingData_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterResetTrainingData_R
(
LGBM_
SE
handle
,
SE
XP
train_data
,
LGBM_
SE
train_data
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief Reset config for current booster
* \brief Reset config for current booster
...
@@ -260,9 +260,9 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterResetTrainingData_R(SEXP handle,
...
@@ -260,9 +260,9 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterResetTrainingData_R(SEXP handle,
* \param parameters format: 'key1=value1 key2=value2'
* \param parameters format: 'key1=value1 key2=value2'
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterResetParameter_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterResetParameter_R
(
LGBM_
SE
handle
,
SE
XP
parameters
,
LGBM_
SE
parameters
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief Get number of classes
* \brief Get number of classes
...
@@ -270,17 +270,17 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterResetParameter_R(SEXP handle,
...
@@ -270,17 +270,17 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterResetParameter_R(SEXP handle,
* \param out number of classes
* \param out number of classes
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterGetNumClasses_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterGetNumClasses_R
(
LGBM_
SE
handle
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief update the model in one round
* \brief update the model in one round
* \param handle handle
* \param handle handle
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterUpdateOneIter_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterUpdateOneIter_R
(
LGBM_
SE
handle
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief update the model, by directly specify gradient and second order gradient,
* \brief update the model, by directly specify gradient and second order gradient,
...
@@ -291,39 +291,39 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterUpdateOneIter_R(SEXP handle,
...
@@ -291,39 +291,39 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterUpdateOneIter_R(SEXP handle,
* \param len length of grad/hess
* \param len length of grad/hess
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterUpdateOneIterCustom_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterUpdateOneIterCustom_R
(
LGBM_
SE
handle
,
SE
XP
grad
,
LGBM_
SE
grad
,
SE
XP
hess
,
LGBM_
SE
hess
,
SE
XP
len
,
LGBM_
SE
len
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief Rollback one iteration
* \brief Rollback one iteration
* \param handle handle
* \param handle handle
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterRollbackOneIter_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterRollbackOneIter_R
(
LGBM_
SE
handle
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief Get iteration of current boosting rounds
* \brief Get iteration of current boosting rounds
* \param out iteration of boosting rounds
* \param out iteration of boosting rounds
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterGetCurrentIteration_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterGetCurrentIteration_R
(
LGBM_
SE
handle
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief Get Name of eval
* \brief Get Name of eval
* \param eval_names eval names
* \param eval_names eval names
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterGetEvalNames_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterGetEvalNames_R
(
LGBM_
SE
handle
,
SE
XP
buf_len
,
LGBM_
SE
buf_len
,
SE
XP
actual_len
,
LGBM_
SE
actual_len
,
SE
XP
eval_names
,
LGBM_
SE
eval_names
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief get evaluation for training data and validation data
* \brief get evaluation for training data and validation data
...
@@ -332,10 +332,10 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetEvalNames_R(SEXP handle,
...
@@ -332,10 +332,10 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetEvalNames_R(SEXP handle,
* \param out_result float arrary contains result
* \param out_result float arrary contains result
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterGetEval_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterGetEval_R
(
LGBM_
SE
handle
,
SE
XP
data_idx
,
LGBM_
SE
data_idx
,
SE
XP
out_result
,
LGBM_
SE
out_result
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief Get number of prediction for training data and validation data
* \brief Get number of prediction for training data and validation data
...
@@ -344,10 +344,10 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetEval_R(SEXP handle,
...
@@ -344,10 +344,10 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetEval_R(SEXP handle,
* \param out size of predict
* \param out size of predict
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterGetNumPredict_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterGetNumPredict_R
(
LGBM_
SE
handle
,
SE
XP
data_idx
,
LGBM_
SE
data_idx
,
SE
XP
out
,
LGBM_
SE
out
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief Get prediction for training data and validation data.
* \brief Get prediction for training data and validation data.
...
@@ -357,10 +357,10 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetNumPredict_R(SEXP handle,
...
@@ -357,10 +357,10 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetNumPredict_R(SEXP handle,
* \param out_result, used to store predict result, should pre-allocate memory
* \param out_result, used to store predict result, should pre-allocate memory
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterGetPredict_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterGetPredict_R
(
LGBM_
SE
handle
,
SE
XP
data_idx
,
LGBM_
SE
data_idx
,
SE
XP
out_result
,
LGBM_
SE
out_result
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief make prediction for file
* \brief make prediction for file
...
@@ -373,14 +373,14 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetPredict_R(SEXP handle,
...
@@ -373,14 +373,14 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetPredict_R(SEXP handle,
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterPredictForFile_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterPredictForFile_R
(
LGBM_
SE
handle
,
SE
XP
data_filename
,
LGBM_
SE
data_filename
,
SE
XP
data_has_header
,
LGBM_
SE
data_has_header
,
SE
XP
is_rawscore
,
LGBM_
SE
is_rawscore
,
SE
XP
is_leafidx
,
LGBM_
SE
is_leafidx
,
SE
XP
num_iteration
,
LGBM_
SE
num_iteration
,
SE
XP
result_filename
,
LGBM_
SE
result_filename
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief Get number of prediction
* \brief Get number of prediction
...
@@ -392,13 +392,13 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterPredictForFile_R(SEXP handle,
...
@@ -392,13 +392,13 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterPredictForFile_R(SEXP handle,
* \param out_len lenght of prediction
* \param out_len lenght of prediction
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterCalcNumPredict_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterCalcNumPredict_R
(
LGBM_
SE
handle
,
SE
XP
num_row
,
LGBM_
SE
num_row
,
SE
XP
is_rawscore
,
LGBM_
SE
is_rawscore
,
SE
XP
is_leafidx
,
LGBM_
SE
is_leafidx
,
SE
XP
num_iteration
,
LGBM_
SE
num_iteration
,
SE
XP
out_len
,
LGBM_
SE
out_len
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief make prediction for an new data set
* \brief make prediction for an new data set
...
@@ -418,18 +418,18 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterCalcNumPredict_R(SEXP handle,
...
@@ -418,18 +418,18 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterCalcNumPredict_R(SEXP handle,
* \param out prediction result
* \param out prediction result
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterPredictForCSC_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterPredictForCSC_R
(
LGBM_
SE
handle
,
SE
XP
indptr
,
LGBM_
SE
indptr
,
SE
XP
indices
,
LGBM_
SE
indices
,
SE
XP
data
,
LGBM_
SE
data
,
SE
XP
nindptr
,
LGBM_
SE
nindptr
,
SE
XP
nelem
,
LGBM_
SE
nelem
,
SE
XP
num_row
,
LGBM_
SE
num_row
,
SE
XP
is_rawscore
,
LGBM_
SE
is_rawscore
,
SE
XP
is_leafidx
,
LGBM_
SE
is_leafidx
,
SE
XP
num_iteration
,
LGBM_
SE
num_iteration
,
SE
XP
out_result
,
LGBM_
SE
out_result
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief make prediction for a new data set
* \brief make prediction for a new data set
...
@@ -446,15 +446,15 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterPredictForCSC_R(SEXP handle,
...
@@ -446,15 +446,15 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterPredictForCSC_R(SEXP handle,
* \param out prediction result
* \param out prediction result
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterPredictForMat_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterPredictForMat_R
(
LGBM_
SE
handle
,
SE
XP
data
,
LGBM_
SE
data
,
SE
XP
nrow
,
LGBM_
SE
nrow
,
SE
XP
ncol
,
LGBM_
SE
ncol
,
SE
XP
is_rawscore
,
LGBM_
SE
is_rawscore
,
SE
XP
is_leafidx
,
LGBM_
SE
is_leafidx
,
SE
XP
num_iteration
,
LGBM_
SE
num_iteration
,
SE
XP
out_result
,
LGBM_
SE
out_result
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief save model into file
* \brief save model into file
...
@@ -463,10 +463,10 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterPredictForMat_R(SEXP handle,
...
@@ -463,10 +463,10 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterPredictForMat_R(SEXP handle,
* \param filename file name
* \param filename file name
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterSaveModel_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterSaveModel_R
(
LGBM_
SE
handle
,
SE
XP
num_iteration
,
LGBM_
SE
num_iteration
,
SE
XP
filename
,
LGBM_
SE
filename
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
/*!
/*!
* \brief dump model to json
* \brief dump model to json
...
@@ -475,11 +475,11 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterSaveModel_R(SEXP handle,
...
@@ -475,11 +475,11 @@ LIGHTGBM_C_EXPORT SEXP LGBM_BoosterSaveModel_R(SEXP handle,
* \param out_str json format string of model
* \param out_str json format string of model
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
*/
LIGHTGBM_C_EXPORT
SE
XP
LGBM_BoosterDumpModel_R
(
SE
XP
handle
,
LIGHTGBM_C_EXPORT
LGBM_
SE
LGBM_BoosterDumpModel_R
(
LGBM_
SE
handle
,
SE
XP
num_iteration
,
LGBM_
SE
num_iteration
,
SE
XP
buffer_len
,
LGBM_
SE
buffer_len
,
SE
XP
actual_len
,
LGBM_
SE
actual_len
,
SE
XP
out_str
,
LGBM_
SE
out_str
,
SE
XP
call_state
);
LGBM_
SE
call_state
);
#endif // LIGHTGBM_R_H_
#endif // LIGHTGBM_R_H_
src/network/socket_wrapper.hpp
View file @
0eb99219
...
@@ -193,7 +193,6 @@ public:
...
@@ -193,7 +193,6 @@ public:
return
ip_list
;
return
ip_list
;
}
}
#else
#else
// see in http://stackoverflow.com/questions/212528/get-the-ip-address-of-the-machine
inline
static
std
::
unordered_set
<
std
::
string
>
GetLocalIpList
()
{
inline
static
std
::
unordered_set
<
std
::
string
>
GetLocalIpList
()
{
std
::
unordered_set
<
std
::
string
>
ip_list
;
std
::
unordered_set
<
std
::
string
>
ip_list
;
struct
ifaddrs
*
ifAddrStruct
=
NULL
;
struct
ifaddrs
*
ifAddrStruct
=
NULL
;
...
...
Prev
1
2
Next
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