1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pythonOlder,
6 setuptools,
7 joblib,
8 keras,
9 numpy,
10 pandas,
11 scikit-learn,
12 scipy,
13 tensorflow,
14 threadpoolctl,
15 pytest-xdist,
16 pytestCheckHook,
17}:
18
19buildPythonPackage rec {
20 pname = "imbalanced-learn";
21 version = "0.12.3";
22 pyproject = true;
23
24 disabled = pythonOlder "3.8";
25
26 src = fetchPypi {
27 inherit pname version;
28 hash = "sha256-WwB5agFBnpECvUJeJ8MZ1Y0fbPLfp1HgLtf07fZ8PBs=";
29 };
30
31 nativeBuildInputs = [ setuptools ];
32
33 propagatedBuildInputs = [
34 joblib
35 numpy
36 scikit-learn
37 scipy
38 threadpoolctl
39 ];
40
41 passthru.optional-dependencies = {
42 optional = [
43 keras
44 pandas
45 tensorflow
46 ];
47 };
48
49 pythonImportsCheck = [ "imblearn" ];
50
51 nativeCheckInputs = [
52 pytestCheckHook
53 pandas
54 ];
55
56 preCheck = ''
57 export HOME=$TMPDIR
58 '';
59
60 disabledTestPaths = [
61 # require tensorflow and keras, but we don't want to
62 # add them to nativeCheckInputs just for this tests
63 "imblearn/keras/_generator.py"
64 ];
65
66 meta = with lib; {
67 description = "Library offering a number of re-sampling techniques commonly used in datasets showing strong between-class imbalance";
68 homepage = "https://github.com/scikit-learn-contrib/imbalanced-learn";
69 changelog = "https://github.com/scikit-learn-contrib/imbalanced-learn/releases/tag/${version}";
70 license = licenses.mit;
71 maintainers = [ maintainers.rmcgibbo ];
72 };
73}