- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在尝试在 Mac 上安装 xgboost。我按照 github 上的说明进行操作,但是当我运行 make -j4
时出现错误:
c++ -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -DDISABLE_OPENMP -o xgboost build/cli_main.o build/learner.o build/logging.o build/c_api/c_api.o build/c_api/c_api_error.o build/common/common.o build/data/data.o build/data/simple_csr_source.o build/data/simple_dmatrix.o build/data/sparse_page_dmatrix.o build/data/sparse_page_raw_format.o build/data/sparse_page_source.o build/data/sparse_page_writer.o build/gbm/gblinear.o build/gbm/gbm.o build/gbm/gbtree.o build/metric/elementwise_metric.o build/metric/metric.o build/metric/multiclass_metric.o build/metric/rank_metric.o build/objective/multiclass_obj.o build/objective/objective.o build/objective/rank_obj.o build/objective/regression_obj.o build/tree/tree_model.o build/tree/tree_updater.o build/tree/updater_colmaker.o build/tree/updater_histmaker.o build/tree/updater_prune.o build/tree/updater_refresh.o build/tree/updater_skmaker.o build/tree/updater_sync.o dmlc-core/libdmlc.a rabit/lib/librabit_empty.a -pthread -lm
ar crv lib/libxgboost.a
c++ -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -DDISABLE_OPENMP -shared -o lib/libxgboost.so build/learner.o build/logging.o build/c_api/c_api.o build/c_api/c_api_error.o build/common/common.o build/data/data.o build/data/simple_csr_source.o build/data/simple_dmatrix.o build/data/sparse_page_dmatrix.o build/data/sparse_page_raw_format.o build/data/sparse_page_source.o build/data/sparse_page_writer.o build/gbm/gblinear.o build/gbm/gbm.o build/gbm/gbtree.o build/metric/elementwise_metric.o build/metric/metric.o build/metric/multiclass_metric.o build/metric/rank_metric.o build/objective/multiclass_obj.o build/objective/objective.o build/objective/rank_obj.o build/objective/regression_obj.o build/tree/tree_model.o build/tree/tree_updater.o build/tree/updater_colmaker.o build/tree/updater_histmaker.o build/tree/updater_prune.o build/tree/updater_refresh.o build/tree/updater_skmaker.o build/tree/updater_sync.o dmlc-core/libdmlc.a rabit/lib/librabit_empty.a -pthread -lm
ar: no archive members specified
usage: ar -d [-TLsv] archive file ...
ar -m [-TLsv] archive file ...
ar -m [-abiTLsv] position archive file ...
ar -p [-TLsv] archive [file ...]
ar -q [-cTLsv] archive file ...
ar -r [-cuTLsv] archive file ...
ar -r [-abciuTLsv] position archive file ...
ar -t [-TLsv] archive [file ...]
ar -x [-ouTLsv] archive [file ...]
make: *** [lib/libxgboost.a] Error 1
make: *** Waiting for unfinished jobs....
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
如果我只运行make
(没有-j4
)我得到:
$ make
ar crv lib/libxgboost.a
ar: no archive members specified
usage: ar -d [-TLsv] archive file ...
ar -m [-TLsv] archive file ...
ar -m [-abiTLsv] position archive file ...
ar -p [-TLsv] archive [file ...]
ar -q [-cTLsv] archive file ...
ar -r [-cuTLsv] archive file ...
ar -r [-abciuTLsv] position archive file ...
ar -t [-TLsv] archive [file ...]
ar -x [-ouTLsv] archive [file ...]
make: *** [lib/libxgboost.a] Error 1
知道是什么原因造成的,我该如何解决?
虽然我可能是错的,但我认为是因为 mac 上的存档实用程序 ar
太旧(从 2005 年开始):
$ man ar
AR(1) BSD General Commands Manual AR(1)
NAME
ar -- create and maintain library archives
SYNOPSIS
...
...
Darwin July 27, 2005 Darwin
关于如何将 ar
更新到 OS X 上的最新版本有什么想法吗?
这是供您引用的 makefile:
ifndef config
ifneq ("$(wildcard ./config.mk)","")
config = config.mk
else
config = make/config.mk
endif
endif
ifndef DMLC_CORE
DMLC_CORE = dmlc-core
endif
ifndef RABIT
RABIT = rabit
endif
ROOTDIR = $(CURDIR)
ifeq ($(OS), Windows_NT)
UNAME="Windows"
else
UNAME=$(shell uname)
endif
include $(config)
ifeq ($(USE_OPENMP), 0)
export NO_OPENMP = 1
endif
include $(DMLC_CORE)/make/dmlc.mk
# include the plugins
include $(XGB_PLUGINS)
# use customized config file
ifndef CC
export CC = $(if $(shell which gcc-5),gcc-5,gcc)
endif
ifndef CXX
export CXX = $(if $(shell which g++-5),g++-5,g++)
endif
export LDFLAGS= -pthread -lm $(ADD_LDFLAGS) $(DMLC_LDFLAGS) $(PLUGIN_LDFLAGS)
export CFLAGS= -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude $(ADD_CFLAGS) $(PLUGIN_CFLAGS)
CFLAGS += -I$(DMLC_CORE)/include -I$(RABIT)/include
#java include path
export JAVAINCFLAGS = -I${JAVA_HOME}/include -I./java
ifndef LINT_LANG
LINT_LANG= "all"
endif
ifneq ($(UNAME), Windows)
CFLAGS += -fPIC
XGBOOST_DYLIB = lib/libxgboost.so
else
XGBOOST_DYLIB = lib/libxgboost.dll
endif
ifeq ($(UNAME), Linux)
LDFLAGS += -lrt
JAVAINCFLAGS += -I${JAVA_HOME}/include/linux
endif
ifeq ($(UNAME), Darwin)
JAVAINCFLAGS += -I${JAVA_HOME}/include/darwin
endif
ifeq ($(USE_OPENMP), 1)
CFLAGS += -fopenmp
else
CFLAGS += -DDISABLE_OPENMP
endif
# specify tensor path
.PHONY: clean all lint clean_all doxygen rcpplint pypack Rpack Rbuild Rcheck java
all: lib/libxgboost.a $(XGBOOST_DYLIB) xgboost
$(DMLC_CORE)/libdmlc.a: $(wildcard $(DMLC_CORE)/src/*.cc $(DMLC_CORE)/src/*/*.cc)
+ cd $(DMLC_CORE); make libdmlc.a config=$(ROOTDIR)/$(config); cd $(ROOTDIR)
$(RABIT)/lib/$(LIB_RABIT): $(wildcard $(RABIT)/src/*.cc)
+ cd $(RABIT); make lib/$(LIB_RABIT); cd $(ROOTDIR)
jvm: jvm-packages/lib/libxgboost4j.so
SRC = $(wildcard src/*.cc src/*/*.cc)
ALL_OBJ = $(patsubst src/%.cc, build/%.o, $(SRC)) $(PLUGIN_OBJS)
AMALGA_OBJ = amalgamation/xgboost-all0.o
LIB_DEP = $(DMLC_CORE)/libdmlc.a $(RABIT)/lib/$(LIB_RABIT)
ALL_DEP = $(filter-out build/cli_main.o, $(ALL_OBJ)) $(LIB_DEP)
CLI_OBJ = build/cli_main.o
build/%.o: src/%.cc
@mkdir -p $(@D)
$(CXX) $(CFLAGS) -MM -MT build/$*.o $< >build/$*.d
$(CXX) -c $(CFLAGS) -c $< -o $@
build_plugin/%.o: plugin/%.cc
@mkdir -p $(@D)
$(CXX) $(CFLAGS) -MM -MT build_plugin/$*.o $< >build_plugin/$*.d
$(CXX) -c $(CFLAGS) -c $< -o $@
# The should be equivalent to $(ALL_OBJ) except for build/cli_main.o
amalgamation/xgboost-all0.o: amalgamation/xgboost-all0.cc
$(CXX) -c $(CFLAGS) -c $< -o $@
# Equivalent to lib/libxgboost_all.so
lib/libxgboost_all.so: $(AMALGA_OBJ) $(LIB_DEP)
@mkdir -p $(@D)
$(CXX) $(CFLAGS) -shared -o $@ $(filter %.o %.a, $^) $(LDFLAGS)
lib/libxgboost.a: $(ALL_DEP)
@mkdir -p $(@D)
ar crv $@ $(filter %.o, $?)
lib/libxgboost.dll lib/libxgboost.so: $(ALL_DEP)
@mkdir -p $(@D)
$(CXX) $(CFLAGS) -shared -o $@ $(filter %.o %a, $^) $(LDFLAGS)
jvm-packages/lib/libxgboost4j.so: jvm-packages/xgboost4j/src/native/xgboost4j.cpp $(ALL_DEP)
@mkdir -p $(@D)
$(CXX) $(CFLAGS) $(JAVAINCFLAGS) -shared -o $@ $(filter %.cpp %.o %.a, $^) $(LDFLAGS)
xgboost: $(CLI_OBJ) $(ALL_DEP)
$(CXX) $(CFLAGS) -o $@ $(filter %.o %.a, $^) $(LDFLAGS)
rcpplint:
python2 dmlc-core/scripts/lint.py xgboost ${LINT_LANG} R-package/src
lint: rcpplint
python2 dmlc-core/scripts/lint.py xgboost ${LINT_LANG} include src plugin
clean:
$(RM) -rf build build_plugin lib bin *~ */*~ */*/*~ */*/*/*~ */*.o */*/*.o */*/*/*.o xgboost
clean_all: clean
cd $(DMLC_CORE); make clean; cd $(ROODIR)
cd $(RABIT); make clean; cd $(ROODIR)
doxygen:
doxygen doc/Doxyfile
# create standalone python tar file.
pypack: ${XGBOOST_DYLIB}
pypack: ${XGBOOST_DYLIB}
cp ${XGBOOST_DYLIB} python-package/xgboost
cd python-package; tar cf xgboost.tar xgboost; cd ..
# Script to make a clean installable R package.
Rpack:
make clean_all
rm -rf xgboost xgboost*.tar.gz
cp -r R-package xgboost
rm -rf xgboost/src/*.o xgboost/src/*.so xgboost/src/*.dll
rm -rf xgboost/src/*/*.o
rm -rf xgboost/demo/*.model xgboost/demo/*.buffer xgboost/demo/*.txt
rm -rf xgboost/demo/runall.R
cp -r src xgboost/src/src
cp -r include xgboost/src/include
cp -r amalgamation xgboost/src/amalgamation
mkdir -p xgboost/src/rabit
cp -r rabit/include xgboost/src/rabit/include
cp -r rabit/src xgboost/src/rabit/src
rm -rf xgboost/src/rabit/src/*.o
mkdir -p xgboost/src/dmlc-core
cp -r dmlc-core/include xgboost/src/dmlc-core/include
cp -r dmlc-core/src xgboost/src/dmlc-core/src
cp ./LICENSE xgboost
cat R-package/src/Makevars|sed '2s/.*/PKGROOT=./' | sed '3s/.*/ENABLE_STD_THREAD=0/' > xgboost/src/Makevars
cp xgboost/src/Makevars xgboost/src/Makevars.win
Rbuild:
make Rpack
R CMD build --no-build-vignettes xgboost
rm -rf xgboost
Rcheck:
make Rbuild
R CMD check xgboost*.tar.gz
-include build/*.d
-include build/*/*.d
-include build_plugin/*/*.d
非常感谢。
最佳答案
brew install clang-omp
export CC=clang-omp
export CXX=clang-omp++
cd python-package
sudo python setup.py install
pip install xgboost
关于c++ - 在 Mac 上安装 xgboost 失败 - ar : no archive members specified,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36040973/
是否可以计算 xgboost 模型的内部节点预测? R 包 gbm 提供了对每棵树的内部节点的预测。 然而,xgboost 输出仅显示对模型最后一片叶子的预测。 xgboost 输出: 请注意,质量列
我想知道哪个损失函数使用 XGBoost 进行多类分类。我找到了 in this question二元情况下逻辑分类的损失函数。 我认为对于多类情况,它可能与 GBM 中的相同(对于 K 类)whic
XGBoost 使用加法训练的方法,在该方法中对先前模型的残差进行建模。 虽然这是顺序的,那么它如何并行计算呢? 最佳答案 Xgboost 不会像您提到的那样并行运行多棵树,您需要在每棵树之后进行预测
我正在看下面的图片。 有人可以解释一下它们是如何计算的吗?我以为 N 是 -1,是 +1,但后来我不明白这个小女孩怎么有 0.1。但这对于树 2 也不起作用。 最佳答案 我同意@user1808924
我已经使用 Amazon Sagemaker 构建了一个 XGBoost 模型,但是我找不到任何可以帮助我解释模型并验证它是否学习了正确的依赖关系的东西。 通常,我们可以通过 python API (
这是我的代码: xgb <- xgboost(data = as.matrix(df_all_combined), label = as.matrix(target_tr
在 xgboost 中可以设置参数 weight对于 DMatrix .这显然是一个权重列表,其中每个值都是相应样本的权重。 我找不到有关这些权重如何在梯度提升过程中实际使用的任何信息。他们是否与 e
不工作: import warnings warnings.filterwarnings('ignore') 我得到的警告: [14:24:45] WARNING: C:/Jenkins/worksp
我有一个用 Python 训练的 XGBoost 二元分类器模型。 我想在不同的脚本环境 (MQL4) 中使用纯数学运算而不使用 XGBoost 库 (.predict) 从该模型生成新输入数据的输出
我有一个仅包含分类特征和分类标签的数据模型。 因此,当我在 XGBoost 中手动构建该模型时,我基本上会将特征转换为二进制列(使用 LabelEncoder 和 OneHotEncoder),并使用
我使用 XGBoost 的 python 实现。目标之一是rank:pairwise并且最小化成对损失( Documentation )。但是,它没有说明输出的范围。我看到 -10 到 10 之间的数
我遇到了一个奇怪的问题: 我通过 hyperopt 定义了我的 XGB 超参数 'max_depth' hp.choice('max_depth',range(2,20)) 但我得到了 'max_de
我是 R 编程语言新手,我需要运行“xgboost”进行一些实验。问题是我需要交叉验证模型并获得准确性,我发现两种方法可以给我不同的结果: 使用“插入符号”: library(mlbench) lib
选择 auc、error 或 logloss 作为 XGBoost 的 eval_metric 对其性能有何影响?假设数据不平衡。它如何影响准确度、召回率和精确度? 最佳答案 在不同的评估矩阵 之间进
我是 Python 中 XGBoost 的新手,所以如果这里的答案很明显,我深表歉意,但我正在尝试使用 panda 数据框并在 Python 中获取 XGBoost 来给我使用 Scikit-Lear
我知道您可以为不平衡的数据集设置 scale_pos_weight。然而,如何处理不平衡数据集中的多分类问题。我经历过https://datascience.stackexchange.com/que
我正在使用 xgboost 的功能 pred_contribs 以便为我的模型的每个样本获得某种可解释性(shapley 值)。 booster.predict(test, pred_contribs
在 xgboost 0.81 中 cox ph 生存模型的新实现中,如何指定事件的开始和结束时间? 谢谢 例如,R 等效函数是: cph_mod = coxph(Surv(Start, Stop, S
我正在 R 中建模 claim 频率(泊松分布)。我正在使用 gbm和 xgboost包,但似乎xgboost没有将曝光考虑在内的偏移参数? 在 gbm ,人们会按如下方式考虑暴露: gbm.fit(
xgboost 包允许构建一个随机森林(实际上,它选择列的随机子集来为整棵树的 split 选择一个变量,而不是为了点头,因为它是算法的经典版本,但它可以忍受)。但是对于回归,似乎只使用了森林中的一棵
我是一名优秀的程序员,十分优秀!