Source file utils.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils"
let get_py name = Py.Module.get ns name
module Bunch = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ?kwargs () =
Py.Module.get_function_with_keywords ns "Bunch"
[||]
(match kwargs with None -> [] | Some x -> x)
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
module Path = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ?kwargs args =
Py.Module.get_function_with_keywords ns "Path"
(Wrap_utils.pos_arg Wrap_utils.id args)
(match kwargs with None -> [] | Some x -> x)
let absolute self =
Py.Module.get_function_with_keywords self "absolute"
[||]
[]
let as_posix self =
Py.Module.get_function_with_keywords self "as_posix"
[||]
[]
let as_uri self =
Py.Module.get_function_with_keywords self "as_uri"
[||]
[]
let chmod ~mode self =
Py.Module.get_function_with_keywords self "chmod"
[||]
(Wrap_utils.keyword_args [("mode", Some(mode ))])
let cwd self =
Py.Module.get_function_with_keywords self "cwd"
[||]
[]
let exists self =
Py.Module.get_function_with_keywords self "exists"
[||]
[]
let expanduser self =
Py.Module.get_function_with_keywords self "expanduser"
[||]
[]
let glob ~pattern self =
Py.Module.get_function_with_keywords self "glob"
[||]
(Wrap_utils.keyword_args [("pattern", Some(pattern ))])
let group self =
Py.Module.get_function_with_keywords self "group"
[||]
[]
let home self =
Py.Module.get_function_with_keywords self "home"
[||]
[]
let is_absolute self =
Py.Module.get_function_with_keywords self "is_absolute"
[||]
[]
let is_block_device self =
Py.Module.get_function_with_keywords self "is_block_device"
[||]
[]
let is_char_device self =
Py.Module.get_function_with_keywords self "is_char_device"
[||]
[]
let is_dir self =
Py.Module.get_function_with_keywords self "is_dir"
[||]
[]
let is_fifo self =
Py.Module.get_function_with_keywords self "is_fifo"
[||]
[]
let is_file self =
Py.Module.get_function_with_keywords self "is_file"
[||]
[]
let is_mount self =
Py.Module.get_function_with_keywords self "is_mount"
[||]
[]
let is_reserved self =
Py.Module.get_function_with_keywords self "is_reserved"
[||]
[]
let is_socket self =
Py.Module.get_function_with_keywords self "is_socket"
[||]
[]
let is_symlink self =
Py.Module.get_function_with_keywords self "is_symlink"
[||]
[]
let iterdir self =
Py.Module.get_function_with_keywords self "iterdir"
[||]
[]
let joinpath args self =
Py.Module.get_function_with_keywords self "joinpath"
(Wrap_utils.pos_arg Wrap_utils.id args)
[]
let lchmod ~mode self =
Py.Module.get_function_with_keywords self "lchmod"
[||]
(Wrap_utils.keyword_args [("mode", Some(mode ))])
let lstat self =
Py.Module.get_function_with_keywords self "lstat"
[||]
[]
let match_ ~path_pattern self =
Py.Module.get_function_with_keywords self "match"
[||]
(Wrap_utils.keyword_args [("path_pattern", Some(path_pattern ))])
let mkdir ?mode ?parents ?exist_ok self =
Py.Module.get_function_with_keywords self "mkdir"
[||]
(Wrap_utils.keyword_args [("mode", mode); ("parents", parents); ("exist_ok", exist_ok)])
let open_ ?mode ?buffering ?encoding ?errors ?newline self =
Py.Module.get_function_with_keywords self "open"
[||]
(Wrap_utils.keyword_args [("mode", mode); ("buffering", buffering); ("encoding", encoding); ("errors", errors); ("newline", newline)])
let owner self =
Py.Module.get_function_with_keywords self "owner"
[||]
[]
let read_bytes self =
Py.Module.get_function_with_keywords self "read_bytes"
[||]
[]
let read_text ?encoding ?errors self =
Py.Module.get_function_with_keywords self "read_text"
[||]
(Wrap_utils.keyword_args [("encoding", encoding); ("errors", errors)])
let relative_to other self =
Py.Module.get_function_with_keywords self "relative_to"
(Wrap_utils.pos_arg Wrap_utils.id other)
[]
let rename ~target self =
Py.Module.get_function_with_keywords self "rename"
[||]
(Wrap_utils.keyword_args [("target", Some(target ))])
let replace ~target self =
Py.Module.get_function_with_keywords self "replace"
[||]
(Wrap_utils.keyword_args [("target", Some(target ))])
let resolve ?strict self =
Py.Module.get_function_with_keywords self "resolve"
[||]
(Wrap_utils.keyword_args [("strict", strict)])
let rglob ~pattern self =
Py.Module.get_function_with_keywords self "rglob"
[||]
(Wrap_utils.keyword_args [("pattern", Some(pattern ))])
let rmdir self =
Py.Module.get_function_with_keywords self "rmdir"
[||]
[]
let samefile ~other_path self =
Py.Module.get_function_with_keywords self "samefile"
[||]
(Wrap_utils.keyword_args [("other_path", Some(other_path ))])
let stat self =
Py.Module.get_function_with_keywords self "stat"
[||]
[]
let symlink_to ?target_is_directory ~target self =
Py.Module.get_function_with_keywords self "symlink_to"
[||]
(Wrap_utils.keyword_args [("target_is_directory", target_is_directory); ("target", Some(target ))])
let touch ?mode ?exist_ok self =
Py.Module.get_function_with_keywords self "touch"
[||]
(Wrap_utils.keyword_args [("mode", mode); ("exist_ok", exist_ok)])
let unlink self =
Py.Module.get_function_with_keywords self "unlink"
[||]
[]
let with_name ~name self =
Py.Module.get_function_with_keywords self "with_name"
[||]
(Wrap_utils.keyword_args [("name", Some(name ))])
let with_suffix ~suffix self =
Py.Module.get_function_with_keywords self "with_suffix"
[||]
(Wrap_utils.keyword_args [("suffix", Some(suffix ))])
let write_bytes ~data self =
Py.Module.get_function_with_keywords self "write_bytes"
[||]
(Wrap_utils.keyword_args [("data", Some(data ))])
let write_text ?encoding ?errors ~data self =
Py.Module.get_function_with_keywords self "write_text"
[||]
(Wrap_utils.keyword_args [("encoding", encoding); ("errors", errors); ("data", Some(data ))])
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
let all_estimators ?include_meta_estimators ?include_other ?type_filter ?include_dont_test () =
Py.Module.get_function_with_keywords ns "all_estimators"
[||]
(Wrap_utils.keyword_args [("include_meta_estimators", Wrap_utils.Option.map include_meta_estimators Py.Bool.of_bool); ("include_other", Wrap_utils.Option.map include_other Py.Bool.of_bool); ("type_filter", Wrap_utils.Option.map type_filter (function
| `S x -> Py.String.of_string x
| `StringList x -> (Py.List.of_list_map Py.String.of_string) x
)); ("include_dont_test", Wrap_utils.Option.map include_dont_test Py.Bool.of_bool)])
module Arrayfuncs = struct
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils.arrayfuncs"
let get_py name = Py.Module.get ns name
let cholesky_delete ~l ~go_out () =
Py.Module.get_function_with_keywords ns "cholesky_delete"
[||]
(Wrap_utils.keyword_args [("L", Some(l )); ("go_out", Some(go_out ))])
end
let as_float_array ?copy ?force_all_finite ~x () =
Py.Module.get_function_with_keywords ns "as_float_array"
[||]
(Wrap_utils.keyword_args [("copy", Wrap_utils.Option.map copy Py.Bool.of_bool); ("force_all_finite", Wrap_utils.Option.map force_all_finite (function
| `Bool x -> Py.Bool.of_bool x
| `Allow_nan -> Py.String.of_string "allow-nan"
)); ("X", Some(x |> Arr.to_pyobject))])
|> Arr.of_pyobject
let assert_all_finite ?allow_nan ~x () =
Py.Module.get_function_with_keywords ns "assert_all_finite"
[||]
(Wrap_utils.keyword_args [("allow_nan", Wrap_utils.Option.map allow_nan Py.Bool.of_bool); ("X", Some(x |> Arr.to_pyobject))])
let axis0_safe_slice ~x ~mask ~len_mask () =
Py.Module.get_function_with_keywords ns "axis0_safe_slice"
[||]
(Wrap_utils.keyword_args [("X", Some(x |> Arr.to_pyobject)); ("mask", Some(mask |> Arr.to_pyobject)); ("len_mask", Some(len_mask |> Py.Int.of_int))])
let check_X_y ?accept_sparse ?accept_large_sparse ?dtype ?order ?copy ?force_all_finite ?ensure_2d ?allow_nd ?multi_output ?ensure_min_samples ?ensure_min_features ?y_numeric ?warn_on_dtype ?estimator ~x ~y () =
Py.Module.get_function_with_keywords ns "check_X_y"
[||]
(Wrap_utils.keyword_args [("accept_sparse", Wrap_utils.Option.map accept_sparse (function
| `S x -> Py.String.of_string x
| `Bool x -> Py.Bool.of_bool x
| `StringList x -> (Py.List.of_list_map Py.String.of_string) x
)); ("accept_large_sparse", Wrap_utils.Option.map accept_large_sparse Py.Bool.of_bool); ("dtype", Wrap_utils.Option.map dtype (function
| `S x -> Py.String.of_string x
| `Dtype x -> Wrap_utils.id x
| `TypeList x -> Wrap_utils.id x
| `None -> Py.none
)); ("order", Wrap_utils.Option.map order (function
| `F -> Py.String.of_string "F"
| `C -> Py.String.of_string "C"
)); ("copy", Wrap_utils.Option.map copy Py.Bool.of_bool); ("force_all_finite", Wrap_utils.Option.map force_all_finite (function
| `Bool x -> Py.Bool.of_bool x
| `Allow_nan -> Py.String.of_string "allow-nan"
)); ("ensure_2d", Wrap_utils.Option.map ensure_2d Py.Bool.of_bool); ("allow_nd", Wrap_utils.Option.map allow_nd Py.Bool.of_bool); ("multi_output", Wrap_utils.Option.map multi_output Py.Bool.of_bool); ("ensure_min_samples", Wrap_utils.Option.map ensure_min_samples Py.Int.of_int); ("ensure_min_features", Wrap_utils.Option.map ensure_min_features Py.Int.of_int); ("y_numeric", Wrap_utils.Option.map y_numeric Py.Bool.of_bool); ("warn_on_dtype", Wrap_utils.Option.map warn_on_dtype Py.Bool.of_bool); ("estimator", Wrap_utils.Option.map estimator (function
| `S x -> Py.String.of_string x
| `Estimator x -> Wrap_utils.id x
)); ("X", Some(x |> Arr.to_pyobject)); ("y", Some(y |> Arr.to_pyobject))])
|> (fun x -> ((Wrap_utils.id (Py.Tuple.get x 0)), (Wrap_utils.id (Py.Tuple.get x 1))))
let check_array ?accept_sparse ?accept_large_sparse ?dtype ?order ?copy ?force_all_finite ?ensure_2d ?allow_nd ?ensure_min_samples ?ensure_min_features ?warn_on_dtype ?estimator ~array () =
Py.Module.get_function_with_keywords ns "check_array"
[||]
(Wrap_utils.keyword_args [("accept_sparse", Wrap_utils.Option.map accept_sparse (function
| `S x -> Py.String.of_string x
| `Bool x -> Py.Bool.of_bool x
| `StringList x -> (Py.List.of_list_map Py.String.of_string) x
)); ("accept_large_sparse", Wrap_utils.Option.map accept_large_sparse Py.Bool.of_bool); ("dtype", Wrap_utils.Option.map dtype (function
| `S x -> Py.String.of_string x
| `Dtype x -> Wrap_utils.id x
| `TypeList x -> Wrap_utils.id x
| `None -> Py.none
)); ("order", Wrap_utils.Option.map order (function
| `F -> Py.String.of_string "F"
| `C -> Py.String.of_string "C"
)); ("copy", Wrap_utils.Option.map copy Py.Bool.of_bool); ("force_all_finite", Wrap_utils.Option.map force_all_finite (function
| `Bool x -> Py.Bool.of_bool x
| `Allow_nan -> Py.String.of_string "allow-nan"
)); ("ensure_2d", Wrap_utils.Option.map ensure_2d Py.Bool.of_bool); ("allow_nd", Wrap_utils.Option.map allow_nd Py.Bool.of_bool); ("ensure_min_samples", Wrap_utils.Option.map ensure_min_samples Py.Int.of_int); ("ensure_min_features", Wrap_utils.Option.map ensure_min_features Py.Int.of_int); ("warn_on_dtype", Wrap_utils.Option.map warn_on_dtype Py.Bool.of_bool); ("estimator", Wrap_utils.Option.map estimator (function
| `S x -> Py.String.of_string x
| `Estimator x -> Wrap_utils.id x
)); ("array", Some(array ))])
let check_consistent_length arrays =
Py.Module.get_function_with_keywords ns "check_consistent_length"
(Wrap_utils.pos_arg Wrap_utils.id arrays)
[]
let check_matplotlib_support ~caller_name () =
Py.Module.get_function_with_keywords ns "check_matplotlib_support"
[||]
(Wrap_utils.keyword_args [("caller_name", Some(caller_name |> Py.String.of_string))])
let check_pandas_support ~caller_name () =
Py.Module.get_function_with_keywords ns "check_pandas_support"
[||]
(Wrap_utils.keyword_args [("caller_name", Some(caller_name |> Py.String.of_string))])
let check_random_state ~seed () =
Py.Module.get_function_with_keywords ns "check_random_state"
[||]
(Wrap_utils.keyword_args [("seed", Some(seed |> (function
| `I x -> Py.Int.of_int x
| `RandomState x -> Wrap_utils.id x
| `None -> Py.none
)))])
let check_scalar ?min_val ?max_val ~x ~name ~target_type () =
Py.Module.get_function_with_keywords ns "check_scalar"
[||]
(Wrap_utils.keyword_args [("min_val", Wrap_utils.Option.map min_val (function
| `F x -> Py.Float.of_float x
| `I x -> Py.Int.of_int x
)); ("max_val", Wrap_utils.Option.map max_val (function
| `F x -> Py.Float.of_float x
| `I x -> Py.Int.of_int x
)); ("x", Some(x )); ("name", Some(name |> Py.String.of_string)); ("target_type", Some(target_type |> (function
| `Dtype x -> Wrap_utils.id x
| `Tuple x -> Wrap_utils.id x
)))])
let check_symmetric ?tol ?raise_warning ?raise_exception ~array () =
Py.Module.get_function_with_keywords ns "check_symmetric"
[||]
(Wrap_utils.keyword_args [("tol", tol); ("raise_warning", raise_warning); ("raise_exception", raise_exception); ("array", Some(array |> Arr.to_pyobject))])
|> Arr.of_pyobject
module Class_weight = struct
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils.class_weight"
let get_py name = Py.Module.get ns name
let compute_class_weight ~class_weight ~classes ~y () =
Py.Module.get_function_with_keywords ns "compute_class_weight"
[||]
(Wrap_utils.keyword_args [("class_weight", Some(class_weight |> (function
| `DictIntToFloat x -> (Py.Dict.of_bindings_map Py.Int.of_int Py.Float.of_float) x
| `Balanced -> Py.String.of_string "balanced"
| `None -> Py.none
))); ("classes", Some(classes |> Arr.to_pyobject)); ("y", Some(y |> Arr.to_pyobject))])
|> Arr.of_pyobject
let compute_sample_weight ?indices ~class_weight ~y () =
Py.Module.get_function_with_keywords ns "compute_sample_weight"
[||]
(Wrap_utils.keyword_args [("indices", Wrap_utils.Option.map indices Arr.to_pyobject); ("class_weight", Some(class_weight |> (function
| `DictIntToFloat x -> (Py.Dict.of_bindings_map Py.Int.of_int Py.Float.of_float) x
| `List_of_dicts x -> Wrap_utils.id x
| `Balanced -> Py.String.of_string "balanced"
| `None -> Py.none
))); ("y", Some(y |> Arr.to_pyobject))])
|> Arr.of_pyobject
end
let column_or_1d ?warn ~y () =
Py.Module.get_function_with_keywords ns "column_or_1d"
[||]
(Wrap_utils.keyword_args [("warn", Wrap_utils.Option.map warn Py.Bool.of_bool); ("y", Some(y |> Arr.to_pyobject))])
|> Arr.of_pyobject
let compute_class_weight ~class_weight ~classes ~y () =
Py.Module.get_function_with_keywords ns "compute_class_weight"
[||]
(Wrap_utils.keyword_args [("class_weight", Some(class_weight |> (function
| `DictIntToFloat x -> (Py.Dict.of_bindings_map Py.Int.of_int Py.Float.of_float) x
| `Balanced -> Py.String.of_string "balanced"
| `None -> Py.none
))); ("classes", Some(classes |> Arr.to_pyobject)); ("y", Some(y |> Arr.to_pyobject))])
|> Arr.of_pyobject
let compute_sample_weight ?indices ~class_weight ~y () =
Py.Module.get_function_with_keywords ns "compute_sample_weight"
[||]
(Wrap_utils.keyword_args [("indices", Wrap_utils.Option.map indices Arr.to_pyobject); ("class_weight", Some(class_weight |> (function
| `DictIntToFloat x -> (Py.Dict.of_bindings_map Py.Int.of_int Py.Float.of_float) x
| `List_of_dicts x -> Wrap_utils.id x
| `Balanced -> Py.String.of_string "balanced"
| `None -> Py.none
))); ("y", Some(y |> Arr.to_pyobject))])
|> Arr.of_pyobject
let contextmanager ~func () =
Py.Module.get_function_with_keywords ns "contextmanager"
[||]
(Wrap_utils.keyword_args [("func", Some(func ))])
let cpu_count () =
Py.Module.get_function_with_keywords ns "cpu_count"
[||]
[]
let delayed ?check_pickle ~function_ () =
Py.Module.get_function_with_keywords ns "delayed"
[||]
(Wrap_utils.keyword_args [("check_pickle", check_pickle); ("function", Some(function_ ))])
let deprecate ~obj () =
Py.Module.get_function_with_keywords ns "deprecate"
[||]
(Wrap_utils.keyword_args [("obj", Some(obj ))])
module Deprecated = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ? () =
Py.Module.get_function_with_keywords ns "deprecated"
[||]
(Wrap_utils.keyword_args [("extra", Wrap_utils.Option.map extra Py.String.of_string)])
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
module Deprecation = struct
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils.deprecation"
let get_py name = Py.Module.get ns name
module Deprecated = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ? () =
Py.Module.get_function_with_keywords ns "deprecated"
[||]
(Wrap_utils.keyword_args [("extra", Wrap_utils.Option.map extra Py.String.of_string)])
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
end
let effective_n_jobs ?n_jobs () =
Py.Module.get_function_with_keywords ns "effective_n_jobs"
[||]
(Wrap_utils.keyword_args [("n_jobs", n_jobs)])
module Extmath = struct
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils.extmath"
let get_py name = Py.Module.get ns name
let cartesian ?out ~arrays () =
Py.Module.get_function_with_keywords ns "cartesian"
[||]
(Wrap_utils.keyword_args [("out", out); ("arrays", Some(arrays ))])
|> Arr.of_pyobject
let check_array ?accept_sparse ?accept_large_sparse ?dtype ?order ?copy ?force_all_finite ?ensure_2d ?allow_nd ?ensure_min_samples ?ensure_min_features ?warn_on_dtype ?estimator ~array () =
Py.Module.get_function_with_keywords ns "check_array"
[||]
(Wrap_utils.keyword_args [("accept_sparse", Wrap_utils.Option.map accept_sparse (function
| `S x -> Py.String.of_string x
| `Bool x -> Py.Bool.of_bool x
| `StringList x -> (Py.List.of_list_map Py.String.of_string) x
)); ("accept_large_sparse", Wrap_utils.Option.map accept_large_sparse Py.Bool.of_bool); ("dtype", Wrap_utils.Option.map dtype (function
| `S x -> Py.String.of_string x
| `Dtype x -> Wrap_utils.id x
| `TypeList x -> Wrap_utils.id x
| `None -> Py.none
)); ("order", Wrap_utils.Option.map order (function
| `F -> Py.String.of_string "F"
| `C -> Py.String.of_string "C"
)); ("copy", Wrap_utils.Option.map copy Py.Bool.of_bool); ("force_all_finite", Wrap_utils.Option.map force_all_finite (function
| `Bool x -> Py.Bool.of_bool x
| `Allow_nan -> Py.String.of_string "allow-nan"
)); ("ensure_2d", Wrap_utils.Option.map ensure_2d Py.Bool.of_bool); ("allow_nd", Wrap_utils.Option.map allow_nd Py.Bool.of_bool); ("ensure_min_samples", Wrap_utils.Option.map ensure_min_samples Py.Int.of_int); ("ensure_min_features", Wrap_utils.Option.map ensure_min_features Py.Int.of_int); ("warn_on_dtype", Wrap_utils.Option.map warn_on_dtype Py.Bool.of_bool); ("estimator", Wrap_utils.Option.map estimator (function
| `S x -> Py.String.of_string x
| `Estimator x -> Wrap_utils.id x
)); ("array", Some(array ))])
let check_random_state ~seed () =
Py.Module.get_function_with_keywords ns "check_random_state"
[||]
(Wrap_utils.keyword_args [("seed", Some(seed |> (function
| `I x -> Py.Int.of_int x
| `RandomState x -> Wrap_utils.id x
| `None -> Py.none
)))])
let density ?kwargs ~w () =
Py.Module.get_function_with_keywords ns "density"
[||]
(List.rev_append (Wrap_utils.keyword_args [("w", Some(w |> Arr.to_pyobject))]) (match kwargs with None -> [] | Some x -> x))
module Deprecated = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ? () =
Py.Module.get_function_with_keywords ns "deprecated"
[||]
(Wrap_utils.keyword_args [("extra", Wrap_utils.Option.map extra Py.String.of_string)])
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
let fast_logdet ~a () =
Py.Module.get_function_with_keywords ns "fast_logdet"
[||]
(Wrap_utils.keyword_args [("A", Some(a |> Arr.to_pyobject))])
let log_logistic ?out ~x () =
Py.Module.get_function_with_keywords ns "log_logistic"
[||]
(Wrap_utils.keyword_args [("out", Wrap_utils.Option.map out (function
| `Arr x -> Arr.to_pyobject x
| `T_ x -> Wrap_utils.id x
)); ("X", Some(x |> Arr.to_pyobject))])
|> Arr.of_pyobject
let make_nonnegative ?min_value ~x () =
Py.Module.get_function_with_keywords ns "make_nonnegative"
[||]
(Wrap_utils.keyword_args [("min_value", min_value); ("X", Some(x |> Arr.to_pyobject))])
let randomized_range_finder ?power_iteration_normalizer ?random_state ~a ~size ~n_iter () =
Py.Module.get_function_with_keywords ns "randomized_range_finder"
[||]
(Wrap_utils.keyword_args [("power_iteration_normalizer", Wrap_utils.Option.map power_iteration_normalizer (function
| `Auto -> Py.String.of_string "auto"
| `QR -> Py.String.of_string "QR"
| `LU -> Py.String.of_string "LU"
| `None -> Py.String.of_string "none"
)); ("random_state", Wrap_utils.Option.map random_state Py.Int.of_int); ("A", Some(a )); ("size", Some(size |> Py.Int.of_int)); ("n_iter", Some(n_iter |> Py.Int.of_int))])
let randomized_svd ?n_oversamples ?n_iter ?power_iteration_normalizer ?transpose ?flip_sign ?random_state ~m ~n_components () =
Py.Module.get_function_with_keywords ns "randomized_svd"
[||]
(Wrap_utils.keyword_args [("n_oversamples", n_oversamples); ("n_iter", Wrap_utils.Option.map n_iter (function
| `I x -> Py.Int.of_int x
| `T_auto_ x -> Wrap_utils.id x
)); ("power_iteration_normalizer", Wrap_utils.Option.map power_iteration_normalizer (function
| `Auto -> Py.String.of_string "auto"
| `QR -> Py.String.of_string "QR"
| `LU -> Py.String.of_string "LU"
| `None -> Py.String.of_string "none"
)); ("transpose", Wrap_utils.Option.map transpose (function
| `Bool x -> Py.Bool.of_bool x
| `Auto -> Py.String.of_string "auto"
)); ("flip_sign", Wrap_utils.Option.map flip_sign (function
| `Bool x -> Py.Bool.of_bool x
| `T_True_by x -> Wrap_utils.id x
)); ("random_state", Wrap_utils.Option.map random_state Py.Int.of_int); ("M", Some(m |> Arr.to_pyobject)); ("n_components", Some(n_components |> Py.Int.of_int))])
let row_norms ?squared ~x () =
Py.Module.get_function_with_keywords ns "row_norms"
[||]
(Wrap_utils.keyword_args [("squared", squared); ("X", Some(x |> Arr.to_pyobject))])
let safe_min ~x () =
Py.Module.get_function_with_keywords ns "safe_min"
[||]
(Wrap_utils.keyword_args [("X", Some(x |> Arr.to_pyobject))])
let safe_sparse_dot ?dense_output ~a ~b () =
Py.Module.get_function_with_keywords ns "safe_sparse_dot"
[||]
(Wrap_utils.keyword_args [("dense_output", dense_output); ("a", Some(a |> Arr.to_pyobject)); ("b", Some(b ))])
|> Arr.of_pyobject
let softmax ?copy ~x () =
Py.Module.get_function_with_keywords ns "softmax"
[||]
(Wrap_utils.keyword_args [("copy", Wrap_utils.Option.map copy Py.Bool.of_bool); ("X", Some(x ))])
|> Arr.of_pyobject
let squared_norm ~x () =
Py.Module.get_function_with_keywords ns "squared_norm"
[||]
(Wrap_utils.keyword_args [("x", Some(x |> Arr.to_pyobject))])
let stable_cumsum ?axis ?rtol ?atol ~arr () =
Py.Module.get_function_with_keywords ns "stable_cumsum"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("rtol", rtol); ("atol", atol); ("arr", Some(arr |> Arr.to_pyobject))])
let svd_flip ?u_based_decision ~u ~v () =
Py.Module.get_function_with_keywords ns "svd_flip"
[||]
(Wrap_utils.keyword_args [("u_based_decision", Wrap_utils.Option.map u_based_decision Py.Bool.of_bool); ("u", Some(u |> Arr.to_pyobject)); ("v", Some(v |> Arr.to_pyobject))])
let weighted_mode ?axis ~a ~w () =
Py.Module.get_function_with_keywords ns "weighted_mode"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("a", Some(a |> Arr.to_pyobject)); ("w", Some(w ))])
|> Arr.of_pyobject
end
module Fixes = struct
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils.fixes"
let get_py name = Py.Module.get ns name
module LooseVersion = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ?vstring () =
Py.Module.get_function_with_keywords ns "LooseVersion"
[||]
(Wrap_utils.keyword_args [("vstring", vstring)])
let parse ~vstring self =
Py.Module.get_function_with_keywords self "parse"
[||]
(Wrap_utils.keyword_args [("vstring", Some(vstring ))])
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
module MaskedArray = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ?data ?mask ?dtype ?copy ?subok ?ndmin ?fill_value ?keep_mask ?hard_mask ?shrink ?order ?options () =
Py.Module.get_function_with_keywords ns "MaskedArray"
[||]
(List.rev_append (Wrap_utils.keyword_args [("data", Wrap_utils.Option.map data Arr.to_pyobject); ("mask", mask); ("dtype", dtype); ("copy", copy); ("subok", subok); ("ndmin", ndmin); ("fill_value", fill_value); ("keep_mask", keep_mask); ("hard_mask", hard_mask); ("shrink", shrink); ("order", order)]) (match options with None -> [] | Some x -> x))
let get_item ~indx self =
Py.Module.get_function_with_keywords self "__getitem__"
[||]
(Wrap_utils.keyword_args [("indx", Some(indx ))])
let all ?axis ?out ?keepdims self =
Py.Module.get_function_with_keywords self "all"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("out", out); ("keepdims", keepdims)])
let anom ?axis ?dtype self =
Py.Module.get_function_with_keywords self "anom"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis Py.Int.of_int); ("dtype", dtype)])
let any ?axis ?out ?keepdims self =
Py.Module.get_function_with_keywords self "any"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("out", out); ("keepdims", keepdims)])
let argmax ?axis ?fill_value ?out self =
Py.Module.get_function_with_keywords self "argmax"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis Py.Int.of_int); ("fill_value", fill_value); ("out", out)])
let argmin ?axis ?fill_value ?out self =
Py.Module.get_function_with_keywords self "argmin"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis Py.Int.of_int); ("fill_value", fill_value); ("out", out)])
let argpartition ?kwargs args self =
Py.Module.get_function_with_keywords self "argpartition"
(Wrap_utils.pos_arg Wrap_utils.id args)
(match kwargs with None -> [] | Some x -> x)
let argsort ?axis ?kind ?order ?endwith ?fill_value self =
Py.Module.get_function_with_keywords self "argsort"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis Py.Int.of_int); ("kind", Wrap_utils.Option.map kind (function
| `Quicksort -> Py.String.of_string "quicksort"
| `Mergesort -> Py.String.of_string "mergesort"
| `Heapsort -> Py.String.of_string "heapsort"
| `Stable -> Py.String.of_string "stable"
)); ("order", Wrap_utils.Option.map order Arr.to_pyobject); ("endwith", Wrap_utils.Option.map endwith Py.Bool.of_bool); ("fill_value", fill_value)])
|> (fun x -> if (fun x -> (Wrap_utils.isinstance Wrap_utils.ndarray x) || (Wrap_utils.isinstance Wrap_utils.csr_matrix x)) x then `Arr (Arr.of_pyobject x) else if Py.Int.check x then `I (Py.Int.to_int x) else failwith "could not identify type from Python value")
let compress ?axis ?out ~condition self =
Py.Module.get_function_with_keywords self "compress"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("out", out); ("condition", Some(condition ))])
let compressed self =
Py.Module.get_function_with_keywords self "compressed"
[||]
[]
|> Arr.of_pyobject
let copy ?params args self =
Py.Module.get_function_with_keywords self "copy"
(Wrap_utils.pos_arg Wrap_utils.id args)
(match params with None -> [] | Some x -> x)
let count ?axis ?keepdims self =
Py.Module.get_function_with_keywords self "count"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis (function
| `I x -> Py.Int.of_int x
| `Tuple_of_ints x -> Wrap_utils.id x
)); ("keepdims", Wrap_utils.Option.map keepdims Py.Bool.of_bool)])
let cumprod ?axis ?dtype ?out self =
Py.Module.get_function_with_keywords self "cumprod"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("dtype", dtype); ("out", out)])
let cumsum ?axis ?dtype ?out self =
Py.Module.get_function_with_keywords self "cumsum"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("dtype", dtype); ("out", out)])
let diagonal ?params args self =
Py.Module.get_function_with_keywords self "diagonal"
(Wrap_utils.pos_arg Wrap_utils.id args)
(match params with None -> [] | Some x -> x)
let dot ?out ?strict ~b self =
Py.Module.get_function_with_keywords self "dot"
[||]
(Wrap_utils.keyword_args [("out", out); ("strict", strict); ("b", Some(b ))])
let filled ?fill_value self =
Py.Module.get_function_with_keywords self "filled"
[||]
(Wrap_utils.keyword_args [("fill_value", Wrap_utils.Option.map fill_value Arr.to_pyobject)])
|> Arr.of_pyobject
let flatten ?params args self =
Py.Module.get_function_with_keywords self "flatten"
(Wrap_utils.pos_arg Wrap_utils.id args)
(match params with None -> [] | Some x -> x)
|> Arr.of_pyobject
let get_fill_value self =
Py.Module.get_function_with_keywords self "get_fill_value"
[||]
[]
let get_imag self =
Py.Module.get_function_with_keywords self "get_imag"
[||]
[]
let get_real self =
Py.Module.get_function_with_keywords self "get_real"
[||]
[]
let harden_mask self =
Py.Module.get_function_with_keywords self "harden_mask"
[||]
[]
let ids self =
Py.Module.get_function_with_keywords self "ids"
[||]
[]
let iscontiguous self =
Py.Module.get_function_with_keywords self "iscontiguous"
[||]
[]
let max ?axis ?out ?fill_value ?keepdims self =
Py.Module.get_function_with_keywords self "max"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis Py.Int.of_int); ("out", out); ("fill_value", fill_value); ("keepdims", keepdims)])
|> Arr.of_pyobject
let mean ?axis ?dtype ?out ?keepdims self =
Py.Module.get_function_with_keywords self "mean"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("dtype", dtype); ("out", out); ("keepdims", keepdims)])
let min ?axis ?out ?fill_value ?keepdims self =
Py.Module.get_function_with_keywords self "min"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis Py.Int.of_int); ("out", out); ("fill_value", fill_value); ("keepdims", keepdims)])
|> Arr.of_pyobject
let mini ?axis self =
Py.Module.get_function_with_keywords self "mini"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis Py.Int.of_int)])
let nonzero self =
Py.Module.get_function_with_keywords self "nonzero"
[||]
[]
let partition ?kwargs args self =
Py.Module.get_function_with_keywords self "partition"
(Wrap_utils.pos_arg Wrap_utils.id args)
(match kwargs with None -> [] | Some x -> x)
let prod ?axis ?dtype ?out ?keepdims self =
Py.Module.get_function_with_keywords self "prod"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("dtype", dtype); ("out", out); ("keepdims", keepdims)])
let product ?axis ?dtype ?out ?keepdims self =
Py.Module.get_function_with_keywords self "product"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("dtype", dtype); ("out", out); ("keepdims", keepdims)])
let ptp ?axis ?out ?fill_value ?keepdims self =
Py.Module.get_function_with_keywords self "ptp"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis Py.Int.of_int); ("out", out); ("fill_value", fill_value); ("keepdims", keepdims)])
|> Arr.of_pyobject
let put ?mode ~indices ~values self =
Py.Module.get_function_with_keywords self "put"
[||]
(Wrap_utils.keyword_args [("mode", mode); ("indices", Some(indices )); ("values", Some(values ))])
let ravel ?order self =
Py.Module.get_function_with_keywords self "ravel"
[||]
(Wrap_utils.keyword_args [("order", Wrap_utils.Option.map order (function
| `C -> Py.String.of_string "C"
| `F -> Py.String.of_string "F"
| `A -> Py.String.of_string "A"
| `K -> Py.String.of_string "K"
))])
let repeat ?params args self =
Py.Module.get_function_with_keywords self "repeat"
(Wrap_utils.pos_arg Wrap_utils.id args)
(match params with None -> [] | Some x -> x)
let reshape ?kwargs s self =
Py.Module.get_function_with_keywords self "reshape"
(Wrap_utils.pos_arg Wrap_utils.id s)
(match kwargs with None -> [] | Some x -> x)
|> Arr.of_pyobject
let resize ?refcheck ?order ~newshape self =
Py.Module.get_function_with_keywords self "resize"
[||]
(Wrap_utils.keyword_args [("refcheck", refcheck); ("order", order); ("newshape", Some(newshape ))])
let round ?decimals ?out self =
Py.Module.get_function_with_keywords self "round"
[||]
(Wrap_utils.keyword_args [("decimals", decimals); ("out", out)])
let set_fill_value ?value self =
Py.Module.get_function_with_keywords self "set_fill_value"
[||]
(Wrap_utils.keyword_args [("value", value)])
let shrink_mask self =
Py.Module.get_function_with_keywords self "shrink_mask"
[||]
[]
let soften_mask self =
Py.Module.get_function_with_keywords self "soften_mask"
[||]
[]
let sort ?axis ?kind ?order ?endwith ?fill_value self =
Py.Module.get_function_with_keywords self "sort"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("kind", kind); ("order", order); ("endwith", endwith); ("fill_value", fill_value)])
|> Arr.of_pyobject
let squeeze ?params args self =
Py.Module.get_function_with_keywords self "squeeze"
(Wrap_utils.pos_arg Wrap_utils.id args)
(match params with None -> [] | Some x -> x)
let std ?axis ?dtype ?out ?ddof ?keepdims self =
Py.Module.get_function_with_keywords self "std"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("dtype", dtype); ("out", out); ("ddof", ddof); ("keepdims", keepdims)])
let sum ?axis ?dtype ?out ?keepdims self =
Py.Module.get_function_with_keywords self "sum"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("dtype", dtype); ("out", out); ("keepdims", keepdims)])
let swapaxes ?params args self =
Py.Module.get_function_with_keywords self "swapaxes"
(Wrap_utils.pos_arg Wrap_utils.id args)
(match params with None -> [] | Some x -> x)
let take ?axis ?out ?mode ~indices self =
Py.Module.get_function_with_keywords self "take"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("out", out); ("mode", mode); ("indices", Some(indices ))])
let tobytes ?fill_value ?order self =
Py.Module.get_function_with_keywords self "tobytes"
[||]
(Wrap_utils.keyword_args [("fill_value", fill_value); ("order", order)])
let tofile ?sep ?format ~fid self =
Py.Module.get_function_with_keywords self "tofile"
[||]
(Wrap_utils.keyword_args [("sep", sep); ("format", format); ("fid", Some(fid ))])
let toflex self =
Py.Module.get_function_with_keywords self "toflex"
[||]
[]
|> Arr.of_pyobject
let tolist ?fill_value self =
Py.Module.get_function_with_keywords self "tolist"
[||]
(Wrap_utils.keyword_args [("fill_value", fill_value)])
|> Arr.of_pyobject
let torecords self =
Py.Module.get_function_with_keywords self "torecords"
[||]
[]
|> Arr.of_pyobject
let tostring ?fill_value ?order self =
Py.Module.get_function_with_keywords self "tostring"
[||]
(Wrap_utils.keyword_args [("fill_value", fill_value); ("order", order)])
let trace ?offset ?axis1 ?axis2 ?dtype ?out self =
Py.Module.get_function_with_keywords self "trace"
[||]
(Wrap_utils.keyword_args [("offset", offset); ("axis1", axis1); ("axis2", axis2); ("dtype", dtype); ("out", out)])
let transpose ?params args self =
Py.Module.get_function_with_keywords self "transpose"
(Wrap_utils.pos_arg Wrap_utils.id args)
(match params with None -> [] | Some x -> x)
|> Arr.of_pyobject
let unshare_mask self =
Py.Module.get_function_with_keywords self "unshare_mask"
[||]
[]
let var ?axis ?dtype ?out ?ddof ?keepdims self =
Py.Module.get_function_with_keywords self "var"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("dtype", dtype); ("out", Wrap_utils.Option.map out Arr.to_pyobject); ("ddof", Wrap_utils.Option.map ddof Py.Int.of_int); ("keepdims", Wrap_utils.Option.map keepdims Py.Bool.of_bool)])
let view ?dtype ?type_ ?fill_value self =
Py.Module.get_function_with_keywords self "view"
[||]
(Wrap_utils.keyword_args [("dtype", dtype); ("type", type_); ("fill_value", fill_value)])
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
let comb ?exact ?repetition ~n ~k () =
Py.Module.get_function_with_keywords ns "comb"
[||]
(Wrap_utils.keyword_args [("exact", exact); ("repetition", repetition); ("N", Some(n |> (function
| `I x -> Py.Int.of_int x
| `Arr x -> Arr.to_pyobject x
))); ("k", Some(k ))])
|> (fun x -> if Py.Int.check x then `I (Py.Int.to_int x) else if Py.Float.check x then `F (Py.Float.to_float x) else if (fun x -> (Wrap_utils.isinstance Wrap_utils.ndarray x) || (Wrap_utils.isinstance Wrap_utils.csr_matrix x)) x then `Arr (Arr.of_pyobject x) else failwith "could not identify type from Python value")
let lobpcg ?b ?m ?y ?tol ?maxiter ?largest ?verbosityLevel ?retLambdaHistory ?retResidualNormsHistory ~a ~x () =
Py.Module.get_function_with_keywords ns "lobpcg"
[||]
(Wrap_utils.keyword_args [("B", b); ("M", m); ("Y", y); ("tol", tol); ("maxiter", maxiter); ("largest", largest); ("verbosityLevel", verbosityLevel); ("retLambdaHistory", retLambdaHistory); ("retResidualNormsHistory", retResidualNormsHistory); ("A", Some(a |> (function
| `SparseMatrix x -> Csr_matrix.to_pyobject x
| `Dense_matrix x -> Wrap_utils.id x
| `LinearOperator x -> Wrap_utils.id x
))); ("X", Some(x ))])
|> Arr.of_pyobject
let logsumexp ?axis ?b ?keepdims ?return_sign ~a () =
Py.Module.get_function_with_keywords ns "logsumexp"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("b", Wrap_utils.Option.map b Arr.to_pyobject); ("keepdims", Wrap_utils.Option.map keepdims Py.Bool.of_bool); ("return_sign", Wrap_utils.Option.map return_sign Py.Bool.of_bool); ("a", Some(a |> Arr.to_pyobject))])
|> Arr.of_pyobject
let loguniform ?kwds args =
Py.Module.get_function_with_keywords ns "loguniform"
(Wrap_utils.pos_arg Wrap_utils.id args)
(match kwds with None -> [] | Some x -> x)
let pinvh ?cond ?rcond ?lower ?return_rank ?check_finite ~a () =
Py.Module.get_function_with_keywords ns "pinvh"
[||]
(Wrap_utils.keyword_args [("cond", cond); ("rcond", rcond); ("lower", Wrap_utils.Option.map lower Py.Bool.of_bool); ("return_rank", Wrap_utils.Option.map return_rank Py.Bool.of_bool); ("check_finite", Wrap_utils.Option.map check_finite Py.Bool.of_bool); ("a", Some(a ))])
let sparse_lsqr ?damp ?atol ?btol ?conlim ?iter_lim ?show ?calc_var ?x0 ~a ~b () =
Py.Module.get_function_with_keywords ns "sparse_lsqr"
[||]
(Wrap_utils.keyword_args [("damp", damp); ("atol", atol); ("btol", btol); ("conlim", conlim); ("iter_lim", iter_lim); ("show", show); ("calc_var", calc_var); ("x0", x0); ("A", Some(a |> (function
| `Arr x -> Arr.to_pyobject x
| `LinearOperator x -> Wrap_utils.id x
))); ("b", Some(b ))])
end
let gen_batches ?min_batch_size ~n ~batch_size () =
Py.Module.get_function_with_keywords ns "gen_batches"
[||]
(Wrap_utils.keyword_args [("min_batch_size", min_batch_size); ("n", Some(n |> Py.Int.of_int)); ("batch_size", Some(batch_size ))])
let gen_even_slices ?n_samples ~n ~n_packs () =
Py.Module.get_function_with_keywords ns "gen_even_slices"
[||]
(Wrap_utils.keyword_args [("n_samples", n_samples); ("n", Some(n |> Py.Int.of_int)); ("n_packs", Some(n_packs ))])
let get_chunk_n_rows ?max_n_rows ?working_memory ~row_bytes () =
Py.Module.get_function_with_keywords ns "get_chunk_n_rows"
[||]
(Wrap_utils.keyword_args [("max_n_rows", max_n_rows); ("working_memory", working_memory); ("row_bytes", Some(row_bytes |> Py.Int.of_int))])
let get_config () =
Py.Module.get_function_with_keywords ns "get_config"
[||]
[]
|> Dict.of_pyobject
module Graph = struct
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils.graph"
let get_py name = Py.Module.get ns name
let single_source_shortest_path_length ?cutoff ~graph ~source () =
Py.Module.get_function_with_keywords ns "single_source_shortest_path_length"
[||]
(Wrap_utils.keyword_args [("cutoff", cutoff); ("graph", Some(graph |> (function
| `SparseMatrix x -> Csr_matrix.to_pyobject x
| `T2D_array_preferably_LIL_matrix_ x -> Wrap_utils.id x
))); ("source", Some(source ))])
end
module Graph_shortest_path = struct
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils.graph_shortest_path"
let get_py name = Py.Module.get ns name
module Float64 = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ?x () =
Py.Module.get_function_with_keywords ns "float64"
[||]
(Wrap_utils.keyword_args [("x", x)])
let get_item ~key self =
Py.Module.get_function_with_keywords self "__getitem__"
[||]
(Wrap_utils.keyword_args [("key", Some(key ))])
let fromhex ~string self =
Py.Module.get_function_with_keywords self "fromhex"
[||]
(Wrap_utils.keyword_args [("string", Some(string ))])
let hex self =
Py.Module.get_function_with_keywords self "hex"
[||]
[]
let is_integer self =
Py.Module.get_function_with_keywords self "is_integer"
[||]
[]
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
let isspmatrix ~x () =
Py.Module.get_function_with_keywords ns "isspmatrix"
[||]
(Wrap_utils.keyword_args [("x", Some(x ))])
let isspmatrix_csr ~x () =
Py.Module.get_function_with_keywords ns "isspmatrix_csr"
[||]
(Wrap_utils.keyword_args [("x", Some(x ))])
end
let hash ?hash_name ?coerce_mmap ~obj () =
Py.Module.get_function_with_keywords ns "hash"
[||]
(Wrap_utils.keyword_args [("hash_name", Wrap_utils.Option.map hash_name (function
| `Md5 -> Py.String.of_string "md5"
| `Sha1 -> Py.String.of_string "sha1"
)); ("coerce_mmap", coerce_mmap); ("obj", Some(obj ))])
let import_module ?package ~name () =
Py.Module.get_function_with_keywords ns "import_module"
[||]
(Wrap_utils.keyword_args [("package", package); ("name", Some(name ))])
let indexable iterables =
Py.Module.get_function_with_keywords ns "indexable"
(Wrap_utils.pos_arg Wrap_utils.id iterables)
[]
let indices_to_mask ~indices ~mask_length () =
Py.Module.get_function_with_keywords ns "indices_to_mask"
[||]
(Wrap_utils.keyword_args [("indices", Some(indices |> Arr.to_pyobject)); ("mask_length", Some(mask_length ))])
let is_scalar_nan ~x () =
Py.Module.get_function_with_keywords ns "is_scalar_nan"
[||]
(Wrap_utils.keyword_args [("x", Some(x ))])
let issparse ~x () =
Py.Module.get_function_with_keywords ns "issparse"
[||]
(Wrap_utils.keyword_args [("x", Some(x ))])
module Metaestimators = struct
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils.metaestimators"
let get_py name = Py.Module.get ns name
module ABCMeta = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ?kwargs ~name ~bases ~namespace () =
Py.Module.get_function_with_keywords ns "ABCMeta"
[||]
(List.rev_append (Wrap_utils.keyword_args [("name", Some(name )); ("bases", Some(bases )); ("namespace", Some(namespace ))]) (match kwargs with None -> [] | Some x -> x))
let mro self =
Py.Module.get_function_with_keywords self "mro"
[||]
[]
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
module BaseEstimator = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create () =
Py.Module.get_function_with_keywords ns "BaseEstimator"
[||]
[]
let get_params ?deep self =
Py.Module.get_function_with_keywords self "get_params"
[||]
(Wrap_utils.keyword_args [("deep", Wrap_utils.Option.map deep Py.Bool.of_bool)])
|> Dict.of_pyobject
let set_params ?params self =
Py.Module.get_function_with_keywords self "set_params"
[||]
(match params with None -> [] | Some x -> x)
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
let abstractmethod ~funcobj () =
Py.Module.get_function_with_keywords ns "abstractmethod"
[||]
(Wrap_utils.keyword_args [("funcobj", Some(funcobj ))])
let if_delegate_has_method ~delegate () =
Py.Module.get_function_with_keywords ns "if_delegate_has_method"
[||]
(Wrap_utils.keyword_args [("delegate", Some(delegate |> (function
| `S x -> Py.String.of_string x
| `StringList x -> (Py.List.of_list_map Py.String.of_string) x
| `Tuple_of_strings x -> Wrap_utils.id x
)))])
let update_wrapper ?assigned ?updated ~wrapper ~wrapped () =
Py.Module.get_function_with_keywords ns "update_wrapper"
[||]
(Wrap_utils.keyword_args [("assigned", assigned); ("updated", updated); ("wrapper", Some(wrapper )); ("wrapped", Some(wrapped ))])
end
module Multiclass = struct
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils.multiclass"
let get_py name = Py.Module.get ns name
let check_array ?accept_sparse ?accept_large_sparse ?dtype ?order ?copy ?force_all_finite ?ensure_2d ?allow_nd ?ensure_min_samples ?ensure_min_features ?warn_on_dtype ?estimator ~array () =
Py.Module.get_function_with_keywords ns "check_array"
[||]
(Wrap_utils.keyword_args [("accept_sparse", Wrap_utils.Option.map accept_sparse (function
| `S x -> Py.String.of_string x
| `Bool x -> Py.Bool.of_bool x
| `StringList x -> (Py.List.of_list_map Py.String.of_string) x
)); ("accept_large_sparse", Wrap_utils.Option.map accept_large_sparse Py.Bool.of_bool); ("dtype", Wrap_utils.Option.map dtype (function
| `S x -> Py.String.of_string x
| `Dtype x -> Wrap_utils.id x
| `TypeList x -> Wrap_utils.id x
| `None -> Py.none
)); ("order", Wrap_utils.Option.map order (function
| `F -> Py.String.of_string "F"
| `C -> Py.String.of_string "C"
)); ("copy", Wrap_utils.Option.map copy Py.Bool.of_bool); ("force_all_finite", Wrap_utils.Option.map force_all_finite (function
| `Bool x -> Py.Bool.of_bool x
| `Allow_nan -> Py.String.of_string "allow-nan"
)); ("ensure_2d", Wrap_utils.Option.map ensure_2d Py.Bool.of_bool); ("allow_nd", Wrap_utils.Option.map allow_nd Py.Bool.of_bool); ("ensure_min_samples", Wrap_utils.Option.map ensure_min_samples Py.Int.of_int); ("ensure_min_features", Wrap_utils.Option.map ensure_min_features Py.Int.of_int); ("warn_on_dtype", Wrap_utils.Option.map warn_on_dtype Py.Bool.of_bool); ("estimator", Wrap_utils.Option.map estimator (function
| `S x -> Py.String.of_string x
| `Estimator x -> Wrap_utils.id x
)); ("array", Some(array ))])
let check_classification_targets ~y () =
Py.Module.get_function_with_keywords ns "check_classification_targets"
[||]
(Wrap_utils.keyword_args [("y", Some(y |> Arr.to_pyobject))])
let class_distribution ?sample_weight ~y () =
Py.Module.get_function_with_keywords ns "class_distribution"
[||]
(Wrap_utils.keyword_args [("sample_weight", Wrap_utils.Option.map sample_weight Arr.to_pyobject); ("y", Some(y |> (function
| `Arr x -> Arr.to_pyobject x
| `PyObject x -> Wrap_utils.id x
)))])
|> (fun x -> ((Wrap_utils.id (Py.Tuple.get x 0)), (Wrap_utils.id (Py.Tuple.get x 1)), (Wrap_utils.id (Py.Tuple.get x 2))))
module Dok_matrix = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ?shape ?dtype ?copy ~arg1 () =
Py.Module.get_function_with_keywords ns "dok_matrix"
[||]
(Wrap_utils.keyword_args [("shape", Wrap_utils.Option.map shape (fun ml -> Py.List.of_list_map Py.Int.of_int ml)); ("dtype", dtype); ("copy", copy); ("arg1", Some(arg1 ))])
let get_item ~key self =
Py.Module.get_function_with_keywords self "__getitem__"
[||]
(Wrap_utils.keyword_args [("key", Some(key ))])
let asformat ?copy ~format self =
Py.Module.get_function_with_keywords self "asformat"
[||]
(Wrap_utils.keyword_args [("copy", copy); ("format", Some(format |> (function
| `S x -> Py.String.of_string x
| `None -> Py.none
)))])
let asfptype self =
Py.Module.get_function_with_keywords self "asfptype"
[||]
[]
let astype ?casting ?copy ~dtype self =
Py.Module.get_function_with_keywords self "astype"
[||]
(Wrap_utils.keyword_args [("casting", casting); ("copy", copy); ("dtype", Some(dtype |> (function
| `S x -> Py.String.of_string x
| `Dtype x -> Wrap_utils.id x
)))])
let conj ?copy self =
Py.Module.get_function_with_keywords self "conj"
[||]
(Wrap_utils.keyword_args [("copy", Wrap_utils.Option.map copy Py.Bool.of_bool)])
let conjtransp self =
Py.Module.get_function_with_keywords self "conjtransp"
[||]
[]
let conjugate ?copy self =
Py.Module.get_function_with_keywords self "conjugate"
[||]
(Wrap_utils.keyword_args [("copy", Wrap_utils.Option.map copy Py.Bool.of_bool)])
let copy self =
Py.Module.get_function_with_keywords self "copy"
[||]
[]
let count_nonzero self =
Py.Module.get_function_with_keywords self "count_nonzero"
[||]
[]
let diagonal ?k self =
Py.Module.get_function_with_keywords self "diagonal"
[||]
(Wrap_utils.keyword_args [("k", Wrap_utils.Option.map k Py.Int.of_int)])
let dot ~other self =
Py.Module.get_function_with_keywords self "dot"
[||]
(Wrap_utils.keyword_args [("other", Some(other ))])
let fromkeys ?value ~iterable self =
Py.Module.get_function_with_keywords self "fromkeys"
[||]
(Wrap_utils.keyword_args [("value", value); ("iterable", Some(iterable ))])
let get ?default ~key self =
Py.Module.get_function_with_keywords self "get"
[||]
(Wrap_utils.keyword_args [("default", default); ("key", Some(key ))])
let getH self =
Py.Module.get_function_with_keywords self "getH"
[||]
[]
let get_shape self =
Py.Module.get_function_with_keywords self "get_shape"
[||]
[]
let getcol ~j self =
Py.Module.get_function_with_keywords self "getcol"
[||]
(Wrap_utils.keyword_args [("j", Some(j ))])
let getformat self =
Py.Module.get_function_with_keywords self "getformat"
[||]
[]
let getmaxprint self =
Py.Module.get_function_with_keywords self "getmaxprint"
[||]
[]
let getnnz ?axis self =
Py.Module.get_function_with_keywords self "getnnz"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis (function
| `Zero -> Py.Int.of_int 0
| `One -> Py.Int.of_int 1
))])
let getrow ~i self =
Py.Module.get_function_with_keywords self "getrow"
[||]
(Wrap_utils.keyword_args [("i", Some(i ))])
let maximum ~other self =
Py.Module.get_function_with_keywords self "maximum"
[||]
(Wrap_utils.keyword_args [("other", Some(other ))])
let mean ?axis ?dtype ?out self =
Py.Module.get_function_with_keywords self "mean"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis (function
| `Zero -> Py.Int.of_int 0
| `One -> Py.Int.of_int 1
| `PyObject x -> Wrap_utils.id x
)); ("dtype", dtype); ("out", Wrap_utils.Option.map out Arr.to_pyobject)])
|> Arr.of_pyobject
let minimum ~other self =
Py.Module.get_function_with_keywords self "minimum"
[||]
(Wrap_utils.keyword_args [("other", Some(other ))])
let multiply ~other self =
Py.Module.get_function_with_keywords self "multiply"
[||]
(Wrap_utils.keyword_args [("other", Some(other ))])
let nonzero self =
Py.Module.get_function_with_keywords self "nonzero"
[||]
[]
let power ?dtype ~n self =
Py.Module.get_function_with_keywords self "power"
[||]
(Wrap_utils.keyword_args [("dtype", dtype); ("n", Some(n ))])
let reshape ?kwargs args self =
Py.Module.get_function_with_keywords self "reshape"
(Wrap_utils.pos_arg Wrap_utils.id args)
(match kwargs with None -> [] | Some x -> x)
|> Csr_matrix.of_pyobject
let resize shape self =
Py.Module.get_function_with_keywords self "resize"
(Wrap_utils.pos_arg Py.Int.of_int shape)
[]
let set_shape ~shape self =
Py.Module.get_function_with_keywords self "set_shape"
[||]
(Wrap_utils.keyword_args [("shape", Some(shape |> (fun ml -> Py.List.of_list_map Py.Int.of_int ml)))])
let setdefault ?default ~key self =
Py.Module.get_function_with_keywords self "setdefault"
[||]
(Wrap_utils.keyword_args [("default", default); ("key", Some(key ))])
let setdiag ?k ~values self =
Py.Module.get_function_with_keywords self "setdiag"
[||]
(Wrap_utils.keyword_args [("k", Wrap_utils.Option.map k Py.Int.of_int); ("values", Some(values |> Arr.to_pyobject))])
let sum ?axis ?dtype ?out self =
Py.Module.get_function_with_keywords self "sum"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis (function
| `Zero -> Py.Int.of_int 0
| `One -> Py.Int.of_int 1
| `PyObject x -> Wrap_utils.id x
)); ("dtype", dtype); ("out", Wrap_utils.Option.map out Arr.to_pyobject)])
|> Arr.of_pyobject
let toarray ?order ?out self =
Py.Module.get_function_with_keywords self "toarray"
[||]
(Wrap_utils.keyword_args [("order", Wrap_utils.Option.map order (function
| `C -> Py.String.of_string "C"
| `F -> Py.String.of_string "F"
)); ("out", Wrap_utils.Option.map out Arr.to_pyobject)])
|> Arr.of_pyobject
let tobsr ?blocksize ?copy self =
Py.Module.get_function_with_keywords self "tobsr"
[||]
(Wrap_utils.keyword_args [("blocksize", blocksize); ("copy", copy)])
let tocoo ?copy self =
Py.Module.get_function_with_keywords self "tocoo"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let tocsc ?copy self =
Py.Module.get_function_with_keywords self "tocsc"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let tocsr ?copy self =
Py.Module.get_function_with_keywords self "tocsr"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let todense ?order ?out self =
Py.Module.get_function_with_keywords self "todense"
[||]
(Wrap_utils.keyword_args [("order", Wrap_utils.Option.map order (function
| `C -> Py.String.of_string "C"
| `F -> Py.String.of_string "F"
)); ("out", Wrap_utils.Option.map out Arr.to_pyobject)])
|> Arr.of_pyobject
let todia ?copy self =
Py.Module.get_function_with_keywords self "todia"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let todok ?copy self =
Py.Module.get_function_with_keywords self "todok"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let tolil ?copy self =
Py.Module.get_function_with_keywords self "tolil"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let transpose ?axes ?copy self =
Py.Module.get_function_with_keywords self "transpose"
[||]
(Wrap_utils.keyword_args [("axes", axes); ("copy", copy)])
let update ~val_ self =
Py.Module.get_function_with_keywords self "update"
[||]
(Wrap_utils.keyword_args [("val", Some(val_ ))])
let dtype_opt self =
match Py.Object.get_attr_string self "dtype" with
| None -> failwith "attribute dtype not found"
| Some x -> if Py.is_none x then None else Some (Wrap_utils.id x)
let dtype self = match dtype_opt self with
| None -> raise Not_found
| Some x -> x
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
let is_multilabel ~y () =
Py.Module.get_function_with_keywords ns "is_multilabel"
[||]
(Wrap_utils.keyword_args [("y", Some(y |> Arr.to_pyobject))])
|> Py.Bool.to_bool
let issparse ~x () =
Py.Module.get_function_with_keywords ns "issparse"
[||]
(Wrap_utils.keyword_args [("x", Some(x ))])
module Lil_matrix = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ?shape ?dtype ?copy ~arg1 () =
Py.Module.get_function_with_keywords ns "lil_matrix"
[||]
(Wrap_utils.keyword_args [("shape", Wrap_utils.Option.map shape (fun ml -> Py.List.of_list_map Py.Int.of_int ml)); ("dtype", dtype); ("copy", copy); ("arg1", Some(arg1 ))])
let get_item ~key self =
Py.Module.get_function_with_keywords self "__getitem__"
[||]
(Wrap_utils.keyword_args [("key", Some(key ))])
let asformat ?copy ~format self =
Py.Module.get_function_with_keywords self "asformat"
[||]
(Wrap_utils.keyword_args [("copy", copy); ("format", Some(format |> (function
| `S x -> Py.String.of_string x
| `None -> Py.none
)))])
let asfptype self =
Py.Module.get_function_with_keywords self "asfptype"
[||]
[]
let astype ?casting ?copy ~dtype self =
Py.Module.get_function_with_keywords self "astype"
[||]
(Wrap_utils.keyword_args [("casting", casting); ("copy", copy); ("dtype", Some(dtype |> (function
| `S x -> Py.String.of_string x
| `Dtype x -> Wrap_utils.id x
)))])
let conj ?copy self =
Py.Module.get_function_with_keywords self "conj"
[||]
(Wrap_utils.keyword_args [("copy", Wrap_utils.Option.map copy Py.Bool.of_bool)])
let conjugate ?copy self =
Py.Module.get_function_with_keywords self "conjugate"
[||]
(Wrap_utils.keyword_args [("copy", Wrap_utils.Option.map copy Py.Bool.of_bool)])
let copy self =
Py.Module.get_function_with_keywords self "copy"
[||]
[]
let count_nonzero self =
Py.Module.get_function_with_keywords self "count_nonzero"
[||]
[]
let diagonal ?k self =
Py.Module.get_function_with_keywords self "diagonal"
[||]
(Wrap_utils.keyword_args [("k", Wrap_utils.Option.map k Py.Int.of_int)])
let dot ~other self =
Py.Module.get_function_with_keywords self "dot"
[||]
(Wrap_utils.keyword_args [("other", Some(other ))])
let getH self =
Py.Module.get_function_with_keywords self "getH"
[||]
[]
let get_shape self =
Py.Module.get_function_with_keywords self "get_shape"
[||]
[]
let getcol ~j self =
Py.Module.get_function_with_keywords self "getcol"
[||]
(Wrap_utils.keyword_args [("j", Some(j ))])
let getformat self =
Py.Module.get_function_with_keywords self "getformat"
[||]
[]
let getmaxprint self =
Py.Module.get_function_with_keywords self "getmaxprint"
[||]
[]
let getnnz ?axis self =
Py.Module.get_function_with_keywords self "getnnz"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis (function
| `Zero -> Py.Int.of_int 0
| `One -> Py.Int.of_int 1
))])
let getrow ~i self =
Py.Module.get_function_with_keywords self "getrow"
[||]
(Wrap_utils.keyword_args [("i", Some(i ))])
let getrowview ~i self =
Py.Module.get_function_with_keywords self "getrowview"
[||]
(Wrap_utils.keyword_args [("i", Some(i ))])
let maximum ~other self =
Py.Module.get_function_with_keywords self "maximum"
[||]
(Wrap_utils.keyword_args [("other", Some(other ))])
let mean ?axis ?dtype ?out self =
Py.Module.get_function_with_keywords self "mean"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis (function
| `Zero -> Py.Int.of_int 0
| `One -> Py.Int.of_int 1
| `PyObject x -> Wrap_utils.id x
)); ("dtype", dtype); ("out", Wrap_utils.Option.map out Arr.to_pyobject)])
|> Arr.of_pyobject
let minimum ~other self =
Py.Module.get_function_with_keywords self "minimum"
[||]
(Wrap_utils.keyword_args [("other", Some(other ))])
let multiply ~other self =
Py.Module.get_function_with_keywords self "multiply"
[||]
(Wrap_utils.keyword_args [("other", Some(other ))])
let nonzero self =
Py.Module.get_function_with_keywords self "nonzero"
[||]
[]
let power ?dtype ~n self =
Py.Module.get_function_with_keywords self "power"
[||]
(Wrap_utils.keyword_args [("dtype", dtype); ("n", Some(n ))])
let reshape ?kwargs args self =
Py.Module.get_function_with_keywords self "reshape"
(Wrap_utils.pos_arg Wrap_utils.id args)
(match kwargs with None -> [] | Some x -> x)
|> Csr_matrix.of_pyobject
let resize shape self =
Py.Module.get_function_with_keywords self "resize"
(Wrap_utils.pos_arg Py.Int.of_int shape)
[]
let set_shape ~shape self =
Py.Module.get_function_with_keywords self "set_shape"
[||]
(Wrap_utils.keyword_args [("shape", Some(shape |> (fun ml -> Py.List.of_list_map Py.Int.of_int ml)))])
let setdiag ?k ~values self =
Py.Module.get_function_with_keywords self "setdiag"
[||]
(Wrap_utils.keyword_args [("k", Wrap_utils.Option.map k Py.Int.of_int); ("values", Some(values |> Arr.to_pyobject))])
let sum ?axis ?dtype ?out self =
Py.Module.get_function_with_keywords self "sum"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis (function
| `Zero -> Py.Int.of_int 0
| `One -> Py.Int.of_int 1
| `PyObject x -> Wrap_utils.id x
)); ("dtype", dtype); ("out", Wrap_utils.Option.map out Arr.to_pyobject)])
|> Arr.of_pyobject
let toarray ?order ?out self =
Py.Module.get_function_with_keywords self "toarray"
[||]
(Wrap_utils.keyword_args [("order", Wrap_utils.Option.map order (function
| `C -> Py.String.of_string "C"
| `F -> Py.String.of_string "F"
)); ("out", Wrap_utils.Option.map out Arr.to_pyobject)])
|> Arr.of_pyobject
let tobsr ?blocksize ?copy self =
Py.Module.get_function_with_keywords self "tobsr"
[||]
(Wrap_utils.keyword_args [("blocksize", blocksize); ("copy", copy)])
let tocoo ?copy self =
Py.Module.get_function_with_keywords self "tocoo"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let tocsc ?copy self =
Py.Module.get_function_with_keywords self "tocsc"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let tocsr ?copy self =
Py.Module.get_function_with_keywords self "tocsr"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let todense ?order ?out self =
Py.Module.get_function_with_keywords self "todense"
[||]
(Wrap_utils.keyword_args [("order", Wrap_utils.Option.map order (function
| `C -> Py.String.of_string "C"
| `F -> Py.String.of_string "F"
)); ("out", Wrap_utils.Option.map out Arr.to_pyobject)])
|> Arr.of_pyobject
let todia ?copy self =
Py.Module.get_function_with_keywords self "todia"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let todok ?copy self =
Py.Module.get_function_with_keywords self "todok"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let tolil ?copy self =
Py.Module.get_function_with_keywords self "tolil"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let transpose ?axes ?copy self =
Py.Module.get_function_with_keywords self "transpose"
[||]
(Wrap_utils.keyword_args [("axes", axes); ("copy", copy)])
let dtype_opt self =
match Py.Object.get_attr_string self "dtype" with
| None -> failwith "attribute dtype not found"
| Some x -> if Py.is_none x then None else Some (Wrap_utils.id x)
let dtype self = match dtype_opt self with
| None -> raise Not_found
| Some x -> x
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
module Spmatrix = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ?maxprint () =
Py.Module.get_function_with_keywords ns "spmatrix"
[||]
(Wrap_utils.keyword_args [("maxprint", maxprint)])
let asformat ?copy ~format self =
Py.Module.get_function_with_keywords self "asformat"
[||]
(Wrap_utils.keyword_args [("copy", copy); ("format", Some(format |> (function
| `S x -> Py.String.of_string x
| `None -> Py.none
)))])
let asfptype self =
Py.Module.get_function_with_keywords self "asfptype"
[||]
[]
let astype ?casting ?copy ~dtype self =
Py.Module.get_function_with_keywords self "astype"
[||]
(Wrap_utils.keyword_args [("casting", casting); ("copy", copy); ("dtype", Some(dtype |> (function
| `S x -> Py.String.of_string x
| `Dtype x -> Wrap_utils.id x
)))])
let conj ?copy self =
Py.Module.get_function_with_keywords self "conj"
[||]
(Wrap_utils.keyword_args [("copy", Wrap_utils.Option.map copy Py.Bool.of_bool)])
let conjugate ?copy self =
Py.Module.get_function_with_keywords self "conjugate"
[||]
(Wrap_utils.keyword_args [("copy", Wrap_utils.Option.map copy Py.Bool.of_bool)])
let copy self =
Py.Module.get_function_with_keywords self "copy"
[||]
[]
let count_nonzero self =
Py.Module.get_function_with_keywords self "count_nonzero"
[||]
[]
let diagonal ?k self =
Py.Module.get_function_with_keywords self "diagonal"
[||]
(Wrap_utils.keyword_args [("k", Wrap_utils.Option.map k Py.Int.of_int)])
let dot ~other self =
Py.Module.get_function_with_keywords self "dot"
[||]
(Wrap_utils.keyword_args [("other", Some(other ))])
let getH self =
Py.Module.get_function_with_keywords self "getH"
[||]
[]
let get_shape self =
Py.Module.get_function_with_keywords self "get_shape"
[||]
[]
let getcol ~j self =
Py.Module.get_function_with_keywords self "getcol"
[||]
(Wrap_utils.keyword_args [("j", Some(j ))])
let getformat self =
Py.Module.get_function_with_keywords self "getformat"
[||]
[]
let getmaxprint self =
Py.Module.get_function_with_keywords self "getmaxprint"
[||]
[]
let getnnz ?axis self =
Py.Module.get_function_with_keywords self "getnnz"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis (function
| `Zero -> Py.Int.of_int 0
| `One -> Py.Int.of_int 1
))])
let getrow ~i self =
Py.Module.get_function_with_keywords self "getrow"
[||]
(Wrap_utils.keyword_args [("i", Some(i ))])
let maximum ~other self =
Py.Module.get_function_with_keywords self "maximum"
[||]
(Wrap_utils.keyword_args [("other", Some(other ))])
let mean ?axis ?dtype ?out self =
Py.Module.get_function_with_keywords self "mean"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis (function
| `Zero -> Py.Int.of_int 0
| `One -> Py.Int.of_int 1
| `PyObject x -> Wrap_utils.id x
)); ("dtype", dtype); ("out", Wrap_utils.Option.map out Arr.to_pyobject)])
|> Arr.of_pyobject
let minimum ~other self =
Py.Module.get_function_with_keywords self "minimum"
[||]
(Wrap_utils.keyword_args [("other", Some(other ))])
let multiply ~other self =
Py.Module.get_function_with_keywords self "multiply"
[||]
(Wrap_utils.keyword_args [("other", Some(other ))])
let nonzero self =
Py.Module.get_function_with_keywords self "nonzero"
[||]
[]
let power ?dtype ~n self =
Py.Module.get_function_with_keywords self "power"
[||]
(Wrap_utils.keyword_args [("dtype", dtype); ("n", Some(n ))])
let reshape ?kwargs args self =
Py.Module.get_function_with_keywords self "reshape"
(Wrap_utils.pos_arg Wrap_utils.id args)
(match kwargs with None -> [] | Some x -> x)
|> Csr_matrix.of_pyobject
let resize ~shape self =
Py.Module.get_function_with_keywords self "resize"
[||]
(Wrap_utils.keyword_args [("shape", Some(shape |> (fun ml -> Py.List.of_list_map Py.Int.of_int ml)))])
let set_shape ~shape self =
Py.Module.get_function_with_keywords self "set_shape"
[||]
(Wrap_utils.keyword_args [("shape", Some(shape |> (fun ml -> Py.List.of_list_map Py.Int.of_int ml)))])
let setdiag ?k ~values self =
Py.Module.get_function_with_keywords self "setdiag"
[||]
(Wrap_utils.keyword_args [("k", Wrap_utils.Option.map k Py.Int.of_int); ("values", Some(values |> Arr.to_pyobject))])
let sum ?axis ?dtype ?out self =
Py.Module.get_function_with_keywords self "sum"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis (function
| `Zero -> Py.Int.of_int 0
| `One -> Py.Int.of_int 1
| `PyObject x -> Wrap_utils.id x
)); ("dtype", dtype); ("out", Wrap_utils.Option.map out Arr.to_pyobject)])
|> Arr.of_pyobject
let toarray ?order ?out self =
Py.Module.get_function_with_keywords self "toarray"
[||]
(Wrap_utils.keyword_args [("order", Wrap_utils.Option.map order (function
| `C -> Py.String.of_string "C"
| `F -> Py.String.of_string "F"
)); ("out", Wrap_utils.Option.map out Arr.to_pyobject)])
|> Arr.of_pyobject
let tobsr ?blocksize ?copy self =
Py.Module.get_function_with_keywords self "tobsr"
[||]
(Wrap_utils.keyword_args [("blocksize", blocksize); ("copy", copy)])
let tocoo ?copy self =
Py.Module.get_function_with_keywords self "tocoo"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let tocsc ?copy self =
Py.Module.get_function_with_keywords self "tocsc"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let tocsr ?copy self =
Py.Module.get_function_with_keywords self "tocsr"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let todense ?order ?out self =
Py.Module.get_function_with_keywords self "todense"
[||]
(Wrap_utils.keyword_args [("order", Wrap_utils.Option.map order (function
| `C -> Py.String.of_string "C"
| `F -> Py.String.of_string "F"
)); ("out", Wrap_utils.Option.map out Arr.to_pyobject)])
|> Arr.of_pyobject
let todia ?copy self =
Py.Module.get_function_with_keywords self "todia"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let todok ?copy self =
Py.Module.get_function_with_keywords self "todok"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let tolil ?copy self =
Py.Module.get_function_with_keywords self "tolil"
[||]
(Wrap_utils.keyword_args [("copy", copy)])
let transpose ?axes ?copy self =
Py.Module.get_function_with_keywords self "transpose"
[||]
(Wrap_utils.keyword_args [("axes", axes); ("copy", copy)])
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
let type_of_target ~y () =
Py.Module.get_function_with_keywords ns "type_of_target"
[||]
(Wrap_utils.keyword_args [("y", Some(y |> Arr.to_pyobject))])
|> Py.String.to_string
let unique_labels ys =
Py.Module.get_function_with_keywords ns "unique_labels"
(Wrap_utils.pos_arg Wrap_utils.id ys)
[]
|> Arr.of_pyobject
end
module Murmurhash = struct
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils.murmurhash"
let get_py name = Py.Module.get ns name
end
module Optimize = struct
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils.optimize"
let get_py name = Py.Module.get ns name
module Deprecated = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ? () =
Py.Module.get_function_with_keywords ns "deprecated"
[||]
(Wrap_utils.keyword_args [("extra", Wrap_utils.Option.map extra Py.String.of_string)])
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
let line_search_wolfe1 ?gfk ?old_fval ?old_old_fval ?args ?c1 ?c2 ?amax ?amin ?xtol ~f ~fprime ~xk ~pk () =
Py.Module.get_function_with_keywords ns "line_search_wolfe1"
[||]
(Wrap_utils.keyword_args [("gfk", Wrap_utils.Option.map gfk Arr.to_pyobject); ("old_fval", old_fval); ("old_old_fval", old_old_fval); ("args", args); ("c1", c1); ("c2", c2); ("amax", amax); ("amin", amin); ("xtol", xtol); ("f", Some(f )); ("fprime", Some(fprime )); ("xk", Some(xk )); ("pk", Some(pk ))])
let line_search_wolfe2 ?gfk ?old_fval ?old_old_fval ?args ?c1 ?c2 ?amax ? ?maxiter ~f ~myfprime ~xk ~pk () =
Py.Module.get_function_with_keywords ns "line_search_wolfe2"
[||]
(Wrap_utils.keyword_args [("gfk", gfk); ("old_fval", old_fval); ("old_old_fval", old_old_fval); ("args", args); ("c1", c1); ("c2", c2); ("amax", amax); ("extra_condition", extra_condition); ("maxiter", maxiter); ("f", Some(f )); ("myfprime", Some(myfprime )); ("xk", Some(xk )); ("pk", Some(pk ))])
let newton_cg ?args ?tol ?maxiter ?maxinner ?line_search ?warn ~grad_hess ~func ~grad ~x0 () =
Py.Module.get_function_with_keywords ns "newton_cg"
[||]
(Wrap_utils.keyword_args [("args", args); ("tol", tol); ("maxiter", maxiter); ("maxinner", maxinner); ("line_search", line_search); ("warn", warn); ("grad_hess", Some(grad_hess )); ("func", Some(func )); ("grad", Some(grad )); ("x0", Some(x0 ))])
end
module Parallel_backend = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ?n_jobs ?inner_max_num_threads ?backend_params ~backend () =
Py.Module.get_function_with_keywords ns "parallel_backend"
[||]
(List.rev_append (Wrap_utils.keyword_args [("n_jobs", n_jobs); ("inner_max_num_threads", inner_max_num_threads); ("backend", Some(backend ))]) (match backend_params with None -> [] | Some x -> x))
let unregister self =
Py.Module.get_function_with_keywords self "unregister"
[||]
[]
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
module Random = struct
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils.random"
let get_py name = Py.Module.get ns name
let check_random_state ~seed () =
Py.Module.get_function_with_keywords ns "check_random_state"
[||]
(Wrap_utils.keyword_args [("seed", Some(seed |> (function
| `I x -> Py.Int.of_int x
| `RandomState x -> Wrap_utils.id x
| `None -> Py.none
)))])
module Deprecated = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ? () =
Py.Module.get_function_with_keywords ns "deprecated"
[||]
(Wrap_utils.keyword_args [("extra", Wrap_utils.Option.map extra Py.String.of_string)])
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
let random_choice_csc ?class_probability ?random_state ~n_samples ~classes () =
Py.Module.get_function_with_keywords ns "random_choice_csc"
[||]
(Wrap_utils.keyword_args [("class_probability", class_probability); ("random_state", Wrap_utils.Option.map random_state Py.Int.of_int); ("n_samples", Some(n_samples )); ("classes", Some(classes ))])
end
let register_parallel_backend ?make_default ~name ~factory () =
Py.Module.get_function_with_keywords ns "register_parallel_backend"
[||]
(Wrap_utils.keyword_args [("make_default", make_default); ("name", Some(name )); ("factory", Some(factory ))])
let resample ?options arrays =
Py.Module.get_function_with_keywords ns "resample"
(Wrap_utils.pos_arg Wrap_utils.id arrays)
(match options with None -> [] | Some x -> x)
let safe_indexing ?axis ~x ~indices () =
Py.Module.get_function_with_keywords ns "safe_indexing"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis Py.Int.of_int); ("X", Some(x |> (function
| `Arr x -> Arr.to_pyobject x
| `PyObject x -> Wrap_utils.id x
))); ("indices", Some(indices |> (function
| `Bool x -> Py.Bool.of_bool x
| `I x -> Py.Int.of_int x
| `S x -> Py.String.of_string x
| `Slice x -> Wrap_utils.id x
| `Arr x -> Arr.to_pyobject x
)))])
let safe_mask ~x ~mask () =
Py.Module.get_function_with_keywords ns "safe_mask"
[||]
(Wrap_utils.keyword_args [("X", Some(x |> Arr.to_pyobject)); ("mask", Some(mask |> Arr.to_pyobject))])
let safe_sqr ?copy ~x () =
Py.Module.get_function_with_keywords ns "safe_sqr"
[||]
(Wrap_utils.keyword_args [("copy", Wrap_utils.Option.map copy Py.Bool.of_bool); ("X", Some(x |> Arr.to_pyobject))])
let shuffle ?random_state ?n_samples arrays =
Py.Module.get_function_with_keywords ns "shuffle"
(Wrap_utils.pos_arg Arr.to_pyobject arrays)
(Wrap_utils.keyword_args [("random_state", Wrap_utils.Option.map random_state Py.Int.of_int); ("n_samples", Wrap_utils.Option.map n_samples Py.Int.of_int)])
|> (fun py -> Py.List.to_list_map (Arr.of_pyobject) py)
module Sparsefuncs = struct
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils.sparsefuncs"
let get_py name = Py.Module.get ns name
let count_nonzero ?axis ?sample_weight ~x () =
Py.Module.get_function_with_keywords ns "count_nonzero"
[||]
(Wrap_utils.keyword_args [("axis", Wrap_utils.Option.map axis (function
| `Zero -> Py.Int.of_int 0
| `One -> Py.Int.of_int 1
)); ("sample_weight", Wrap_utils.Option.map sample_weight Arr.to_pyobject); ("X", Some(x |> Csr_matrix.to_pyobject))])
let csc_median_axis_0 ~x () =
Py.Module.get_function_with_keywords ns "csc_median_axis_0"
[||]
(Wrap_utils.keyword_args [("X", Some(x ))])
|> Arr.of_pyobject
let incr_mean_variance_axis ~x ~axis ~last_mean ~last_var ~last_n () =
Py.Module.get_function_with_keywords ns "incr_mean_variance_axis"
[||]
(Wrap_utils.keyword_args [("X", Some(x |> (function
| `SparseMatrix x -> Csr_matrix.to_pyobject x
| `CSC_sparse_matrix x -> Wrap_utils.id x
))); ("axis", Some(axis )); ("last_mean", Some(last_mean |> Arr.to_pyobject)); ("last_var", Some(last_var |> Arr.to_pyobject)); ("last_n", Some(last_n |> Py.Int.of_int))])
|> (fun x -> ((Arr.of_pyobject (Py.Tuple.get x 0)), (Arr.of_pyobject (Py.Tuple.get x 1)), (Py.Int.to_int (Py.Tuple.get x 2))))
let inplace_column_scale ~x ~scale () =
Py.Module.get_function_with_keywords ns "inplace_column_scale"
[||]
(Wrap_utils.keyword_args [("X", Some(x |> (function
| `CSC x -> Wrap_utils.id x
| `SparseMatrix x -> Csr_matrix.to_pyobject x
))); ("scale", Some(scale |> Arr.to_pyobject))])
let inplace_csr_column_scale ~x ~scale () =
Py.Module.get_function_with_keywords ns "inplace_csr_column_scale"
[||]
(Wrap_utils.keyword_args [("X", Some(x |> Csr_matrix.to_pyobject)); ("scale", Some(scale |> Arr.to_pyobject))])
let inplace_csr_row_scale ~x ~scale () =
Py.Module.get_function_with_keywords ns "inplace_csr_row_scale"
[||]
(Wrap_utils.keyword_args [("X", Some(x |> Csr_matrix.to_pyobject)); ("scale", Some(scale |> Arr.to_pyobject))])
let inplace_row_scale ~x ~scale () =
Py.Module.get_function_with_keywords ns "inplace_row_scale"
[||]
(Wrap_utils.keyword_args [("X", Some(x |> (function
| `SparseMatrix x -> Csr_matrix.to_pyobject x
| `CSC_sparse_matrix x -> Wrap_utils.id x
))); ("scale", Some(scale |> Arr.to_pyobject))])
let inplace_swap_column ~x ~m ~n () =
Py.Module.get_function_with_keywords ns "inplace_swap_column"
[||]
(Wrap_utils.keyword_args [("X", Some(x |> (function
| `SparseMatrix x -> Csr_matrix.to_pyobject x
| `CSC_sparse_matrix x -> Wrap_utils.id x
))); ("m", Some(m |> Py.Int.of_int)); ("n", Some(n |> Py.Int.of_int))])
let inplace_swap_row ~x ~m ~n () =
Py.Module.get_function_with_keywords ns "inplace_swap_row"
[||]
(Wrap_utils.keyword_args [("X", Some(x |> (function
| `SparseMatrix x -> Csr_matrix.to_pyobject x
| `CSC_sparse_matrix x -> Wrap_utils.id x
))); ("m", Some(m |> Py.Int.of_int)); ("n", Some(n |> Py.Int.of_int))])
let inplace_swap_row_csc ~x ~m ~n () =
Py.Module.get_function_with_keywords ns "inplace_swap_row_csc"
[||]
(Wrap_utils.keyword_args [("X", Some(x )); ("m", Some(m |> Py.Int.of_int)); ("n", Some(n |> Py.Int.of_int))])
let inplace_swap_row_csr ~x ~m ~n () =
Py.Module.get_function_with_keywords ns "inplace_swap_row_csr"
[||]
(Wrap_utils.keyword_args [("X", Some(x |> Csr_matrix.to_pyobject)); ("m", Some(m |> Py.Int.of_int)); ("n", Some(n |> Py.Int.of_int))])
let mean_variance_axis ~x ~axis () =
Py.Module.get_function_with_keywords ns "mean_variance_axis"
[||]
(Wrap_utils.keyword_args [("X", Some(x |> (function
| `SparseMatrix x -> Csr_matrix.to_pyobject x
| `CSC_sparse_matrix x -> Wrap_utils.id x
))); ("axis", Some(axis ))])
|> (fun x -> ((Arr.of_pyobject (Py.Tuple.get x 0)), (Arr.of_pyobject (Py.Tuple.get x 1))))
let min_max_axis ?ignore_nan ~x ~axis () =
Py.Module.get_function_with_keywords ns "min_max_axis"
[||]
(Wrap_utils.keyword_args [("ignore_nan", Wrap_utils.Option.map ignore_nan Py.Bool.of_bool); ("X", Some(x |> (function
| `SparseMatrix x -> Csr_matrix.to_pyobject x
| `CSC_sparse_matrix x -> Wrap_utils.id x
))); ("axis", Some(axis ))])
|> (fun x -> ((Arr.of_pyobject (Py.Tuple.get x 0)), (Arr.of_pyobject (Py.Tuple.get x 1))))
end
module Sparsefuncs_fast = struct
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils.sparsefuncs_fast"
let get_py name = Py.Module.get ns name
let assign_rows_csr ~x ~x_rows ~out_rows ~out () =
Py.Module.get_function_with_keywords ns "assign_rows_csr"
[||]
(Wrap_utils.keyword_args [("X", Some(x |> Csr_matrix.to_pyobject)); ("X_rows", Some(x_rows )); ("out_rows", Some(out_rows )); ("out", Some(out ))])
end
module Stats = struct
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils.stats"
let get_py name = Py.Module.get ns name
let stable_cumsum ?axis ?rtol ?atol ~arr () =
Py.Module.get_function_with_keywords ns "stable_cumsum"
[||]
(Wrap_utils.keyword_args [("axis", axis); ("rtol", rtol); ("atol", atol); ("arr", Some(arr |> Arr.to_pyobject))])
end
let tosequence ~x () =
Py.Module.get_function_with_keywords ns "tosequence"
[||]
(Wrap_utils.keyword_args [("x", Some(x |> Arr.to_pyobject))])
module Validation = struct
let () = Wrap_utils.init ();;
let ns = Py.import "sklearn.utils.validation"
let get_py name = Py.Module.get ns name
module LooseVersion = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ?vstring () =
Py.Module.get_function_with_keywords ns "LooseVersion"
[||]
(Wrap_utils.keyword_args [("vstring", vstring)])
let parse ~vstring self =
Py.Module.get_function_with_keywords self "parse"
[||]
(Wrap_utils.keyword_args [("vstring", Some(vstring ))])
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
module Parameter = struct
type t = Py.Object.t
let of_pyobject x = x
let to_pyobject x = x
let create ~name ~kind ~default ~annotation () =
Py.Module.get_function_with_keywords ns "Parameter"
[||]
(Wrap_utils.keyword_args [("name", Some(name )); ("kind", Some(kind )); ("default", Some(default )); ("annotation", Some(annotation ))])
let replace ?name ?kind ?annotation ?default self =
Py.Module.get_function_with_keywords self "replace"
[||]
(Wrap_utils.keyword_args [("name", name); ("kind", kind); ("annotation", annotation); ("default", default)])
let to_string self = Py.Object.to_string self
let show self = to_string self
let pp formatter self = Format.fprintf formatter "%s" (show self)
end
let as_float_array ?copy ?force_all_finite ~x () =
Py.Module.get_function_with_keywords ns "as_float_array"
[||]
(Wrap_utils.keyword_args [("copy", Wrap_utils.Option.map copy Py.Bool.of_bool); ("force_all_finite", Wrap_utils.Option.map force_all_finite (function
| `Bool x -> Py.Bool.of_bool x
| `Allow_nan -> Py.String.of_string "allow-nan"
)); ("X", Some(x |> Arr.to_pyobject))])
|> Arr.of_pyobject
let assert_all_finite ?allow_nan ~x () =
Py.Module.get_function_with_keywords ns "assert_all_finite"
[||]
(Wrap_utils.keyword_args [("allow_nan", Wrap_utils.Option.map allow_nan Py.Bool.of_bool); ("X", Some(x |> Arr.to_pyobject))])
let check_X_y ?accept_sparse ?accept_large_sparse ?dtype ?order ?copy ?force_all_finite ?ensure_2d ?allow_nd ?multi_output ?ensure_min_samples ?ensure_min_features ?y_numeric ?warn_on_dtype ?estimator ~x ~y () =
Py.Module.get_function_with_keywords ns "check_X_y"
[||]
(Wrap_utils.keyword_args [("accept_sparse", Wrap_utils.Option.map accept_sparse (function
| `S x -> Py.String.of_string x
| `Bool x -> Py.Bool.of_bool x
| `StringList x -> (Py.List.of_list_map Py.String.of_string) x
)); ("accept_large_sparse", Wrap_utils.Option.map accept_large_sparse Py.Bool.of_bool); ("dtype", Wrap_utils.Option.map dtype (function
| `S x -> Py.String.of_string x
| `Dtype x -> Wrap_utils.id x
| `TypeList x -> Wrap_utils.id x
| `None -> Py.none
)); ("order", Wrap_utils.Option.map order (function
| `F -> Py.String.of_string "F"
| `C -> Py.String.of_string "C"
)); ("copy", Wrap_utils.Option.map copy Py.Bool.of_bool); ("force_all_finite", Wrap_utils.Option.map force_all_finite (function
| `Bool x -> Py.Bool.of_bool x
| `Allow_nan -> Py.String.of_string "allow-nan"
)); ("ensure_2d", Wrap_utils.Option.map ensure_2d Py.Bool.of_bool); ("allow_nd", Wrap_utils.Option.map allow_nd Py.Bool.of_bool); ("multi_output", Wrap_utils.Option.map multi_output Py.Bool.of_bool); ("ensure_min_samples", Wrap_utils.Option.map ensure_min_samples Py.Int.of_int); ("ensure_min_features", Wrap_utils.Option.map ensure_min_features Py.Int.of_int); ("y_numeric", Wrap_utils.Option.map y_numeric Py.Bool.of_bool); ("warn_on_dtype", Wrap_utils.Option.map warn_on_dtype Py.Bool.of_bool); ("estimator", Wrap_utils.Option.map estimator (function
| `S x -> Py.String.of_string x
| `Estimator x -> Wrap_utils.id x
)); ("X", Some(x |> Arr.to_pyobject)); ("y", Some(y |> Arr.to_pyobject))])
|> (fun x -> ((Wrap_utils.id (Py.Tuple.get x 0)), (Wrap_utils.id (Py.Tuple.get x 1))))
let check_array ?accept_sparse ?accept_large_sparse ?dtype ?order ?copy ?force_all_finite ?ensure_2d ?allow_nd ?ensure_min_samples ?ensure_min_features ?warn_on_dtype ?estimator ~array () =
Py.Module.get_function_with_keywords ns "check_array"
[||]
(Wrap_utils.keyword_args [("accept_sparse", Wrap_utils.Option.map accept_sparse (function
| `S x -> Py.String.of_string x
| `Bool x -> Py.Bool.of_bool x
| `StringList x -> (Py.List.of_list_map Py.String.of_string) x
)); ("accept_large_sparse", Wrap_utils.Option.map accept_large_sparse Py.Bool.of_bool); ("dtype", Wrap_utils.Option.map dtype (function
| `S x -> Py.String.of_string x
| `Dtype x -> Wrap_utils.id x
| `TypeList x -> Wrap_utils.id x
| `None -> Py.none
)); ("order", Wrap_utils.Option.map order (function
| `F -> Py.String.of_string "F"
| `C -> Py.String.of_string "C"
)); ("copy", Wrap_utils.Option.map copy Py.Bool.of_bool); ("force_all_finite", Wrap_utils.Option.map force_all_finite (function
| `Bool x -> Py.Bool.of_bool x
| `Allow_nan -> Py.String.of_string "allow-nan"
)); ("ensure_2d", Wrap_utils.Option.map ensure_2d Py.Bool.of_bool); ("allow_nd", Wrap_utils.Option.map allow_nd Py.Bool.of_bool); ("ensure_min_samples", Wrap_utils.Option.map ensure_min_samples Py.Int.of_int); ("ensure_min_features", Wrap_utils.Option.map ensure_min_features Py.Int.of_int); ("warn_on_dtype", Wrap_utils.Option.map warn_on_dtype Py.Bool.of_bool); ("estimator", Wrap_utils.Option.map estimator (function
| `S x -> Py.String.of_string x
| `Estimator x -> Wrap_utils.id x
)); ("array", Some(array ))])
let check_consistent_length arrays =
Py.Module.get_function_with_keywords ns "check_consistent_length"
(Wrap_utils.pos_arg Wrap_utils.id arrays)
[]
let check_is_fitted ?attributes ?msg ?all_or_any ~estimator () =
Py.Module.get_function_with_keywords ns "check_is_fitted"
[||]
(Wrap_utils.keyword_args [("attributes", Wrap_utils.Option.map attributes (function
| `S x -> Py.String.of_string x
| `Arr x -> Arr.to_pyobject x
| `StringList x -> (Py.List.of_list_map Py.String.of_string) x
)); ("msg", Wrap_utils.Option.map msg Py.String.of_string); ("all_or_any", Wrap_utils.Option.map all_or_any (function
| `Callable x -> Wrap_utils.id x
| `PyObject x -> Wrap_utils.id x
)); ("estimator", Some(estimator ))])
let check_memory ~memory () =
Py.Module.get_function_with_keywords ns "check_memory"
[||]
(Wrap_utils.keyword_args [("memory", Some(memory |> (function
| `S x -> Py.String.of_string x
| `JoblibMemory x -> Wrap_utils.id x
| `None -> Py.none
)))])
let check_non_negative ~x ~whom () =
Py.Module.get_function_with_keywords ns "check_non_negative"
[||]
(Wrap_utils.keyword_args [("X", Some(x |> Arr.to_pyobject)); ("whom", Some(whom |> Py.String.of_string))])
let check_random_state ~seed () =
Py.Module.get_function_with_keywords ns "check_random_state"
[||]
(Wrap_utils.keyword_args [("seed", Some(seed |> (function
| `I x -> Py.Int.of_int x
| `RandomState x -> Wrap_utils.id x
| `None -> Py.none
)))])
let check_scalar ?min_val ?max_val ~x ~name ~target_type () =
Py.Module.get_function_with_keywords ns "check_scalar"
[||]
(Wrap_utils.keyword_args [("min_val", Wrap_utils.Option.map min_val (function
| `F x -> Py.Float.of_float x
| `I x -> Py.Int.of_int x
)); ("max_val", Wrap_utils.Option.map max_val (function
| `F x -> Py.Float.of_float x
| `I x -> Py.Int.of_int x
)); ("x", Some(x )); ("name", Some(name |> Py.String.of_string)); ("target_type", Some(target_type |> (function
| `Dtype x -> Wrap_utils.id x
| `Tuple x -> Wrap_utils.id x
)))])
let check_symmetric ?tol ?raise_warning ?raise_exception ~array () =
Py.Module.get_function_with_keywords ns "check_symmetric"
[||]
(Wrap_utils.keyword_args [("tol", tol); ("raise_warning", raise_warning); ("raise_exception", raise_exception); ("array", Some(array |> Arr.to_pyobject))])
|> Arr.of_pyobject
let column_or_1d ?warn ~y () =
Py.Module.get_function_with_keywords ns "column_or_1d"
[||]
(Wrap_utils.keyword_args [("warn", Wrap_utils.Option.map warn Py.Bool.of_bool); ("y", Some(y |> Arr.to_pyobject))])
|> Arr.of_pyobject
let has_fit_parameter ~estimator ~parameter () =
Py.Module.get_function_with_keywords ns "has_fit_parameter"
[||]
(Wrap_utils.keyword_args [("estimator", Some(estimator )); ("parameter", Some(parameter |> Py.String.of_string))])
|> Py.Bool.to_bool
let indexable iterables =
Py.Module.get_function_with_keywords ns "indexable"
(Wrap_utils.pos_arg Wrap_utils.id iterables)
[]
let isclass ~object_ () =
Py.Module.get_function_with_keywords ns "isclass"
[||]
(Wrap_utils.keyword_args [("object", Some(object_ ))])
let signature ?follow_wrapped ~obj () =
Py.Module.get_function_with_keywords ns "signature"
[||]
(Wrap_utils.keyword_args [("follow_wrapped", follow_wrapped); ("obj", Some(obj ))])
let wraps ?assigned ?updated ~wrapped () =
Py.Module.get_function_with_keywords ns "wraps"
[||]
(Wrap_utils.keyword_args [("assigned", assigned); ("updated", updated); ("wrapped", Some(wrapped ))])
end