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