2019-06-16 19:59:06 +00:00
|
|
|
{ buildPythonPackage
|
2021-05-08 15:17:56 -04:00
|
|
|
, pytestCheckHook
|
|
|
|
, cmake
|
2018-03-14 18:17:55 -07:00
|
|
|
, scipy
|
2019-06-03 18:18:03 +03:00
|
|
|
, scikitlearn
|
2019-07-31 18:29:11 -07:00
|
|
|
, stdenv
|
2018-03-14 18:17:55 -07:00
|
|
|
, xgboost
|
2018-07-19 13:27:22 +02:00
|
|
|
, substituteAll
|
2019-06-03 18:18:03 +03:00
|
|
|
, pandas
|
|
|
|
, matplotlib
|
|
|
|
, graphviz
|
|
|
|
, datatable
|
2021-05-08 15:17:56 -04:00
|
|
|
, hypothesis
|
2018-03-14 18:17:55 -07:00
|
|
|
}:
|
|
|
|
|
2019-08-13 21:52:01 +00:00
|
|
|
buildPythonPackage {
|
2018-06-23 15:27:58 +02:00
|
|
|
pname = "xgboost";
|
2018-03-14 18:17:55 -07:00
|
|
|
inherit (xgboost) version src meta;
|
|
|
|
|
2021-05-08 15:17:56 -04:00
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
buildInputs = [ xgboost ];
|
|
|
|
propagatedBuildInputs = [ scipy ];
|
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
scikitlearn
|
|
|
|
pandas
|
|
|
|
matplotlib
|
|
|
|
graphviz
|
|
|
|
datatable
|
|
|
|
hypothesis
|
2018-07-19 13:27:22 +02:00
|
|
|
];
|
2018-03-14 18:17:55 -07:00
|
|
|
|
2021-05-08 15:17:56 -04:00
|
|
|
# Override existing logic for locating libxgboost.so which is not appropriate for Nix
|
|
|
|
prePatch = let
|
|
|
|
libPath = "${xgboost}/lib/libxgboost${stdenv.hostPlatform.extensions.sharedLibrary}";
|
|
|
|
in ''
|
|
|
|
echo 'find_lib_path = lambda: ["${libPath}"]' > python-package/xgboost/libpath.py
|
|
|
|
'';
|
2018-03-14 18:17:55 -07:00
|
|
|
|
2021-05-08 15:17:56 -04:00
|
|
|
dontUseCmakeConfigure = true;
|
2018-03-14 18:17:55 -07:00
|
|
|
|
2021-05-08 15:17:56 -04:00
|
|
|
postPatch = ''
|
|
|
|
cd python-package
|
|
|
|
'';
|
|
|
|
|
|
|
|
preCheck = ''
|
2018-07-19 13:27:22 +02:00
|
|
|
ln -sf ../demo .
|
2021-05-08 15:17:56 -04:00
|
|
|
ln -s ${xgboost}/bin/xgboost ../xgboost
|
2018-03-14 18:17:55 -07:00
|
|
|
'';
|
2021-05-08 15:17:56 -04:00
|
|
|
|
|
|
|
pytestFlagsArray = ["../tests/python"];
|
|
|
|
disabledTestPaths = [
|
|
|
|
# Requires internet access: https://github.com/dmlc/xgboost/blob/03cd087da180b7dff21bd8ef34997bf747016025/tests/python/test_ranking.py#L81
|
|
|
|
"../tests/python/test_ranking.py"
|
|
|
|
];
|
|
|
|
disabledTests = [
|
|
|
|
"test_cli_binary_classification"
|
|
|
|
"test_model_compatibility"
|
|
|
|
];
|
|
|
|
|
2018-03-14 18:17:55 -07:00
|
|
|
}
|