1{
2 lib,
3 isPy27,
4 buildPythonPackage,
5 fetchFromGitHub,
6 fetchpatch,
7 setuptools,
8 scikit-learn,
9 pytestCheckHook,
10 pytest-randomly,
11}:
12
13buildPythonPackage rec {
14 pname = "mlrose";
15 version = "1.3.0";
16 pyproject = true;
17 disabled = isPy27;
18
19 src = fetchFromGitHub {
20 owner = "gkhayes";
21 repo = "mlrose";
22 rev = "v${version}";
23 sha256 = "1dn43k3rcypj58ymcj849b37w66jz7fphw8842v6mlbij3x0rxfl";
24 };
25
26 patches = [
27 # Fixes compatibility with scikit-learn 0.24.1
28 (fetchpatch {
29 url = "https://github.com/gkhayes/mlrose/pull/55/commits/19caf8616fc194402678aa67917db334ad02852a.patch";
30 sha256 = "1nivz3bn21nd21bxbcl16a6jmy7y5j8ilz90cjmd0xq4v7flsahf";
31 })
32 ];
33
34 build-system = [ setuptools ];
35 dependencies = [ scikit-learn ];
36 nativeCheckInputs = [
37 pytest-randomly
38 pytestCheckHook
39 ];
40
41 postPatch = ''
42 substituteInPlace setup.py --replace-fail sklearn scikit-learn
43 '';
44
45 pythonImportsCheck = [ "mlrose" ];
46
47 # Fix random seed during tests
48 pytestFlags = [ "--randomly-seed=0" ];
49
50 meta = with lib; {
51 description = "Machine Learning, Randomized Optimization and SEarch";
52 homepage = "https://github.com/gkhayes/mlrose";
53 license = licenses.bsd3;
54 maintainers = [ ];
55 };
56}