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