"tests/vscode:/vscode.git/clone" did not exist on "adb8fb4e5c418d6697cfdd8e12d12fc5f722ada8"
Commit eade219e authored by Qiwei Ye's avatar Qiwei Ye
Browse files

merge conflict

parents f23e6083 060bd316
...@@ -2,3 +2,4 @@ basic_walkthrough Basic feature walkthrough ...@@ -2,3 +2,4 @@ basic_walkthrough Basic feature walkthrough
boost_from_prediction Boosting from existing prediction boost_from_prediction Boosting from existing prediction
early_stopping Early Stop in training early_stopping Early Stop in training
cross_validation Cross Validation cross_validation Cross Validation
multiclass Multiclass training/prediction
...@@ -4,3 +4,4 @@ LightGBM R examples ...@@ -4,3 +4,4 @@ LightGBM R examples
* [Boosting from existing prediction](boost_from_prediction.R) * [Boosting from existing prediction](boost_from_prediction.R)
* [Early Stopping](early_stopping.R) * [Early Stopping](early_stopping.R)
* [Cross Validation](cross_validation.R) * [Cross Validation](cross_validation.R)
* [Multiclass Training/Prediction](multiclass.R)
require(lightgbm)
# we load the default iris dataset shipped with R
data(iris)
# we must convert factors to numeric
# they must be starting from number 0 to use multiclass
# for instance: 0, 1, 2, 3, 4, 5...
iris$Species <- as.numeric(as.factor(iris$Species))-1
# we cut the data set into 80% train and 20% validation
# the 10 last samples of each class are for validation
train <- as.matrix(iris[c(1:40, 51:90, 101:140), ])
test <- as.matrix(iris[c(41:50, 91:100, 141:150), ])
dtrain <- lgb.Dataset(data=train[, 1:4], label=train[, 5])
dtest <- lgb.Dataset.create.valid(dtrain, data=test[, 1:4], label=test[, 5])
valids <- list(test=dtest)
# method 1 of training
params <- list(objective="multiclass", metric="multi_error", num_class=3)
model <- lgb.train(params, dtrain, 100, valids, min_data=1, learning_rate=1, early_stopping_rounds=10)
# we can predict on test data, outputs a 90-length vector
# order: obs1 class1, obs1 class2, obs1 class3, obs2 class1, obs2 class2, obs2 class3...
my_preds <- predict(model, test[, 1:4])
# method 2 of training, identical
model <- lgb.train(list(), dtrain, 100, valids, min_data=1, learning_rate=1, early_stopping_rounds=10, objective="multiclass", metric="multi_error", num_class=3)
# we can predict on test data, identical
my_preds <- predict(model, test[, 1:4])
# a (30x3) matrix with the predictions, use parameter reshape
# class1 class2 class3
# obs1 obs1 obs1
# obs2 obs2 obs2
# .... .... ....
my_preds <- predict(model, test[, 1:4], reshape=TRUE)
# we can also get the predicted scores before the Sigmoid/Softmax application
my_preds <- predict(model, test[, 1:4], rawscore=TRUE)
# raw score predictions as matrix instead of vector
my_preds <- predict(model, test[, 1:4], rawscore=TRUE, reshape=TRUE)
# we can also get the leaf index
my_preds <- predict(model, test[, 1:4], predleaf=TRUE)
# preddict leaf index as matrix instead of vector
my_preds <- predict(model, test[, 1:4], predleaf=TRUE, reshape=TRUE)
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
% Please edit documentation in R/lgb.Dataset.R % Please edit documentation in R/lgb.Dataset.R
\name{lgb.Dataset} \name{lgb.Dataset}
\alias{lgb.Dataset} \alias{lgb.Dataset}
\title{Contruct lgb.Dataset object} \title{Construct lgb.Dataset object}
\usage{ \usage{
lgb.Dataset(data, params = list(), reference = NULL, colnames = NULL, lgb.Dataset(data, params = list(), reference = NULL, colnames = NULL,
categorical_feature = NULL, free_raw_data = TRUE, info = list(), ...) categorical_feature = NULL, free_raw_data = TRUE, info = list(), ...)
...@@ -28,7 +28,7 @@ lgb.Dataset(data, params = list(), reference = NULL, colnames = NULL, ...@@ -28,7 +28,7 @@ lgb.Dataset(data, params = list(), reference = NULL, colnames = NULL,
constructed dataset constructed dataset
} }
\description{ \description{
Contruct lgb.Dataset object from dense matrix, sparse matrix Construct lgb.Dataset object from dense matrix, sparse matrix
or local file (that was created previously by saving an \code{lgb.Dataset}). or local file (that was created previously by saving an \code{lgb.Dataset}).
} }
\examples{ \examples{
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
% Please edit documentation in R/lgb.Dataset.R % Please edit documentation in R/lgb.Dataset.R
\name{lgb.Dataset.create.valid} \name{lgb.Dataset.create.valid}
\alias{lgb.Dataset.create.valid} \alias{lgb.Dataset.create.valid}
\title{Contruct validation data} \title{Construct validation data}
\usage{ \usage{
lgb.Dataset.create.valid(dataset, data, info = list(), ...) lgb.Dataset.create.valid(dataset, data, info = list(), ...)
} }
...@@ -19,7 +19,7 @@ lgb.Dataset.create.valid(dataset, data, info = list(), ...) ...@@ -19,7 +19,7 @@ lgb.Dataset.create.valid(dataset, data, info = list(), ...)
constructed dataset constructed dataset
} }
\description{ \description{
Contruct validation data according to training data Construct validation data according to training data
} }
\examples{ \examples{
\dontrun{ \dontrun{
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lgb.importance.R
\name{lgb.importance}
\alias{lgb.importance}
\title{Compute feature importance in a model}
\usage{
lgb.importance(model, percentage = TRUE)
}
\arguments{
\item{model}{object of class \code{lgb.Booster}.}
\item{percentage}{whether to show importance in relative percentage.}
}
\value{
For a tree model, a \code{data.table} with the following columns:
\itemize{
\item \code{Feature} Feature names in the model.
\item \code{Gain} The total gain of this feature's splits.
\item \code{Cover} The number of observation related to this feature.
\item \code{Frequency} The number of times a feature splited in trees.
}
}
\description{
Creates a \code{data.table} of feature importances in a model.
}
\examples{
data(agaricus.train, package = 'lightgbm')
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
params = list(objective = "binary",
learning_rate = 0.01, num_leaves = 63, max_depth = -1,
min_data_in_leaf = 1, min_sum_hessian_in_leaf = 1)
model <- lgb.train(params, dtrain, 20)
model <- lgb.train(params, dtrain, 20)
tree_imp1 <- lgb.importance(model, percentage = TRUE)
tree_imp2 <- lgb.importance(model, percentage = FALSE)
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lgb.interprete.R
\name{lgb.interprete}
\alias{lgb.interprete}
\title{Compute feature contribution of prediction}
\usage{
lgb.interprete(model, data, idxset, num_iteration = NULL)
}
\arguments{
\item{model}{object of class \code{lgb.Booster}.}
\item{data}{a matrix object or a dgCMatrix object.}
\item{idxset}{a integer vector of indices of rows needed.}
\item{num_iteration}{number of iteration want to predict with, NULL or <= 0 means use best iteration.}
}
\value{
For regression, binary classification and lambdarank model, a \code{list} of \code{data.table} with the following columns:
\itemize{
\item \code{Feature} Feature names in the model.
\item \code{Contribution} The total contribution of this feature's splits.
}
For multiclass classification, a \code{list} of \code{data.table} with the Feature column and Contribution columns to each class.
}
\description{
Computes feature contribution components of rawscore prediction.
}
\examples{
Sigmoid <- function(x) 1 / (1 + exp(-x))
Logit <- function(x) log(x / (1 - x))
data(agaricus.train, package = 'lightgbm')
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
setinfo(dtrain, "init_score", rep(Logit(mean(train$label)), length(train$label)))
data(agaricus.test, package = 'lightgbm')
test <- agaricus.test
params = list(objective = "binary",
learning_rate = 0.01, num_leaves = 63, max_depth = -1,
min_data_in_leaf = 1, min_sum_hessian_in_leaf = 1)
model <- lgb.train(params, dtrain, 20)
model <- lgb.train(params, dtrain, 20)
tree_interpretation <- lgb.interprete(model, test$data, 1:5)
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lgb.model.dt.tree.R
\name{lgb.model.dt.tree}
\alias{lgb.model.dt.tree}
\title{Parse a LightGBM model json dump}
\usage{
lgb.model.dt.tree(model, num_iteration = NULL)
}
\arguments{
\item{model}{object of class \code{lgb.Booster}}
}
\value{
A \code{data.table} with detailed information about model trees' nodes and leafs.
The columns of the \code{data.table} are:
\itemize{
\item \code{tree_index}: ID of a tree in a model (integer)
\item \code{split_index}: ID of a node in a tree (integer)
\item \code{split_feature}: for a node, it's a feature name (character);
for a leaf, it simply labels it as \code{'NA'}
\item \code{node_parent}: ID of the parent node for current node (integer)
\item \code{leaf_index}: ID of a leaf in a tree (integer)
\item \code{leaf_parent}: ID of the parent node for current leaf (integer)
\item \code{split_gain}: Split gain of a node
\item \code{threshold}: Spliting threshold value of a node
\item \code{decision_type}: Decision type of a node
\item \code{internal_value}: Node value
\item \code{internal_count}: The number of observation collected by a node
\item \code{leaf_value}: Leaf value
\item \code{leaf_count}: The number of observation collected by a leaf
}
}
\description{
Parse a LightGBM model json dump into a \code{data.table} structure.
}
\examples{
data(agaricus.train, package = 'lightgbm')
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
params = list(objective = "binary",
learning_rate = 0.01, num_leaves = 63, max_depth = -1,
min_data_in_leaf = 1, min_sum_hessian_in_leaf = 1)
model <- lgb.train(params, dtrain, 20)
model <- lgb.train(params, dtrain, 20)
tree_dt <- lgb.model.dt.tree(model)
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lgb.plot.importance.R
\name{lgb.plot.importance}
\alias{lgb.plot.importance}
\title{Plot feature importance as a bar graph}
\usage{
lgb.plot.importance(tree_imp, top_n = 10, measure = "Gain",
left_margin = 10, cex = NULL)
}
\arguments{
\item{tree_imp}{a \code{data.table} returned by \code{\link{lgb.importance}}.}
\item{top_n}{maximal number of top features to include into the plot.}
\item{measure}{the name of importance measure to plot, can be "Gain", "Cover" or "Frequency".}
\item{left_margin}{(base R barplot) allows to adjust the left margin size to fit feature names.}
\item{cex}{(base R barplot) passed as \code{cex.names} parameter to \code{barplot}.}
}
\value{
The \code{lgb.plot.importance} function creates a \code{barplot}
and silently returns a processed data.table with \code{top_n} features sorted by defined importance.
}
\description{
Plot previously calculated feature importance: Gain, Cover and Frequency, as a bar graph.
}
\details{
The graph represents each feature as a horizontal bar of length proportional to the defined importance of a feature.
Features are shown ranked in a decreasing importance order.
}
\examples{
data(agaricus.train, package = 'lightgbm')
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
params = list(objective = "binary",
learning_rate = 0.01, num_leaves = 63, max_depth = -1,
min_data_in_leaf = 1, min_sum_hessian_in_leaf = 1)
model <- lgb.train(params, dtrain, 20)
model <- lgb.train(params, dtrain, 20)
tree_imp <- lgb.importance(model, percentage = TRUE)
lgb.plot.importance(tree_imp, top_n = 10, measure = "Gain")
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lgb.plot.interpretation.R
\name{lgb.plot.interpretation}
\alias{lgb.plot.interpretation}
\title{Plot feature contribution as a bar graph}
\usage{
lgb.plot.interpretation(tree_interpretation_dt, top_n = 10, cols = 1,
left_margin = 10, cex = NULL)
}
\arguments{
\item{tree_interpretation_dt}{a \code{data.table} returned by \code{\link{lgb.interprete}}.}
\item{top_n}{maximal number of top features to include into the plot.}
\item{cols}{the column numbers of layout, will be used only for multiclass classification feature contribution.}
\item{left_margin}{(base R barplot) allows to adjust the left margin size to fit feature names.}
\item{cex}{(base R barplot) passed as \code{cex.names} parameter to \code{barplot}.}
}
\value{
The \code{lgb.plot.interpretation} function creates a \code{barplot}
}
\description{
Plot previously calculated feature contribution as a bar graph.
}
\details{
The graph represents each feature as a horizontal bar of length proportional to the defined contribution of a feature.
Features are shown ranked in a decreasing contribution order.
}
\examples{
Sigmoid <- function(x) 1 / (1 + exp(-x))
Logit <- function(x) log(x / (1 - x))
data(agaricus.train, package = 'lightgbm')
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
setinfo(dtrain, "init_score", rep(Logit(mean(train$label)), length(train$label)))
data(agaricus.test, package = 'lightgbm')
test <- agaricus.test
params = list(objective = "binary",
learning_rate = 0.01, num_leaves = 63, max_depth = -1,
min_data_in_leaf = 1, min_sum_hessian_in_leaf = 1)
model <- lgb.train(params, dtrain, 20)
model <- lgb.train(params, dtrain, 20)
tree_interpretation <- lgb.interprete(model, test$data, 1:5)
lgb.plot.interpretation(tree_interpretation[[1]], top_n = 10)
}
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
\title{Main CV logic for LightGBM} \title{Main CV logic for LightGBM}
\usage{ \usage{
lgb.cv(params = list(), data, nrounds = 10, nfold = 3, label = NULL, lgb.cv(params = list(), data, nrounds = 10, nfold = 3, label = NULL,
weight = NULL, obj = NULL, eval = NULL, verbose = 1, eval_freq = 1L, weight = NULL, obj = NULL, eval = NULL, verbose = 1, record = TRUE,
showsd = TRUE, stratified = TRUE, folds = NULL, init_model = NULL, eval_freq = 1L, showsd = TRUE, stratified = TRUE, folds = NULL,
colnames = NULL, categorical_feature = NULL, init_model = NULL, colnames = NULL, categorical_feature = NULL,
early_stopping_rounds = NULL, callbacks = list(), ...) early_stopping_rounds = NULL, callbacks = list(), ...)
lgb.train(params = list(), data, nrounds = 10, valids = list(), lgb.train(params = list(), data, nrounds = 10, valids = list(),
obj = NULL, eval = NULL, verbose = 1, eval_freq = 1L, obj = NULL, eval = NULL, verbose = 1, record = TRUE, eval_freq = 1L,
init_model = NULL, colnames = NULL, categorical_feature = NULL, init_model = NULL, colnames = NULL, categorical_feature = NULL,
early_stopping_rounds = NULL, callbacks = list(), ...) early_stopping_rounds = NULL, callbacks = list(), ...)
...@@ -35,14 +35,17 @@ lightgbm(data, label = NULL, weight = NULL, params = list(), ...@@ -35,14 +35,17 @@ lightgbm(data, label = NULL, weight = NULL, params = list(),
\item{weight}{vector of response values. If not NULL, will set to dataset} \item{weight}{vector of response values. If not NULL, will set to dataset}
\item{obj}{objective function, can be character or custom objective function} \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{eval}{evaluation function, can be (list of) character or custom eval function}
\item{verbose}{verbosity for output \item{verbose}{verbosity for output, if <= 0, also will disable the print of evalutaion during training}
if verbose > 0 , also will record iteration message to booster$record_evals}
\item{record}{Boolean, TRUE will record iteration message to \code{booster$record_evals}}
\item{eval_freq}{evalutaion output frequence} \item{eval_freq}{evalutaion output frequence, only effect when verbose > 0}
\item{showsd}{\code{boolean}, whether to show standard deviation of cross validation} \item{showsd}{\code{boolean}, whether to show standard deviation of cross validation}
...@@ -75,20 +78,41 @@ List of callback functions that are applied at each iteration.} ...@@ -75,20 +78,41 @@ List of callback functions that are applied at each iteration.}
\item{valids}{a list of \code{lgb.Dataset} objects, used for validation} \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{params}{List of parameters}
\item{data}{a \code{lgb.Dataset} object, used for training} \item{data}{a \code{lgb.Dataset} object, used for training}
\item{nrounds}{number of training rounds} \item{nrounds}{number of training rounds}
\item{obj}{objective function, can be character or custom objective function} \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{eval}{evaluation function, can be (a list of) character or custom eval function}
\item{verbose}{verbosity for output \item{verbose}{verbosity for output, if <= 0, also will disable the print of evalutaion during training}
if \code{verbose > 0}, also will record iteration message to \code{booster$record_evals}}
\item{record}{Boolean, TRUE will record iteration message to \code{booster$record_evals}}
\item{eval_freq}{evalutaion output frequency} \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{init_model}{path of model file of \code{lgb.Booster} object, will continue training from this model}
...@@ -111,7 +135,7 @@ List of callback functions that are applied at each iteration.} ...@@ -111,7 +135,7 @@ List of callback functions that are applied at each iteration.}
\item{...}{other parameters, see parameters.md for more informations} \item{...}{other parameters, see parameters.md for more informations}
} }
\value{ \value{
a trained booster model \code{lgb.Booster}. a trained model \code{lgb.CVBooster}.
a trained booster model \code{lgb.Booster}. a trained booster model \code{lgb.Booster}.
} }
......
% 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")
}
}
% 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")
}
}
# package root
PKGROOT=.
ENABLE_STD_THREAD=1
CXX_STD = CXX11
LGBM_RFLAGS = -DUSE_SOCKET
PKG_CPPFLAGS= -I$(PKGROOT)/include $(LGBM_RFLAGS) -Wno-deprecated-declarations
PKG_CXXFLAGS= $(SHLIB_OPENMP_CFLAGS) $(SHLIB_PTHREAD_FLAGS) -std=c++11
PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) $(SHLIB_PTHREAD_FLAGS)
OBJECTS = ./lightgbm-fullcode.o ./lightgbm_R.o
# package root
PKGROOT=.
ENABLE_STD_THREAD=1
CXX_STD = CXX11
LGBM_RFLAGS = -DUSE_SOCKET
PKG_CPPFLAGS= -I$(PKGROOT)/include $(LGBM_RFLAGS)
PKG_CXXFLAGS= $(SHLIB_OPENMP_CFLAGS) $(SHLIB_PTHREAD_FLAGS) -std=c++11
PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) $(SHLIB_PTHREAD_FLAGS) -lws2_32 -liphlpapi
OBJECTS = ./lightgbm-fullcode.o ./lightgbm_R.o
// application
#include "./src/application/application.cpp"
// boosting
#include "./src/boosting/boosting.cpp"
#include "./src/boosting/gbdt.cpp"
// io
#include "./src/io/bin.cpp"
#include "./src/io/config.cpp"
#include "./src/io/dataset.cpp"
#include "./src/io/dataset_loader.cpp"
#include "./src/io/metadata.cpp"
#include "./src/io/parser.cpp"
#include "./src/io/tree.cpp"
// metric
#include "./src/metric/dcg_calculator.cpp"
#include "./src/metric/metric.cpp"
// network
#include "./src/network/linker_topo.cpp"
#include "./src/network/linkers_socket.cpp"
#include "./src/network/network.cpp"
// objective
#include "./src/objective/objective_function.cpp"
// treelearner
#include "./src/treelearner/data_parallel_tree_learner.cpp"
#include "./src/treelearner/feature_parallel_tree_learner.cpp"
#include "./src/treelearner/serial_tree_learner.cpp"
#include "./src/treelearner/tree_learner.cpp"
#include "./src/treelearner/voting_parallel_tree_learner.cpp"
// c_api
#include "./src/c_api.cpp"
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <cstring> #include <cstring>
#include <cstdio> #include <cstdio>
#include <sstream> #include <sstream>
#include <omp.h> #include <LightGBM/utils/openmp_wrapper.h>
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* \return err_msg error inforomation * \return err_msg error inforomation
* \return error inforomation * \return error inforomation
*/ */
DllExport SEXP LGBM_GetLastError_R(SEXP buf_len, SEXP actual_len, SEXP err_msg); LIGHTGBM_C_EXPORT SEXP LGBM_GetLastError_R(SEXP buf_len, SEXP actual_len, SEXP err_msg);
// --- start Dataset interface // --- start Dataset interface
...@@ -27,7 +27,7 @@ DllExport SEXP LGBM_GetLastError_R(SEXP buf_len, SEXP actual_len, SEXP err_msg); ...@@ -27,7 +27,7 @@ DllExport SEXP LGBM_GetLastError_R(SEXP buf_len, SEXP actual_len, SEXP err_msg);
* \param out created dataset * \param out created dataset
* \return 0 when succeed, -1 when failure happens * \return 0 when succeed, -1 when failure happens
*/ */
DllExport SEXP LGBM_DatasetCreateFromFile_R(SEXP filename, LIGHTGBM_C_EXPORT SEXP LGBM_DatasetCreateFromFile_R(SEXP filename,
SEXP parameters, SEXP parameters,
SEXP reference, SEXP reference,
SEXP out, SEXP out,
...@@ -46,7 +46,7 @@ DllExport SEXP LGBM_DatasetCreateFromFile_R(SEXP filename, ...@@ -46,7 +46,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_DatasetCreateFromCSC_R(SEXP indptr, LIGHTGBM_C_EXPORT SEXP LGBM_DatasetCreateFromCSC_R(SEXP indptr,
SEXP indices, SEXP indices,
SEXP data, SEXP data,
SEXP nindptr, SEXP nindptr,
...@@ -68,7 +68,7 @@ DllExport SEXP LGBM_DatasetCreateFromCSC_R(SEXP indptr, ...@@ -68,7 +68,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_DatasetCreateFromMat_R(SEXP data, LIGHTGBM_C_EXPORT SEXP LGBM_DatasetCreateFromMat_R(SEXP data,
SEXP nrow, SEXP nrow,
SEXP ncol, SEXP ncol,
SEXP parameters, SEXP parameters,
...@@ -85,7 +85,7 @@ DllExport SEXP LGBM_DatasetCreateFromMat_R(SEXP data, ...@@ -85,7 +85,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_DatasetGetSubset_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetSubset_R(SEXP handle,
SEXP used_row_indices, SEXP used_row_indices,
SEXP len_used_row_indices, SEXP len_used_row_indices,
SEXP parameters, SEXP parameters,
...@@ -98,7 +98,7 @@ DllExport SEXP LGBM_DatasetGetSubset_R(SEXP handle, ...@@ -98,7 +98,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_DatasetSetFeatureNames_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_DatasetSetFeatureNames_R(SEXP handle,
SEXP feature_names, SEXP feature_names,
SEXP call_state); SEXP call_state);
...@@ -108,7 +108,7 @@ DllExport SEXP LGBM_DatasetSetFeatureNames_R(SEXP handle, ...@@ -108,7 +108,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_DatasetGetFeatureNames_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetFeatureNames_R(SEXP handle,
SEXP buf_len, SEXP buf_len,
SEXP actual_len, SEXP actual_len,
SEXP feature_names, SEXP feature_names,
...@@ -120,7 +120,7 @@ DllExport SEXP LGBM_DatasetGetFeatureNames_R(SEXP handle, ...@@ -120,7 +120,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_DatasetSaveBinary_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_DatasetSaveBinary_R(SEXP handle,
SEXP filename, SEXP filename,
SEXP call_state); SEXP call_state);
...@@ -129,7 +129,7 @@ DllExport SEXP LGBM_DatasetSaveBinary_R(SEXP handle, ...@@ -129,7 +129,7 @@ DllExport SEXP LGBM_DatasetSaveBinary_R(SEXP handle,
* \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
*/ */
DllExport SEXP LGBM_DatasetFree_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_DatasetFree_R(SEXP handle,
SEXP call_state); SEXP call_state);
/*! /*!
...@@ -142,7 +142,7 @@ DllExport SEXP LGBM_DatasetFree_R(SEXP handle, ...@@ -142,7 +142,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_DatasetSetField_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_DatasetSetField_R(SEXP handle,
SEXP field_name, SEXP field_name,
SEXP field_data, SEXP field_data,
SEXP num_element, SEXP num_element,
...@@ -155,7 +155,7 @@ DllExport SEXP LGBM_DatasetSetField_R(SEXP handle, ...@@ -155,7 +155,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_DatasetGetFieldSize_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetFieldSize_R(SEXP handle,
SEXP field_name, SEXP field_name,
SEXP out, SEXP out,
SEXP call_state); SEXP call_state);
...@@ -167,7 +167,7 @@ DllExport SEXP LGBM_DatasetGetFieldSize_R(SEXP handle, ...@@ -167,7 +167,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_DatasetGetField_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetField_R(SEXP handle,
SEXP field_name, SEXP field_name,
SEXP field_data, SEXP field_data,
SEXP call_state); SEXP call_state);
...@@ -178,7 +178,7 @@ DllExport SEXP LGBM_DatasetGetField_R(SEXP handle, ...@@ -178,7 +178,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_DatasetGetNumData_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetNumData_R(SEXP handle,
SEXP out, SEXP out,
SEXP call_state); SEXP call_state);
...@@ -188,7 +188,7 @@ DllExport SEXP LGBM_DatasetGetNumData_R(SEXP handle, ...@@ -188,7 +188,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_DatasetGetNumFeature_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetNumFeature_R(SEXP handle,
SEXP out, SEXP out,
SEXP call_state); SEXP call_state);
...@@ -201,7 +201,7 @@ DllExport SEXP LGBM_DatasetGetNumFeature_R(SEXP handle, ...@@ -201,7 +201,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterCreate_R(SEXP train_data, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterCreate_R(SEXP train_data,
SEXP parameters, SEXP parameters,
SEXP out, SEXP out,
SEXP call_state); SEXP call_state);
...@@ -211,7 +211,7 @@ DllExport SEXP LGBM_BoosterCreate_R(SEXP train_data, ...@@ -211,7 +211,7 @@ DllExport SEXP LGBM_BoosterCreate_R(SEXP train_data,
* \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
*/ */
DllExport SEXP LGBM_BoosterFree_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterFree_R(SEXP handle,
SEXP call_state); SEXP call_state);
/*! /*!
...@@ -220,7 +220,7 @@ DllExport SEXP LGBM_BoosterFree_R(SEXP handle, ...@@ -220,7 +220,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterCreateFromModelfile_R(SEXP filename, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterCreateFromModelfile_R(SEXP filename,
SEXP out, SEXP out,
SEXP call_state); SEXP call_state);
...@@ -230,7 +230,7 @@ DllExport SEXP LGBM_BoosterCreateFromModelfile_R(SEXP filename, ...@@ -230,7 +230,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterMerge_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterMerge_R(SEXP handle,
SEXP other_handle, SEXP other_handle,
SEXP call_state); SEXP call_state);
...@@ -240,7 +240,7 @@ DllExport SEXP LGBM_BoosterMerge_R(SEXP handle, ...@@ -240,7 +240,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterAddValidData_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterAddValidData_R(SEXP handle,
SEXP valid_data, SEXP valid_data,
SEXP call_state); SEXP call_state);
...@@ -250,7 +250,7 @@ DllExport SEXP LGBM_BoosterAddValidData_R(SEXP handle, ...@@ -250,7 +250,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterResetTrainingData_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterResetTrainingData_R(SEXP handle,
SEXP train_data, SEXP train_data,
SEXP call_state); SEXP call_state);
...@@ -260,7 +260,7 @@ DllExport SEXP LGBM_BoosterResetTrainingData_R(SEXP handle, ...@@ -260,7 +260,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterResetParameter_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterResetParameter_R(SEXP handle,
SEXP parameters, SEXP parameters,
SEXP call_state); SEXP call_state);
...@@ -270,7 +270,7 @@ DllExport SEXP LGBM_BoosterResetParameter_R(SEXP handle, ...@@ -270,7 +270,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterGetNumClasses_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetNumClasses_R(SEXP handle,
SEXP out, SEXP out,
SEXP call_state); SEXP call_state);
...@@ -279,7 +279,7 @@ DllExport SEXP LGBM_BoosterGetNumClasses_R(SEXP handle, ...@@ -279,7 +279,7 @@ DllExport SEXP LGBM_BoosterGetNumClasses_R(SEXP handle,
* \param handle handle * \param handle handle
* \return 0 when succeed, -1 when failure happens * \return 0 when succeed, -1 when failure happens
*/ */
DllExport SEXP LGBM_BoosterUpdateOneIter_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterUpdateOneIter_R(SEXP handle,
SEXP call_state); SEXP call_state);
/*! /*!
...@@ -291,7 +291,7 @@ DllExport SEXP LGBM_BoosterUpdateOneIter_R(SEXP handle, ...@@ -291,7 +291,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterUpdateOneIterCustom_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterUpdateOneIterCustom_R(SEXP handle,
SEXP grad, SEXP grad,
SEXP hess, SEXP hess,
SEXP len, SEXP len,
...@@ -302,7 +302,7 @@ DllExport SEXP LGBM_BoosterUpdateOneIterCustom_R(SEXP handle, ...@@ -302,7 +302,7 @@ DllExport SEXP LGBM_BoosterUpdateOneIterCustom_R(SEXP handle,
* \param handle handle * \param handle handle
* \return 0 when succeed, -1 when failure happens * \return 0 when succeed, -1 when failure happens
*/ */
DllExport SEXP LGBM_BoosterRollbackOneIter_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterRollbackOneIter_R(SEXP handle,
SEXP call_state); SEXP call_state);
/*! /*!
...@@ -310,7 +310,7 @@ DllExport SEXP LGBM_BoosterRollbackOneIter_R(SEXP handle, ...@@ -310,7 +310,7 @@ DllExport SEXP LGBM_BoosterRollbackOneIter_R(SEXP handle,
* \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
*/ */
DllExport SEXP LGBM_BoosterGetCurrentIteration_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetCurrentIteration_R(SEXP handle,
SEXP out, SEXP out,
SEXP call_state); SEXP call_state);
...@@ -319,7 +319,7 @@ DllExport SEXP LGBM_BoosterGetCurrentIteration_R(SEXP handle, ...@@ -319,7 +319,7 @@ DllExport SEXP LGBM_BoosterGetCurrentIteration_R(SEXP handle,
* \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
*/ */
DllExport SEXP LGBM_BoosterGetEvalNames_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetEvalNames_R(SEXP handle,
SEXP buf_len, SEXP buf_len,
SEXP actual_len, SEXP actual_len,
SEXP eval_names, SEXP eval_names,
...@@ -332,7 +332,7 @@ DllExport SEXP LGBM_BoosterGetEvalNames_R(SEXP handle, ...@@ -332,7 +332,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterGetEval_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetEval_R(SEXP handle,
SEXP data_idx, SEXP data_idx,
SEXP out_result, SEXP out_result,
SEXP call_state); SEXP call_state);
...@@ -344,7 +344,7 @@ DllExport SEXP LGBM_BoosterGetEval_R(SEXP handle, ...@@ -344,7 +344,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterGetNumPredict_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetNumPredict_R(SEXP handle,
SEXP data_idx, SEXP data_idx,
SEXP out, SEXP out,
SEXP call_state); SEXP call_state);
...@@ -357,7 +357,7 @@ DllExport SEXP LGBM_BoosterGetNumPredict_R(SEXP handle, ...@@ -357,7 +357,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterGetPredict_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetPredict_R(SEXP handle,
SEXP data_idx, SEXP data_idx,
SEXP out_result, SEXP out_result,
SEXP call_state); SEXP call_state);
...@@ -373,7 +373,7 @@ DllExport SEXP LGBM_BoosterGetPredict_R(SEXP handle, ...@@ -373,7 +373,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterPredictForFile_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterPredictForFile_R(SEXP handle,
SEXP data_filename, SEXP data_filename,
SEXP data_has_header, SEXP data_has_header,
SEXP is_rawscore, SEXP is_rawscore,
...@@ -392,7 +392,7 @@ DllExport SEXP LGBM_BoosterPredictForFile_R(SEXP handle, ...@@ -392,7 +392,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterCalcNumPredict_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterCalcNumPredict_R(SEXP handle,
SEXP num_row, SEXP num_row,
SEXP is_rawscore, SEXP is_rawscore,
SEXP is_leafidx, SEXP is_leafidx,
...@@ -418,7 +418,7 @@ DllExport SEXP LGBM_BoosterCalcNumPredict_R(SEXP handle, ...@@ -418,7 +418,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterPredictForCSC_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterPredictForCSC_R(SEXP handle,
SEXP indptr, SEXP indptr,
SEXP indices, SEXP indices,
SEXP data, SEXP data,
...@@ -446,7 +446,7 @@ DllExport SEXP LGBM_BoosterPredictForCSC_R(SEXP handle, ...@@ -446,7 +446,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterPredictForMat_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterPredictForMat_R(SEXP handle,
SEXP data, SEXP data,
SEXP nrow, SEXP nrow,
SEXP ncol, SEXP ncol,
...@@ -463,7 +463,7 @@ DllExport SEXP LGBM_BoosterPredictForMat_R(SEXP handle, ...@@ -463,7 +463,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterSaveModel_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterSaveModel_R(SEXP handle,
SEXP num_iteration, SEXP num_iteration,
SEXP filename, SEXP filename,
SEXP call_state); SEXP call_state);
...@@ -475,7 +475,7 @@ DllExport SEXP LGBM_BoosterSaveModel_R(SEXP handle, ...@@ -475,7 +475,7 @@ DllExport 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
*/ */
DllExport SEXP LGBM_BoosterDumpModel_R(SEXP handle, LIGHTGBM_C_EXPORT SEXP LGBM_BoosterDumpModel_R(SEXP handle,
SEXP num_iteration, SEXP num_iteration,
SEXP buffer_len, SEXP buffer_len,
SEXP actual_len, SEXP actual_len,
......
cp ../include ./src/include -rf
cp ../src ./src/src -rf
rm ./src/Makevars
cp ./src/Makevars_fullcode ./src/Makevars -f
R CMD build --no-build-vignettes .
\ No newline at end of file
xcopy ..\include src\include /e /i /y
xcopy ..\src src\src /e /i /y
del .\src\Makevars.win
copy .\src\Makevars_fullcode.win .\src\Makevars.win /y
R CMD build --no-build-vignettes .
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment