- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
<分区>
我的 Python 代码涉及 xgboost
库,我现在尝试使用 pyinstaller
制作 exe。环境是:
68 INFO: PyInstaller: 4.0.dev0+8196c57ab
69 INFO: Python: 3.6.9 (conda)
70 INFO: Platform: Windows-10-10.0.17763-SP0
我已经测试过在此环境中从命令行运行 .py。
我在环境中找到相关文件:dll
、VERSION
和文件夹,并手动添加它们:(在this 之后)(我将命令分解为新行以提高可读性)
(py36_PP) C:\Users\MarkZ\G_project\Model>pyinstaller PPP_2_main.py -F
--add-data "C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\envs\py36_PP\Lib\site-packages\xgboost\*;xgboost/"
--add-data "C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\envs\py36_PP\Lib\site-packages\xgboost\VERSION;xgboost/"
--add-data "C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\envs\py36_PP\Library\mingw-w64\bin\xgboost.dll;xgboost/"
我是如何找到这些路径的:
在python中导入这个库并查看它的属性
(py36_PP) C:\Users\MarkZ\GRS-PP-churn-project\Model>python
Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 14:00:49) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import xgboost
>>> print(xgboost.__file__)
C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\envs\py36_PP\lib\site-packages\xgboost\__init__.py
搜索:
(base) C:\Users\MarkZ\AppData\Local\Continuum\anaconda3>dir /s *xgboost*
Volume in drive C is OSDisk
Volume Serial Number is F0FE-4464
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\conda-meta
09/16/2019 01:58 PM 11,072 libxgboost-0.90-0.json
09/16/2019 01:58 PM 11,048 py-xgboost-0.90-py37_0.json
09/16/2019 01:58 PM 1,134 _py-xgboost-mutex-2.0-cpu_0.json
3 File(s) 23,254 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\envs\py36_PP\conda-meta
09/27/2019 01:45 AM 11,022 libxgboost-0.90-0.json
09/27/2019 01:45 AM 10,998 py-xgboost-0.90-py36_0.json
09/27/2019 01:45 AM 1,084 _py-xgboost-mutex-2.0-cpu_0.json
3 File(s) 23,104 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\envs\py36_PP\Lib\site-packages
09/27/2019 01:45 AM <DIR> xgboost
0 File(s) 0 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\envs\py36_PP\Library\mingw-w64\bin
06/07/2019 02:23 PM 4,128,032 xgboost.dll
06/07/2019 02:23 PM 4,218,018 xgboost.exe
2 File(s) 8,346,050 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\envs\py36_PP\Library\mingw-w64\include
09/27/2019 01:45 AM <DIR> xgboost
0 File(s) 0 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\envs\py36_PP\Library\mingw-w64\lib
06/07/2019 02:23 PM 7,035,268 libxgboost.a
1 File(s) 7,035,268 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\Lib\site-packages
09/16/2019 01:58 PM <DIR> xgboost
0 File(s) 0 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\Library\mingw-w64\bin
06/07/2019 02:23 PM 4,128,032 xgboost.dll
06/07/2019 02:23 PM 4,218,018 xgboost.exe
2 File(s) 8,346,050 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\Library\mingw-w64\include
09/16/2019 01:58 PM <DIR> xgboost
0 File(s) 0 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\Library\mingw-w64\lib
06/07/2019 02:23 PM 7,035,268 libxgboost.a
1 File(s) 7,035,268 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\pkgs
09/27/2019 01:45 AM <DIR> libxgboost-0.90-0
09/16/2019 01:58 PM 1,913,797 libxgboost-0.90-0.conda
09/27/2019 01:45 AM 4,050,208 libxgboost-0.90-0.tar.bz2
09/27/2019 01:45 AM <DIR> py-xgboost-0.90-py36_0
09/27/2019 01:45 AM 78,382 py-xgboost-0.90-py36_0.tar.bz2
09/16/2019 01:58 PM <DIR> py-xgboost-0.90-py37_0
09/16/2019 01:58 PM 76,618 py-xgboost-0.90-py37_0.conda
09/27/2019 01:45 AM <DIR> _py-xgboost-mutex-2.0-cpu_0
09/16/2019 01:58 PM 9,208 _py-xgboost-mutex-2.0-cpu_0.conda
09/27/2019 01:45 AM 9,140 _py-xgboost-mutex-2.0-cpu_0.tar.bz2
6 File(s) 6,137,353 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\pkgs\libxgboost-0.90-0\info\recipe
05/28/2019 11:57 AM 959 install-libxgboost.sh
1 File(s) 959 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\pkgs\libxgboost-0.90-0\info\recipe\parent
06/06/2019 04:41 PM 2,814 0001-conda-Unbundle-libxgboost.-dll-dylib-so.patch
05/28/2019 11:57 AM 959 install-libxgboost.sh
05/28/2019 11:57 AM 159 install-py-xgboost.sh
06/07/2019 02:06 PM 292 install-r-xgboost.sh
05/28/2019 11:57 AM 736 test-py-xgboost.py
05/28/2019 11:57 AM 1,601 test-r-xgboost.r
6 File(s) 6,561 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\pkgs\libxgboost-0.90-0\Library\mingw-w64\bin
06/07/2019 02:23 PM 4,128,032 xgboost.dll
06/07/2019 02:23 PM 4,218,018 xgboost.exe
2 File(s) 8,346,050 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\pkgs\libxgboost-0.90-0\Library\mingw-w64\include
09/27/2019 01:45 AM <DIR> xgboost
0 File(s) 0 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\pkgs\libxgboost-0.90-0\Library\mingw-w64\lib
06/07/2019 02:23 PM 7,035,268 libxgboost.a
1 File(s) 7,035,268 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\pkgs\py-xgboost-0.90-py36_0\info\recipe
05/28/2019 11:57 AM 159 install-py-xgboost.sh
1 File(s) 159 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\pkgs\py-xgboost-0.90-py36_0\info\recipe\parent
06/06/2019 04:41 PM 2,814 0001-conda-Unbundle-libxgboost.-dll-dylib-so.patch
05/28/2019 11:57 AM 959 install-libxgboost.sh
05/28/2019 11:57 AM 159 install-py-xgboost.sh
06/07/2019 02:06 PM 292 install-r-xgboost.sh
05/28/2019 11:57 AM 736 test-py-xgboost.py
05/28/2019 11:57 AM 1,601 test-r-xgboost.r
6 File(s) 6,561 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\pkgs\py-xgboost-0.90-py36_0\Lib\site-packages
09/27/2019 01:45 AM <DIR> xgboost
0 File(s) 0 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\pkgs\py-xgboost-0.90-py37_0\info\recipe
05/28/2019 11:57 AM 159 install-py-xgboost.sh
1 File(s) 159 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\pkgs\py-xgboost-0.90-py37_0\info\recipe\parent
06/06/2019 04:41 PM 2,814 0001-conda-Unbundle-libxgboost.-dll-dylib-so.patch
05/28/2019 11:57 AM 959 install-libxgboost.sh
05/28/2019 11:57 AM 159 install-py-xgboost.sh
06/07/2019 02:06 PM 292 install-r-xgboost.sh
05/28/2019 11:57 AM 736 test-py-xgboost.py
05/28/2019 11:57 AM 1,601 test-r-xgboost.r
6 File(s) 6,561 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\pkgs\py-xgboost-0.90-py37_0\Lib\site-packages
09/16/2019 01:58 PM <DIR> xgboost
0 File(s) 0 bytes
Directory of C:\Users\MarkZ\AppData\Local\Continuum\anaconda3\pkgs\_py-xgboost-mutex-2.0-cpu_0\info\recipe\parent
06/28/2018 06:15 PM 2,500 0001-conda-Unbundle-libxgboost.-dll-dylib-so.patch
06/28/2018 06:15 PM 959 install-libxgboost.sh
06/28/2018 06:15 PM 159 install-py-xgboost.sh
06/28/2018 06:15 PM 521 install-r-xgboost.sh
06/28/2018 06:15 PM 736 test-py-xgboost.py
06/28/2018 06:15 PM 1,601 test-r-xgboost.r
6 File(s) 6,476 bytes
Total Files Listed:
48 File(s) 52,355,101 bytes
11 Dir(s) 34,365,415,424 bytes free
它仍然无法加载 xgboost:
(py36_PP) C:\Users\MarkZ\G_project\Model>dist\PPP_2_main
Traceback (most recent call last):
File "PPP_2_main.py", line 28, in <module>
import xgboost as xgb
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "c:\users\MarkZ\appdata\local\continuum\anaconda3\envs\py36_pp\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\xgboost\__init__.py", line 11, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "c:\users\MarkZ\appdata\local\continuum\anaconda3\envs\py36_pp\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\xgboost\core.py", line 161, in <module>
File "site-packages\xgboost\core.py", line 123, in _load_lib
File "site-packages\xgboost\libpath.py", line 52, in find_lib_path
xgboost.libpath.XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path?
List of candidates:
C:\Users\MarkZ\AppData\Local\Temp\_MEI234002\Library\mingw-w64\bin\xgboost.dll
C:\Users\MarkZ\AppData\Local\Temp\_MEI234002\xgboost\../../windows/x64/Release/xgboost.dll
C:\Users\MarkZ\AppData\Local\Temp\_MEI234002\xgboost\./windows/x64/Release/xgboost.dll
[18264] Failed to execute script PPP_2_main
看起来 pyinstaller
找不到 xgboost
- 我应该添加到 VERSION
文件或 dll
的路径吗?
是否可以计算 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 选择一个变量,而不是为了点头,因为它是算法的经典版本,但它可以忍受)。但是对于回归,似乎只使用了森林中的一棵
我是一名优秀的程序员,十分优秀!