Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
000292ce6d | ||
|
|
d3ec116322 | ||
|
|
a018028471 |
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
project(xgboost LANGUAGES CXX C VERSION 1.3.2)
|
project(xgboost LANGUAGES CXX C VERSION 1.3.3)
|
||||||
include(cmake/Utils.cmake)
|
include(cmake/Utils.cmake)
|
||||||
list(APPEND CMAKE_MODULE_PATH "${xgboost_SOURCE_DIR}/cmake/modules")
|
list(APPEND CMAKE_MODULE_PATH "${xgboost_SOURCE_DIR}/cmake/modules")
|
||||||
cmake_policy(SET CMP0022 NEW)
|
cmake_policy(SET CMP0022 NEW)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
Package: xgboost
|
Package: xgboost
|
||||||
Type: Package
|
Type: Package
|
||||||
Title: Extreme Gradient Boosting
|
Title: Extreme Gradient Boosting
|
||||||
Version: 1.3.2.1
|
Version: 1.3.3.1
|
||||||
Date: 2020-08-28
|
Date: 2020-08-28
|
||||||
Authors@R: c(
|
Authors@R: c(
|
||||||
person("Tianqi", "Chen", role = c("aut"),
|
person("Tianqi", "Chen", role = c("aut"),
|
||||||
|
|||||||
@@ -6,6 +6,6 @@
|
|||||||
|
|
||||||
#define XGBOOST_VER_MAJOR 1
|
#define XGBOOST_VER_MAJOR 1
|
||||||
#define XGBOOST_VER_MINOR 3
|
#define XGBOOST_VER_MINOR 3
|
||||||
#define XGBOOST_VER_PATCH 2
|
#define XGBOOST_VER_PATCH 3
|
||||||
|
|
||||||
#endif // XGBOOST_VERSION_CONFIG_H_
|
#endif // XGBOOST_VERSION_CONFIG_H_
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost-jvm_2.12</artifactId>
|
<artifactId>xgboost-jvm_2.12</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>XGBoost JVM Package</name>
|
<name>XGBoost JVM Package</name>
|
||||||
<description>JVM Package for XGBoost</description>
|
<description>JVM Package for XGBoost</description>
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost-jvm_2.12</artifactId>
|
<artifactId>xgboost-jvm_2.12</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>xgboost4j-example_2.12</artifactId>
|
<artifactId>xgboost4j-example_2.12</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost4j-spark_${scala.binary.version}</artifactId>
|
<artifactId>xgboost4j-spark_${scala.binary.version}</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.spark</groupId>
|
<groupId>org.apache.spark</groupId>
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost4j-flink_${scala.binary.version}</artifactId>
|
<artifactId>xgboost4j-flink_${scala.binary.version}</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost-jvm_2.12</artifactId>
|
<artifactId>xgboost-jvm_2.12</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>xgboost4j-flink_2.12</artifactId>
|
<artifactId>xgboost4j-flink_2.12</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost4j_${scala.binary.version}</artifactId>
|
<artifactId>xgboost4j_${scala.binary.version}</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost-jvm_2.12</artifactId>
|
<artifactId>xgboost-jvm_2.12</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>xgboost4j-gpu_2.12</artifactId>
|
<artifactId>xgboost4j-gpu_2.12</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost-jvm_2.12</artifactId>
|
<artifactId>xgboost-jvm_2.12</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>xgboost4j-spark-gpu_2.12</artifactId>
|
<artifactId>xgboost4j-spark-gpu_2.12</artifactId>
|
||||||
<build>
|
<build>
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost4j-gpu_${scala.binary.version}</artifactId>
|
<artifactId>xgboost4j-gpu_${scala.binary.version}</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.spark</groupId>
|
<groupId>org.apache.spark</groupId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost-jvm_2.12</artifactId>
|
<artifactId>xgboost-jvm_2.12</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>xgboost4j-spark_2.12</artifactId>
|
<artifactId>xgboost4j-spark_2.12</artifactId>
|
||||||
<build>
|
<build>
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost4j_${scala.binary.version}</artifactId>
|
<artifactId>xgboost4j_${scala.binary.version}</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.spark</groupId>
|
<groupId>org.apache.spark</groupId>
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost-jvm_2.12</artifactId>
|
<artifactId>xgboost-jvm_2.12</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>xgboost4j_2.12</artifactId>
|
<artifactId>xgboost4j_2.12</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.3.2
|
1.3.3
|
||||||
|
|||||||
@@ -142,9 +142,7 @@ def _train_internal(params, dtrain,
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'Unknown booster: {booster}')
|
raise ValueError(f'Unknown booster: {booster}')
|
||||||
num_groups = int(config['learner']['learner_model_param']['num_class'])
|
bst.best_ntree_limit = (bst.best_iteration + 1) * num_parallel_tree
|
||||||
num_groups = 1 if num_groups == 0 else num_groups
|
|
||||||
bst.best_ntree_limit = (bst.best_iteration + 1) * num_parallel_tree * num_groups
|
|
||||||
|
|
||||||
# Copy to serialise and unserialise booster to reset state and free
|
# Copy to serialise and unserialise booster to reset state and free
|
||||||
# training memory
|
# training memory
|
||||||
@@ -184,9 +182,10 @@ def train(params, dtrain, num_boost_round=10, evals=(), obj=None, feval=None,
|
|||||||
If there's more than one metric in the **eval_metric** parameter given in
|
If there's more than one metric in the **eval_metric** parameter given in
|
||||||
**params**, the last metric will be used for early stopping.
|
**params**, the last metric will be used for early stopping.
|
||||||
If early stopping occurs, the model will have three additional fields:
|
If early stopping occurs, the model will have three additional fields:
|
||||||
``bst.best_score``, ``bst.best_iteration`` and ``bst.best_ntree_limit``.
|
``bst.best_score``, ``bst.best_iteration`` and ``bst.best_ntree_limit``. Use
|
||||||
(Use ``bst.best_ntree_limit`` to get the correct value if
|
``bst.best_ntree_limit`` to get the correct value if ``num_parallel_tree`` and/or
|
||||||
``num_parallel_tree`` and/or ``num_class`` appears in the parameters)
|
``num_class`` appears in the parameters. ``best_ntree_limit`` is the result of
|
||||||
|
``num_parallel_tree * best_iteration``.
|
||||||
evals_result: dict
|
evals_result: dict
|
||||||
This dictionary stores the evaluation results of all the items in watchlist.
|
This dictionary stores the evaluation results of all the items in watchlist.
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,6 @@ namespace xgboost {
|
|||||||
namespace gbm {
|
namespace gbm {
|
||||||
|
|
||||||
void GBLinearModel::SaveModel(Json* p_out) const {
|
void GBLinearModel::SaveModel(Json* p_out) const {
|
||||||
using WeightType = std::remove_reference<decltype(std::declval<decltype(weight)>().back())>::type;
|
|
||||||
using JsonFloat = Number::Float;
|
|
||||||
static_assert(std::is_same<WeightType, JsonFloat>::value,
|
|
||||||
"Weight type should be of the same type with JSON float");
|
|
||||||
auto& out = *p_out;
|
auto& out = *p_out;
|
||||||
|
|
||||||
size_t const n_weights = weight.size();
|
size_t const n_weights = weight.size();
|
||||||
|
|||||||
@@ -33,9 +33,15 @@ def run_predict_leaf(predictor):
|
|||||||
y = rng.randint(low=0, high=classes, size=rows)
|
y = rng.randint(low=0, high=classes, size=rows)
|
||||||
m = xgb.DMatrix(X, y)
|
m = xgb.DMatrix(X, y)
|
||||||
booster = xgb.train(
|
booster = xgb.train(
|
||||||
{'num_parallel_tree': num_parallel_tree, 'num_class': classes,
|
{
|
||||||
'predictor': predictor, 'tree_method': 'hist'}, m,
|
"num_parallel_tree": num_parallel_tree,
|
||||||
num_boost_round=num_boost_round)
|
"num_class": classes,
|
||||||
|
"predictor": predictor,
|
||||||
|
"tree_method": "hist",
|
||||||
|
},
|
||||||
|
m,
|
||||||
|
num_boost_round=num_boost_round,
|
||||||
|
)
|
||||||
|
|
||||||
empty = xgb.DMatrix(np.ones(shape=(0, cols)))
|
empty = xgb.DMatrix(np.ones(shape=(0, cols)))
|
||||||
empty_leaf = booster.predict(empty, pred_leaf=True)
|
empty_leaf = booster.predict(empty, pred_leaf=True)
|
||||||
@@ -52,12 +58,19 @@ def run_predict_leaf(predictor):
|
|||||||
end = classes * num_parallel_tree * (j + 1)
|
end = classes * num_parallel_tree * (j + 1)
|
||||||
layer = row[start: end]
|
layer = row[start: end]
|
||||||
for c in range(classes):
|
for c in range(classes):
|
||||||
tree_group = layer[c * num_parallel_tree:
|
tree_group = layer[c * num_parallel_tree: (c + 1) * num_parallel_tree]
|
||||||
(c+1) * num_parallel_tree]
|
|
||||||
assert tree_group.shape[0] == num_parallel_tree
|
assert tree_group.shape[0] == num_parallel_tree
|
||||||
# no subsampling so tree in same forest should output same
|
# no subsampling so tree in same forest should output same
|
||||||
# leaf.
|
# leaf.
|
||||||
assert np.all(tree_group == tree_group[0])
|
assert np.all(tree_group == tree_group[0])
|
||||||
|
|
||||||
|
ntree_limit = 2
|
||||||
|
sliced = booster.predict(
|
||||||
|
m, pred_leaf=True, ntree_limit=num_parallel_tree * ntree_limit
|
||||||
|
)
|
||||||
|
first = sliced[0, ...]
|
||||||
|
|
||||||
|
assert first.shape[0] == classes * num_parallel_tree * ntree_limit
|
||||||
return leaf
|
return leaf
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -123,13 +123,13 @@ class TestTrainingContinuation:
|
|||||||
gbdt_05 = xgb.train(xgb_params_03, dtrain_5class,
|
gbdt_05 = xgb.train(xgb_params_03, dtrain_5class,
|
||||||
num_boost_round=7)
|
num_boost_round=7)
|
||||||
assert gbdt_05.best_ntree_limit == (
|
assert gbdt_05.best_ntree_limit == (
|
||||||
gbdt_05.best_iteration + 1) * self.num_parallel_tree * 5
|
gbdt_05.best_iteration + 1) * self.num_parallel_tree
|
||||||
gbdt_05 = xgb.train(xgb_params_03,
|
gbdt_05 = xgb.train(xgb_params_03,
|
||||||
dtrain_5class,
|
dtrain_5class,
|
||||||
num_boost_round=3,
|
num_boost_round=3,
|
||||||
xgb_model=gbdt_05)
|
xgb_model=gbdt_05)
|
||||||
assert gbdt_05.best_ntree_limit == (
|
assert gbdt_05.best_ntree_limit == (
|
||||||
gbdt_05.best_iteration + 1) * self.num_parallel_tree * 5
|
gbdt_05.best_iteration + 1) * self.num_parallel_tree
|
||||||
|
|
||||||
res1 = gbdt_05.predict(dtrain_5class)
|
res1 = gbdt_05.predict(dtrain_5class)
|
||||||
res2 = gbdt_05.predict(dtrain_5class,
|
res2 = gbdt_05.predict(dtrain_5class,
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ def test_best_ntree_limit():
|
|||||||
)
|
)
|
||||||
|
|
||||||
if forest:
|
if forest:
|
||||||
assert cls.best_ntree_limit == rounds * forest * cls.n_classes_
|
assert cls.best_ntree_limit == rounds * forest
|
||||||
else:
|
else:
|
||||||
assert cls.best_ntree_limit == 0
|
assert cls.best_ntree_limit == 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user