Several fixes (#2572)

* repared serialization after update process; fixes #2545

* non-stratified folds in python could omit some data instances

* Makefile: fixes for older makes on windows; clean R-package too

* make cub to be a shallow submodule

* improve $(MAKE) recovery
This commit is contained in:
Vadim Khotilovich 2017-08-06 13:03:50 -05:00 committed by GitHub
parent 70b65a282c
commit 2b3a4318c5
4 changed files with 22 additions and 10 deletions

1
.gitmodules vendored
View File

@ -10,3 +10,4 @@
[submodule "cub"]
path = cub
url = https://github.com/NVlabs/cub
shallow = true

View File

@ -16,6 +16,20 @@ endif
ROOTDIR = $(CURDIR)
# workarounds for some buggy old make & msys2 versions seen in windows
ifeq (NA, $(shell test ! -d "$(ROOTDIR)" && echo NA ))
$(warning Attempting to fix non-existing ROOTDIR [$(ROOTDIR)])
ROOTDIR := $(shell pwd)
$(warning New ROOTDIR [$(ROOTDIR)] $(shell test -d "$(ROOTDIR)" && echo " is OK" ))
endif
MAKE_OK := $(shell "$(MAKE)" -v 2> /dev/null)
ifndef MAKE_OK
$(warning Attempting to recover non-functional MAKE [$(MAKE)])
MAKE := $(shell which make 2> /dev/null)
MAKE_OK := $(shell "$(MAKE)" -v 2> /dev/null)
endif
$(warning MAKE [$(MAKE)] - $(if $(MAKE_OK),checked OK,PROBLEM))
ifeq ($(OS), Windows_NT)
UNAME="Windows"
else
@ -215,6 +229,7 @@ endif
clean:
$(RM) -rf build build_plugin lib bin *~ */*~ */*/*~ */*/*/*~ */*.o */*/*.o */*/*/*.o #xgboost
$(RM) -rf build_tests *.gcov tests/cpp/xgboost_test
cd R-package/src; $(RM) -rf rabit src include dmlc-core amalgamation *.so *.dll; cd $(ROOTDIR)
clean_all: clean
cd $(DMLC_CORE); $(MAKE) clean; cd $(ROOTDIR)
@ -229,8 +244,7 @@ pypack: ${XGBOOST_DYLIB}
cd python-package; tar cf xgboost.tar xgboost; cd ..
# create pip installation pack for PyPI
pippack:
$(MAKE) clean_all
pippack: clean_all
rm -rf xgboost-python
cp -r python-package xgboost-python
cp -r Makefile xgboost-python/xgboost/
@ -241,8 +255,7 @@ pippack:
cp -r rabit xgboost-python/xgboost/
# Script to make a clean installable R package.
Rpack:
$(MAKE) clean_all
Rpack: clean_all
rm -rf xgboost xgboost*.tar.gz
cp -r R-package xgboost
rm -rf xgboost/src/*.o xgboost/src/*.so xgboost/src/*.dll
@ -264,13 +277,11 @@ Rpack:
cp xgboost/src/Makevars.in xgboost/src/Makevars.win
sed -i -e 's/@OPENMP_CXXFLAGS@/$$\(SHLIB_OPENMP_CFLAGS\)/g' xgboost/src/Makevars.win
Rbuild:
$(MAKE) Rpack
Rbuild: Rpack
R CMD build --no-build-vignettes xgboost
rm -rf xgboost
Rcheck:
$(MAKE) Rbuild
Rcheck: Rbuild
R CMD check xgboost*.tar.gz
-include build/*.d

View File

@ -235,8 +235,7 @@ def mknfold(dall, nfold, param, seed, evals=(), fpreproc=None, stratified=False,
idx = np.random.permutation(dall.num_row())
else:
idx = np.arange(dall.num_row())
kstep = int(len(idx) / nfold)
idset = [idx[(i * kstep): min(len(idx), (i + 1) * kstep)] for i in range(nfold)]
idset = np.array_split(idx, nfold)
elif folds is not None and isinstance(folds, list):
idset = [x[1] for x in folds]
nfold = len(idset)

View File

@ -75,6 +75,7 @@ struct GBTreeModel {
}
trees.clear();
param.num_trees = 0;
tree_info.clear();
}
}