Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

fpskope.html 26 KB

You have to be logged in to leave a comment. Sign In
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
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
  6. <meta name="generator" content="pdoc 0.10.0" />
  7. <link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
  8. <link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
  9. <link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
  10. <style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
  11. <style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
  12. <style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
  13. <script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
  14. <script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
  15. </head>
  16. <body>
  17. <main>
  18. <article id="content">
  19. <section id="section-intro">
  20. <details class="source">
  21. <summary>
  22. <span>Expand source code</span>
  23. </summary>
  24. <pre><code class="python">from typing import List
  25. import numpy as np
  26. import pandas as pd
  27. from imodels.rule_set.skope_rules import SkopeRulesClassifier
  28. from imodels.util.convert import itemsets_to_rules
  29. from imodels.util.extract import extract_fpgrowth
  30. from imodels.util.rule import Rule
  31. from imodels.util.score import score_precision_recall
  32. class FPSkopeClassifier(SkopeRulesClassifier):
  33. def __init__(self,
  34. minsupport=0.1,
  35. maxcardinality=2,
  36. verbose=False,
  37. precision_min=0.5,
  38. recall_min=0.01,
  39. n_estimators=10,
  40. max_samples=.8,
  41. max_samples_features=1.,
  42. bootstrap=False,
  43. bootstrap_features=False,
  44. max_depth=3,
  45. max_depth_duplication=None,
  46. max_features=1.,
  47. min_samples_split=2,
  48. n_jobs=1,
  49. random_state=None):
  50. super().__init__(precision_min,
  51. recall_min,
  52. n_estimators,
  53. max_samples,
  54. max_samples_features,
  55. bootstrap,
  56. bootstrap_features,
  57. max_depth,
  58. max_depth_duplication,
  59. max_features,
  60. min_samples_split,
  61. n_jobs,
  62. random_state,
  63. verbose)
  64. self.minsupport = minsupport
  65. self.maxcardinality = maxcardinality
  66. self.verbose = verbose
  67. def fit(self, X, y=None, feature_names=None, undiscretized_features=[], sample_weight=None):
  68. self.undiscretized_features = undiscretized_features
  69. super().fit(X, y, feature_names=feature_names, sample_weight=sample_weight)
  70. return self
  71. def _extract_rules(self, X, y) -&gt; List[str]:
  72. X = pd.DataFrame(X, columns=self.feature_placeholders)
  73. itemsets = extract_fpgrowth(X, minsupport=self.minsupport,
  74. maxcardinality=self.maxcardinality,
  75. verbose=self.verbose)
  76. return [itemsets_to_rules(itemsets)], [np.arange(X.shape[0])], [np.arange(len(self.feature_names))]
  77. def _score_rules(self, X, y, rules) -&gt; List[Rule]:
  78. return score_precision_recall(X, y,
  79. rules,
  80. self.estimators_samples_,
  81. self.estimators_features_,
  82. self.feature_placeholders,
  83. oob=False)</code></pre>
  84. </details>
  85. </section>
  86. <section>
  87. </section>
  88. <section>
  89. </section>
  90. <section>
  91. </section>
  92. <section>
  93. <h2 class="section-title" id="header-classes">Classes</h2>
  94. <dl>
  95. <dt id="imodels.rule_set.fpskope.FPSkopeClassifier"><code class="flex name class">
  96. <span>class <span class="ident">FPSkopeClassifier</span></span>
  97. <span>(</span><span>minsupport=0.1, maxcardinality=2, verbose=False, precision_min=0.5, recall_min=0.01, n_estimators=10, max_samples=0.8, max_samples_features=1.0, bootstrap=False, bootstrap_features=False, max_depth=3, max_depth_duplication=None, max_features=1.0, min_samples_split=2, n_jobs=1, random_state=None)</span>
  98. </code></dt>
  99. <dd>
  100. <div class="desc"><p>An easy-interpretable classifier optimizing simple logical rules.</p>
  101. <h2 id="parameters">Parameters</h2>
  102. <dl>
  103. <dt><strong><code>feature_names</code></strong> :&ensp;<code>list</code> of <code>str</code>, optional</dt>
  104. <dd>The names of each feature to be used for returning rules in string
  105. format.</dd>
  106. <dt><strong><code>precision_min</code></strong> :&ensp;<code>float</code>, optional <code>(default=0.5)</code></dt>
  107. <dd>The minimal precision of a rule to be selected.</dd>
  108. <dt><strong><code>recall_min</code></strong> :&ensp;<code>float</code>, optional <code>(default=0.01)</code></dt>
  109. <dd>The minimal recall of a rule to be selected.</dd>
  110. <dt><strong><code>n_estimators</code></strong> :&ensp;<code>int</code>, optional <code>(default=10)</code></dt>
  111. <dd>The number of base estimators (rules) to use for prediction. More are
  112. built before selection. All are available in the estimators_ attribute.</dd>
  113. <dt><strong><code>max_samples</code></strong> :&ensp;<code>int</code> or <code>float</code>, optional <code>(default=.8)</code></dt>
  114. <dd>The number of samples to draw from X to train each decision tree, from
  115. which rules are generated and selected.
  116. - If int, then draw <code>max_samples</code> samples.
  117. - If float, then draw <code>max_samples * X.shape[0]</code> samples.
  118. If max_samples is larger than the number of samples provided,
  119. all samples will be used for all trees (no sampling).</dd>
  120. <dt><strong><code>max_samples_features</code></strong> :&ensp;<code>int</code> or <code>float</code>, optional <code>(default=1.0)</code></dt>
  121. <dd>The number of features to draw from X to train each decision tree, from
  122. which rules are generated and selected.
  123. - If int, then draw <code>max_features</code> features.
  124. - If float, then draw <code>max_features * X.shape[1]</code> features.</dd>
  125. <dt><strong><code>bootstrap</code></strong> :&ensp;<code>boolean</code>, optional <code>(default=False)</code></dt>
  126. <dd>Whether samples are drawn with replacement.</dd>
  127. <dt><strong><code>bootstrap_features</code></strong> :&ensp;<code>boolean</code>, optional <code>(default=False)</code></dt>
  128. <dd>Whether features are drawn with replacement.</dd>
  129. <dt><strong><code>max_depth</code></strong> :&ensp;<code>integer</code> or <code>List</code> or <code>None</code>, optional <code>(default=3)</code></dt>
  130. <dd>The maximum depth of the decision trees. If None, then nodes are
  131. expanded until all leaves are pure or until all leaves contain less
  132. than min_samples_split samples.
  133. If an iterable is passed, you will train n_estimators
  134. for each tree depth. It allows you to create and compare
  135. rules of different length.</dd>
  136. <dt><strong><code>max_depth_duplication</code></strong> :&ensp;<code>integer</code>, optional <code>(default=None)</code></dt>
  137. <dd>The maximum depth of the decision tree for rule deduplication,
  138. if None then no deduplication occurs.</dd>
  139. <dt><strong><code>max_features</code></strong> :&ensp;<code>int, float, string</code> or <code>None</code>, optional <code>(default="auto")</code></dt>
  140. <dd>
  141. <p>The number of features considered (by each decision tree) when looking
  142. for the best split:</p>
  143. <ul>
  144. <li>If int, then consider <code>max_features</code> features at each split.</li>
  145. <li>If float, then <code>max_features</code> is a percentage and
  146. <code>int(max_features * n_features)</code> features are considered at each
  147. split.</li>
  148. <li>If "auto", then <code>max_features=sqrt(n_features)</code>.</li>
  149. <li>If "sqrt", then <code>max_features=sqrt(n_features)</code> (same as "auto").</li>
  150. <li>If "log2", then <code>max_features=log2(n_features)</code>.</li>
  151. <li>If None, then <code>max_features=n_features</code>.</li>
  152. </ul>
  153. <p>Note: the search for a split does not stop until at least one
  154. valid partition of the node samples is found, even if it requires to
  155. effectively inspect more than <code>max_features</code> features.</p>
  156. </dd>
  157. <dt><strong><code>min_samples_split</code></strong> :&ensp;<code>int, float</code>, optional <code>(default=2)</code></dt>
  158. <dd>The minimum number of samples required to split an internal node for
  159. each decision tree.
  160. - If int, then consider <code>min_samples_split</code> as the minimum number.
  161. - If float, then <code>min_samples_split</code> is a percentage and
  162. <code>ceil(min_samples_split * n_samples)</code> are the minimum
  163. number of samples for each split.</dd>
  164. <dt><strong><code>n_jobs</code></strong> :&ensp;<code>integer</code>, optional <code>(default=1)</code></dt>
  165. <dd>The number of jobs to run in parallel for both <code>fit</code> and <code>predict</code>.
  166. If -1, then the number of jobs is set to the number of cores.</dd>
  167. <dt><strong><code>random_state</code></strong> :&ensp;<code>int, RandomState instance</code> or <code>None</code>, optional</dt>
  168. <dd>
  169. <ul>
  170. <li>If int, random_state is the seed used by the random number generator.</li>
  171. <li>If RandomState instance, random_state is the random number generator.</li>
  172. <li>If None, the random number generator is the RandomState instance used
  173. by <code>np.random</code>.</li>
  174. </ul>
  175. </dd>
  176. <dt><strong><code>verbose</code></strong> :&ensp;<code>int</code>, optional <code>(default=0)</code></dt>
  177. <dd>Controls the verbosity of the tree building process.</dd>
  178. </dl>
  179. <h2 id="attributes">Attributes</h2>
  180. <p>rules_ : dict of tuples (rule, precision, recall, nb).
  181. The collection of <code>n_estimators</code> rules used in the <code>predict</code> method.
  182. The rules are generated by fitted sub-estimators (decision trees). Each
  183. rule satisfies recall_min and precision_min conditions. The selection
  184. is done according to OOB precisions.</p>
  185. <dl>
  186. <dt><strong><code>estimators_</code></strong> :&ensp;<code>list</code> of <code>DecisionTreeClassifier</code></dt>
  187. <dd>The collection of fitted sub-estimators used to generate candidate
  188. rules.</dd>
  189. <dt><strong><code>estimators_samples_</code></strong> :&ensp;<code>list</code> of <code>arrays</code></dt>
  190. <dd>The subset of drawn samples (i.e., the in-bag samples) for each base
  191. estimator.</dd>
  192. <dt><strong><code>estimators_features_</code></strong> :&ensp;<code>list</code> of <code>arrays</code></dt>
  193. <dd>The subset of drawn features for each base estimator.</dd>
  194. <dt><strong><code>max_samples_</code></strong> :&ensp;<code>integer</code></dt>
  195. <dd>The actual number of samples</dd>
  196. <dt><strong><code>n_features_</code></strong> :&ensp;<code>integer</code></dt>
  197. <dd>The number of features when <code>fit</code> is performed.</dd>
  198. <dt><strong><code>classes_</code></strong> :&ensp;<code>array, shape (n_classes,)</code></dt>
  199. <dd>The classes labels.</dd>
  200. </dl></div>
  201. <details class="source">
  202. <summary>
  203. <span>Expand source code</span>
  204. </summary>
  205. <pre><code class="python">class FPSkopeClassifier(SkopeRulesClassifier):
  206. def __init__(self,
  207. minsupport=0.1,
  208. maxcardinality=2,
  209. verbose=False,
  210. precision_min=0.5,
  211. recall_min=0.01,
  212. n_estimators=10,
  213. max_samples=.8,
  214. max_samples_features=1.,
  215. bootstrap=False,
  216. bootstrap_features=False,
  217. max_depth=3,
  218. max_depth_duplication=None,
  219. max_features=1.,
  220. min_samples_split=2,
  221. n_jobs=1,
  222. random_state=None):
  223. super().__init__(precision_min,
  224. recall_min,
  225. n_estimators,
  226. max_samples,
  227. max_samples_features,
  228. bootstrap,
  229. bootstrap_features,
  230. max_depth,
  231. max_depth_duplication,
  232. max_features,
  233. min_samples_split,
  234. n_jobs,
  235. random_state,
  236. verbose)
  237. self.minsupport = minsupport
  238. self.maxcardinality = maxcardinality
  239. self.verbose = verbose
  240. def fit(self, X, y=None, feature_names=None, undiscretized_features=[], sample_weight=None):
  241. self.undiscretized_features = undiscretized_features
  242. super().fit(X, y, feature_names=feature_names, sample_weight=sample_weight)
  243. return self
  244. def _extract_rules(self, X, y) -&gt; List[str]:
  245. X = pd.DataFrame(X, columns=self.feature_placeholders)
  246. itemsets = extract_fpgrowth(X, minsupport=self.minsupport,
  247. maxcardinality=self.maxcardinality,
  248. verbose=self.verbose)
  249. return [itemsets_to_rules(itemsets)], [np.arange(X.shape[0])], [np.arange(len(self.feature_names))]
  250. def _score_rules(self, X, y, rules) -&gt; List[Rule]:
  251. return score_precision_recall(X, y,
  252. rules,
  253. self.estimators_samples_,
  254. self.estimators_features_,
  255. self.feature_placeholders,
  256. oob=False)</code></pre>
  257. </details>
  258. <h3>Ancestors</h3>
  259. <ul class="hlist">
  260. <li><a title="imodels.rule_set.skope_rules.SkopeRulesClassifier" href="skope_rules.html#imodels.rule_set.skope_rules.SkopeRulesClassifier">SkopeRulesClassifier</a></li>
  261. <li>sklearn.base.BaseEstimator</li>
  262. <li>sklearn.utils._estimator_html_repr._HTMLDocumentationLinkMixin</li>
  263. <li>sklearn.utils._metadata_requests._MetadataRequester</li>
  264. <li><a title="imodels.rule_set.rule_set.RuleSet" href="rule_set.html#imodels.rule_set.rule_set.RuleSet">RuleSet</a></li>
  265. <li>sklearn.base.ClassifierMixin</li>
  266. </ul>
  267. <h3>Methods</h3>
  268. <dl>
  269. <dt id="imodels.rule_set.fpskope.FPSkopeClassifier.set_fit_request"><code class="name flex">
  270. <span>def <span class="ident">set_fit_request</span></span>(<span>self: <a title="imodels.rule_set.fpskope.FPSkopeClassifier" href="#imodels.rule_set.fpskope.FPSkopeClassifier">FPSkopeClassifier</a>, *, feature_names: Union[bool, ForwardRef(None), str] = '$UNCHANGED$', sample_weight: Union[bool, ForwardRef(None), str] = '$UNCHANGED$', undiscretized_features: Union[bool, ForwardRef(None), str] = '$UNCHANGED$') ‑> <a title="imodels.rule_set.fpskope.FPSkopeClassifier" href="#imodels.rule_set.fpskope.FPSkopeClassifier">FPSkopeClassifier</a></span>
  271. </code></dt>
  272. <dd>
  273. <div class="desc"><p>Request metadata passed to the <code>fit</code> method.</p>
  274. <p>Note that this method is only relevant if
  275. <code>enable_metadata_routing=True</code> (see :func:<code>sklearn.set_config</code>).
  276. Please see :ref:<code>User Guide &lt;metadata_routing&gt;</code> on how the routing
  277. mechanism works.</p>
  278. <p>The options for each parameter are:</p>
  279. <ul>
  280. <li>
  281. <p><code>True</code>: metadata is requested, and passed to <code>fit</code> if provided. The request is ignored if metadata is not provided.</p>
  282. </li>
  283. <li>
  284. <p><code>False</code>: metadata is not requested and the meta-estimator will not pass it to <code>fit</code>.</p>
  285. </li>
  286. <li>
  287. <p><code>None</code>: metadata is not requested, and the meta-estimator will raise an error if the user provides it.</p>
  288. </li>
  289. <li>
  290. <p><code>str</code>: metadata should be passed to the meta-estimator with this given alias instead of the original name.</p>
  291. </li>
  292. </ul>
  293. <p>The default (<code>sklearn.utils.metadata_routing.UNCHANGED</code>) retains the
  294. existing request. This allows you to change the request for some
  295. parameters and not others.</p>
  296. <div class="admonition versionadded">
  297. <p class="admonition-title">Added in version:&ensp;1.3</p>
  298. </div>
  299. <div class="admonition note">
  300. <p class="admonition-title">Note</p>
  301. <p>This method is only relevant if this estimator is used as a
  302. sub-estimator of a meta-estimator, e.g. used inside a
  303. :class:<code>~sklearn.pipeline.Pipeline</code>. Otherwise it has no effect.</p>
  304. </div>
  305. <h2 id="parameters">Parameters</h2>
  306. <dl>
  307. <dt><strong><code>feature_names</code></strong> :&ensp;<code>str, True, False,</code> or <code>None</code>,
  308. default=<code>sklearn.utils.metadata_routing.UNCHANGED</code></dt>
  309. <dd>Metadata routing for <code>feature_names</code> parameter in <code>fit</code>.</dd>
  310. <dt><strong><code>sample_weight</code></strong> :&ensp;<code>str, True, False,</code> or <code>None</code>,
  311. default=<code>sklearn.utils.metadata_routing.UNCHANGED</code></dt>
  312. <dd>Metadata routing for <code>sample_weight</code> parameter in <code>fit</code>.</dd>
  313. <dt><strong><code>undiscretized_features</code></strong> :&ensp;<code>str, True, False,</code> or <code>None</code>,
  314. default=<code>sklearn.utils.metadata_routing.UNCHANGED</code></dt>
  315. <dd>Metadata routing for <code>undiscretized_features</code> parameter in <code>fit</code>.</dd>
  316. </dl>
  317. <h2 id="returns">Returns</h2>
  318. <dl>
  319. <dt><strong><code>self</code></strong> :&ensp;<code>object</code></dt>
  320. <dd>The updated object.</dd>
  321. </dl></div>
  322. <details class="source">
  323. <summary>
  324. <span>Expand source code</span>
  325. </summary>
  326. <pre><code class="python">def func(**kw):
  327. &#34;&#34;&#34;Updates the request for provided parameters
  328. This docstring is overwritten below.
  329. See REQUESTER_DOC for expected functionality
  330. &#34;&#34;&#34;
  331. if not _routing_enabled():
  332. raise RuntimeError(
  333. &#34;This method is only available when metadata routing is enabled.&#34;
  334. &#34; You can enable it using&#34;
  335. &#34; sklearn.set_config(enable_metadata_routing=True).&#34;
  336. )
  337. if self.validate_keys and (set(kw) - set(self.keys)):
  338. raise TypeError(
  339. f&#34;Unexpected args: {set(kw) - set(self.keys)}. Accepted arguments&#34;
  340. f&#34; are: {set(self.keys)}&#34;
  341. )
  342. requests = instance._get_metadata_request()
  343. method_metadata_request = getattr(requests, self.name)
  344. for prop, alias in kw.items():
  345. if alias is not UNCHANGED:
  346. method_metadata_request.add_request(param=prop, alias=alias)
  347. instance._metadata_request = requests
  348. return instance</code></pre>
  349. </details>
  350. </dd>
  351. </dl>
  352. <h3>Inherited members</h3>
  353. <ul class="hlist">
  354. <li><code><b><a title="imodels.rule_set.skope_rules.SkopeRulesClassifier" href="skope_rules.html#imodels.rule_set.skope_rules.SkopeRulesClassifier">SkopeRulesClassifier</a></b></code>:
  355. <ul class="hlist">
  356. <li><code><a title="imodels.rule_set.skope_rules.SkopeRulesClassifier.fit" href="skope_rules.html#imodels.rule_set.skope_rules.SkopeRulesClassifier.fit">fit</a></code></li>
  357. <li><code><a title="imodels.rule_set.skope_rules.SkopeRulesClassifier.predict" href="skope_rules.html#imodels.rule_set.skope_rules.SkopeRulesClassifier.predict">predict</a></code></li>
  358. <li><code><a title="imodels.rule_set.skope_rules.SkopeRulesClassifier.predict_proba" href="skope_rules.html#imodels.rule_set.skope_rules.SkopeRulesClassifier.predict_proba">predict_proba</a></code></li>
  359. <li><code><a title="imodels.rule_set.skope_rules.SkopeRulesClassifier.set_score_request" href="skope_rules.html#imodels.rule_set.skope_rules.SkopeRulesClassifier.set_score_request">set_score_request</a></code></li>
  360. </ul>
  361. </li>
  362. </ul>
  363. </dd>
  364. </dl>
  365. </section>
  366. </article>
  367. <nav id="sidebar">
  368. <h1>Index 🔍</h1>
  369. <div class="toc">
  370. <ul></ul>
  371. </div>
  372. <ul id="index">
  373. <li><h3>Super-module</h3>
  374. <ul>
  375. <li><code><a title="imodels.rule_set" href="index.html">imodels.rule_set</a></code></li>
  376. </ul>
  377. </li>
  378. <li><h3><a href="#header-classes">Classes</a></h3>
  379. <ul>
  380. <li>
  381. <h4><code><a title="imodels.rule_set.fpskope.FPSkopeClassifier" href="#imodels.rule_set.fpskope.FPSkopeClassifier">FPSkopeClassifier</a></code></h4>
  382. <ul class="">
  383. <li><code><a title="imodels.rule_set.fpskope.FPSkopeClassifier.set_fit_request" href="#imodels.rule_set.fpskope.FPSkopeClassifier.set_fit_request">set_fit_request</a></code></li>
  384. </ul>
  385. </li>
  386. </ul>
  387. </li>
  388. </ul>
  389. <p><img align="center" width=100% src="https://csinva.io/imodels/img/anim.gif"> </img></p>
  390. <!-- add wave animation -->
  391. </nav>
  392. </main>
  393. <footer id="footer">
  394. </footer>
  395. </body>
  396. </html>
  397. <!-- add github corner -->
  398. <a href="https://github.com/csinva/imodels" class="github-corner" aria-label="View source on GitHub"><svg width="120" height="120" viewBox="0 0 250 250" style="fill:#70B7FD; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="m128.3,109.0 c113.8,99.7 119.0,89.6 119.0,89.6 c122.0,82.7 120.5,78.6 120.5,78.6 c119.2,72.0 123.4,76.3 123.4,76.3 c127.3,80.9 125.5,87.3 125.5,87.3 c122.9,97.6 130.6,101.9 134.4,103.2" fill="currentcolor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
  399. <!-- add wave animation stylesheet -->
  400. <link rel="stylesheet" href="github.css">
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...