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
|
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
- <meta name="generator" content="pdoc 0.10.0" />
- <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>
- <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>
- <link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
- <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>
- <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>
- <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>
- <script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
- <script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
- </head>
- <body>
- <main>
- <article id="content">
- <section id="section-intro">
- <p align="center">
- <img align="center" width=60% src="https://csinva.io/imodels/img/imodels_logo.svg?sanitize=True&kill_cache=1"> </img>
- <br/>
- Python package for concise, transparent, and accurate predictive modeling. All sklearn-compatible and easy to use.
- </p>
- <p align="center">
- <a href="https://csinva.github.io/imodels/">π docs</a> β’
- <a href="#demo-notebooks">π demo notebooks</a>
- </p>
- <p align="center">
- <img src="https://img.shields.io/badge/license-mit-blue.svg">
- <img src="https://img.shields.io/badge/python-3.7--3.10-blue">
- <a href="https://doi.org/10.21105/joss.03192"><img src="https://joss.theoj.org/papers/10.21105/joss.03192/status.svg"></a>
- <a href="https://github.com/csinva/imodels/actions"><img src="https://github.com/csinva/imodels/workflows/tests/badge.svg"></a>
- <!--img src="https://img.shields.io/github/checks-status/csinva/imodels/master"-->
- <img src="https://img.shields.io/pypi/v/imodels?color=orange">
- <img src="https://static.pepy.tech/personalized-badge/imodels?period=total&units=none&left_color=gray&right_color=orange&left_text=downloads&kill_cache=12">
- </p>
- <p><img align="center" width=100% src="https://csinva.io/imodels/img/anim.gif"> </img></p>
- <p>Modern machine-learning models are increasingly complex, often making them difficult to interpret. This package provides a simple interface for fitting and using state-of-the-art interpretable models, all compatible with scikit-learn. These models can often replace black-box models (e.g. random forests) with simpler models (e.g. rule lists) while improving interpretability and computational efficiency, all without sacrificing predictive accuracy! Simply import a classifier or regressor and use the <code>fit</code> and <code>predict</code> methods, same as standard scikit-learn models.</p>
- <pre><code class="language-python">from imodels import BoostedRulesClassifier, FIGSClassifier, SkopeRulesClassifier
- from imodels import RuleFitRegressor, HSTreeRegressorCV, SLIMRegressor
- model = BoostedRulesClassifier() # initialize a model
- model.fit(X_train, y_train) # fit model
- preds = model.predict(X_test) # predictions: shape is (n_test, 1)
- preds_proba = model.predict_proba(X_test) # predicted probabilities: shape is (n_test, n_classes)
- print(model) # print the rule-based model
- -----------------------------
- # the model consists of the following 3 rules
- # if X1 > 5: then 80.5% risk
- # else if X2 > 5: then 40% risk
- # else: 10% risk
- </code></pre>
- <h3 id="installation">Installation</h3>
- <p>Install with <code>pip install <a title="imodels" href="#imodels">imodels</a></code> (see <a href="https://github.com/csinva/imodels/blob/master/docs/troubleshooting.md">here</a> for help). </p>
- <h3 id="supported-models">Supported models</h3>
- <table>
- <thead>
- <tr>
- <th align="left">Model</th>
- <th>Reference</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td align="left">Rulefit rule set</td>
- <td><a href="https://csinva.io/imodels/rule_set/rule_fit.html">ποΈ</a>, <a href="https://github.com/christophM/rulefit">π</a>, <a href="http://statweb.stanford.edu/~jhf/ftp/RuleFit.pdf">π</a></td>
- <td>Fits a sparse linear model on rules extracted from decision trees</td>
- </tr>
- <tr>
- <td align="left">Skope rule set</td>
- <td><a href="https://csinva.io/imodels/rule_set/skope_rules.html#imodels.rule_set.skope_rules.SkopeRulesClassifier">ποΈ</a>, <a href="https://github.com/scikit-learn-contrib/skope-rules">π</a></td>
- <td>Extracts rules from gradient-boosted trees, deduplicates them,<br/>then linearly combines them based on their OOB precision</td>
- </tr>
- <tr>
- <td align="left">Boosted rule set</td>
- <td><a href="https://csinva.io/imodels/rule_set/boosted_rules.html">ποΈ</a>, <a href="https://github.com/jaimeps/adaboost-implementation">π</a>, <a href="https://www.sciencedirect.com/science/article/pii/S002200009791504X">π</a></td>
- <td>Sequentially fits a set of rules with Adaboost</td>
- </tr>
- <tr>
- <td align="left">Slipper rule set</td>
- <td><a href="https://csinva.io/imodels/rule_set/slipper.html">ποΈ</a>, γ
€γ
€<a href="https://www.aaai.org/Papers/AAAI/1999/AAAI99-049.pdf">π</a></td>
- <td>Sequentially learns a set of rules with SLIPPER</td>
- </tr>
- <tr>
- <td align="left">Bayesian rule set</td>
- <td><a href="https://csinva.io/imodels/rule_set/brs.html#imodels.rule_set.brs.BayesianRuleSetClassifier">ποΈ</a>, <a href="https://github.com/wangtongada/BOA">π</a>, <a href="https://www.jmlr.org/papers/volume18/16-003/16-003.pdf">π</a></td>
- <td>Finds concise rule set with Bayesian sampling (slow)</td>
- </tr>
- <tr>
- <td align="left">Optimal rule list</td>
- <td><a href="https://csinva.io/imodels/rule_list/corels_wrapper.html#imodels.rule_list.corels_wrapper.OptimalRuleListClassifier">ποΈ</a>, <a href="https://github.com/corels/pycorels">π</a>, <a href="https://www.jmlr.org/papers/volume18/17-716/17-716.pdf">π</a></td>
- <td>Fits rule list using global optimization for sparsity (CORELS)</td>
- </tr>
- <tr>
- <td align="left">Bayesian rule list</td>
- <td><a href="https://csinva.io/imodels/rule_list/bayesian_rule_list/bayesian_rule_list.html#imodels.rule_list.bayesian_rule_list.bayesian_rule_list.BayesianRuleListClassifier">ποΈ</a>, <a href="https://github.com/tmadl/sklearn-expertsys">π</a>, <a href="https://arxiv.org/abs/1602.08610">π</a></td>
- <td>Fits compact rule list distribution with Bayesian sampling (slow)</td>
- </tr>
- <tr>
- <td align="left">Greedy rule list</td>
- <td><a href="https://csinva.io/imodels/rule_list/greedy_rule_list.html">ποΈ</a>, <a href="https://medium.com/@penggongting/implementing-decision-tree-from-scratch-in-python-c732e7c69aea">π</a></td>
- <td>Uses CART to fit a list (only a single path), rather than a tree</td>
- </tr>
- <tr>
- <td align="left">OneR rule list</td>
- <td><a href="https://csinva.io/imodels/rule_list/one_r.html">ποΈ</a>, γ
€γ
€<a href="https://link.springer.com/article/10.1023/A:1022631118932">π</a></td>
- <td>Fits rule list restricted to only one feature</td>
- </tr>
- <tr>
- <td align="left">Optimal rule tree</td>
- <td><a href="https://csinva.io/imodels/tree/gosdt/pygosdt.html#imodels.tree.gosdt.pygosdt.OptimalTreeClassifier">ποΈ</a>, <a href="https://github.com/Jimmy-Lin/GeneralizedOptimalSparseDecisionTrees">π</a>, <a href="https://arxiv.org/abs/2006.08690">π</a></td>
- <td>Fits succinct tree using global optimization for sparsity (GOSDT)</td>
- </tr>
- <tr>
- <td align="left">Greedy rule tree</td>
- <td><a href="https://csinva.io/imodels/tree/cart_wrapper.html">ποΈ</a>, <a href="https://scikit-learn.org/stable/modules/tree.html">π</a>, <a href="https://www.taylorfrancis.com/books/mono/10.1201/9781315139470/classification-regression-trees-leo-breiman-jerome-friedman-richard-olshen-charles-stone">π</a></td>
- <td>Greedily fits tree using CART</td>
- </tr>
- <tr>
- <td align="left">C4.5 rule tree</td>
- <td><a href="https://csinva.io/imodels/tree/c45_tree/c45_tree.html#imodels.tree.c45_tree.c45_tree.C45TreeClassifier">ποΈ</a>, <a href="https://github.com/RaczeQ/scikit-learn-C4.5-tree-classifier">π</a>, <a href="https://link.springer.com/article/10.1007/BF00993309">π</a></td>
- <td>Greedily fits tree using C4.5</td>
- </tr>
- <tr>
- <td align="left">TAO rule tree</td>
- <td><a href="https://csinva.io/imodels/tree/tao.html">ποΈ</a>, γ
€γ
€<a href="https://proceedings.neurips.cc/paper/2018/hash/185c29dc24325934ee377cfda20e414c-Abstract.html">π</a></td>
- <td>Fits tree using alternating optimization</td>
- </tr>
- <tr>
- <td align="left">Iterative random<br/>forest</td>
- <td><a href="https://csinva.io/imodels/tree/iterative_random_forest/iterative_random_forest.html">ποΈ</a>, <a href="https://github.com/Yu-Group/iterative-Random-Forest">π</a>, <a href="https://www.pnas.org/content/115/8/1943">π</a></td>
- <td>Repeatedly fit random forest, giving features with<br/>high importance a higher chance of being selected</td>
- </tr>
- <tr>
- <td align="left">Sparse integer<br/>linear model</td>
- <td><a href="https://csinva.io/imodels/algebraic/slim.html">ποΈ</a>, γ
€γ
€<a href="https://link.springer.com/article/10.1007/s10994-015-5528-6">π</a></td>
- <td>Sparse linear model with integer coefficients</td>
- </tr>
- <tr>
- <td align="left"><b>Greedy tree sums</b></td>
- <td><a href="https://csinva.io/imodels/tree/figs.html#imodels.tree.figs">ποΈ</a>, γ
€γ
€<a href="https://arxiv.org/abs/2201.11931">π</a></td>
- <td>Sum of small trees with very few total rules (FIGS)</td>
- </tr>
- <tr>
- <td align="left"><b>Hierarchical<br/> shrinkage wrapper</b></td>
- <td><a href="https://csinva.io/imodels/tree/hierarchical_shrinkage.html">ποΈ</a>, γ
€γ
€<a href="https://arxiv.org/abs/2202.00858">π</a></td>
- <td>Improve any tree-based model with ultra-fast, post-hoc regularization</td>
- </tr>
- <tr>
- <td align="left">Distillation<br/>wrapper</td>
- <td><a href="https://csinva.io/imodels/util/distillation.html">ποΈ</a></td>
- <td>Train a black-box model,<br/>then distill it into an interpretable model</td>
- </tr>
- <tr>
- <td align="left">More models</td>
- <td>β</td>
- <td>(Coming soon!) Lightweight Rule Induction, MLRules, …</td>
- </tr>
- </tbody>
- </table>
- <p align="center">
- Docs <a href="https://csinva.io/imodels/">ποΈ</a>, Reference code implementation π, Research paper π
- </br>
- </p>
- <h2 id="whats-the-difference-between-the-models">What's the difference between the models?</h2>
- <p>The final form of the above models takes one of the following forms, which aim to be simultaneously simple to understand and highly predictive:</p>
- <table>
- <thead>
- <tr>
- <th align="center">Rule set</th>
- <th align="center">Rule list</th>
- <th align="center">Rule tree</th>
- <th align="center">Algebraic models</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td align="center"><img src="https://csinva.io/imodels/img/rule_set.jpg" width="100%"></td>
- <td align="center"><img src="https://csinva.io/imodels/img/rule_list.jpg"></td>
- <td align="center"><img src="https://csinva.io/imodels/img/rule_tree.jpg"></td>
- <td align="center"><img src="https://csinva.io/imodels/img/algebraic_models.jpg"></td>
- </tr>
- </tbody>
- </table>
- <p>Different models and algorithms vary not only in their final form but also in different choices made during modeling, such as how they generate, select, and postprocess rules:</p>
- <table>
- <thead>
- <tr>
- <th align="center">Rule candidate generation</th>
- <th align="center">Rule selection</th>
- <th align="center">Rule postprocessing</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td align="center"><img src="https://csinva.io/imodels/img/rule_candidates.jpg"></td>
- <td align="center"><img src="https://csinva.io/imodels/img/rule_overfit.jpg"></td>
- <td align="center"><img src="https://csinva.io/imodels/img/rule_pruned.jpg"></td>
- </tr>
- </tbody>
- </table>
- <details>
- <summary>Ex. RuleFit vs. SkopeRules</summary>
- RuleFit and SkopeRules differ only in the way they prune rules: RuleFit uses a linear model whereas SkopeRules heuristically deduplicates rules sharing overlap.
- </details>
- <details>
- <summary>Ex. Bayesian rule lists vs. greedy rule lists</summary>
- Bayesian rule lists and greedy rule lists differ in how they select rules; bayesian rule lists perform a global optimization over possible rule lists while Greedy rule lists pick splits sequentially to maximize a given criterion.
- </details>
- <details>
- <summary>Ex. FPSkope vs. SkopeRules</summary>
- FPSkope and SkopeRules differ only in the way they generate candidate rules: FPSkope uses FPgrowth whereas SkopeRules extracts rules from decision trees.
- </details>
- <h2 id="demo-notebooks">Demo notebooks</h2>
- <p>Demos are contained in the <a href="notebooks">notebooks</a> folder.</p>
- <details>
- <summary><a href="notebooks/imodels_demo.ipynb">Quickstart demo</a></summary>
- Shows how to fit, predict, and visualize with different interpretable models
- </details>
- <details>
- <summary><a href="https://colab.research.google.com/drive/1WfqvSjegygT7p0gyqiWpRpiwz2ePtiao#scrollTo=bLnLknIuoWtQ">Quickstart colab demo</a> <a href="https://colab.research.google.com/drive/1WfqvSjegygT7p0gyqiWpRpiwz2ePtiao#scrollTo=bLnLknIuoWtQ"> <img src="https://colab.research.google.com/assets/colab-badge.svg"></a></summary>
- Shows how to fit, predict, and visualize with different interpretable models
- </details>
- <details>
- <summary><a href="https://github.com/csinva/iai-clinical-decision-rule/blob/master/notebooks/05_fit_interpretable_models.ipynb">Clinical decision rule notebook</a></summary>
- Shows an example of using <code>imodels</code> for deriving a clinical decision rule
- </details>
- <details>
- <summary>Posthoc analysis</summary>
- We also include some demos of posthoc analysis, which occurs after fitting models:
- <a href="notebooks/posthoc_analysis.ipynb">posthoc.ipynb</a> shows different simple analyses to interpret a trained model and
- <a href="notebooks/uncertainty_analysis.ipynb">uncertainty.ipynb</a> contains basic code to get uncertainty estimates for a model
- </details>
- <h2 id="support-for-different-tasks">Support for different tasks</h2>
- <p>Different models support different machine-learning tasks. Current support for different models is given below (each of these models can be imported directly from imodels (e.g. <code>from <a title="imodels" href="#imodels">imodels</a> import RuleFitClassifier</code>):</p>
- <table>
- <thead>
- <tr>
- <th align="left">Model</th>
- <th align="center">Binary classification</th>
- <th align="center">Regression</th>
- <th>Notes</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td align="left">Rulefit rule set</td>
- <td align="center"><a href="https://csinva.io/imodels/rule_set/rule_fit.html#imodels.rule_set.rule_fit.RuleFitClassifier">RuleFitClassifier</a></td>
- <td align="center"><a href="https://csinva.io/imodels/rule_set/rule_fit.html#imodels.rule_set.rule_fit.RuleFitRegressor">RuleFitRegressor</a></td>
- <td></td>
- </tr>
- <tr>
- <td align="left">Skope rule set</td>
- <td align="center"><a href="https://csinva.io/imodels/rule_set/slipper.html#imodels.rule_set.slipper.SlipperClassifier">SkopeRulesClassifier</a></td>
- <td align="center"></td>
- <td></td>
- </tr>
- <tr>
- <td align="left">Boosted rule set</td>
- <td align="center"><a href="https://csinva.io/imodels/rule_set/boosted_rules.html#imodels.rule_set.boosted_rules.BoostedRulesClassifier">BoostedRulesClassifier</a></td>
- <td align="center"></td>
- <td></td>
- </tr>
- <tr>
- <td align="left">SLIPPER rule set</td>
- <td align="center"><a href="https://csinva.io/imodels/rule_set/slipper.html#imodels.rule_set.slipper.SlipperClassifier">SlipperClassifier</a></td>
- <td align="center"></td>
- <td></td>
- </tr>
- <tr>
- <td align="left">Bayesian rule set</td>
- <td align="center"><a href="https://csinva.io/imodels/rule_set/brs.html#imodels.rule_set.brs.BayesianRuleSetClassifier">BayesianRuleSetClassifier</a></td>
- <td align="center"></td>
- <td>Fails for large problems</td>
- </tr>
- <tr>
- <td align="left">Optimal rule list (CORELS)</td>
- <td align="center"><a href="https://csinva.io/imodels/rule_list/corels_wrapper.html#imodels.rule_list.corels_wrapper.OptimalRuleListClassifier">OptimalRuleListClassifier</a></td>
- <td align="center"></td>
- <td>Requires <a href="https://pypi.org/project/corels/">corels</a>, fails for large problems</td>
- </tr>
- <tr>
- <td align="left">Bayesian rule list</td>
- <td align="center"><a href="https://csinva.io/imodels/rule_list/bayesian_rule_list/bayesian_rule_list.html#imodels.rule_list.bayesian_rule_list.bayesian_rule_list.BayesianRuleListClassifier">BayesianRuleListClassifier</a></td>
- <td align="center"></td>
- <td></td>
- </tr>
- <tr>
- <td align="left">Greedy rule list</td>
- <td align="center"><a href="https://csinva.io/imodels/rule_list/greedy_rule_list.html#imodels.rule_list.greedy_rule_list.GreedyRuleListClassifier">GreedyRuleListClassifier</a></td>
- <td align="center"></td>
- <td></td>
- </tr>
- <tr>
- <td align="left">OneR rule list</td>
- <td align="center"><a href="https://csinva.io/imodels/rule_list/one_r.html#imodels.rule_list.one_r.OneRClassifier">OneRClassifier</a></td>
- <td align="center"></td>
- <td></td>
- </tr>
- <tr>
- <td align="left">Optimal rule tree (GOSDT)</td>
- <td align="center"><a href="https://csinva.io/imodels/tree/gosdt/pygosdt.html#imodels.tree.gosdt.pygosdt.OptimalTreeClassifier">OptimalTreeClassifier</a></td>
- <td align="center"></td>
- <td>Requires <a href="https://pypi.org/project/gosdt/">gosdt</a>, fails for large problems</td>
- </tr>
- <tr>
- <td align="left">Greedy rule tree (CART)</td>
- <td align="center"><a href="https://csinva.io/imodels/tree/cart_wrapper.html#imodels.tree.cart_wrapper.GreedyTreeClassifier">GreedyTreeClassifier</a></td>
- <td align="center"><a href="https://csinva.io/imodels/tree/cart_wrapper.html#imodels.tree.cart_wrapper.GreedyTreeRegressor">GreedyTreeRegressor</a></td>
- <td></td>
- </tr>
- <tr>
- <td align="left">C4.5 rule tree</td>
- <td align="center"><a href="https://csinva.io/imodels/tree/c45_tree/c45_tree.html#imodels.tree.c45_tree.c45_tree.C45TreeClassifier">C45TreeClassifier</a></td>
- <td align="center"></td>
- <td></td>
- </tr>
- <tr>
- <td align="left">TAO rule tree</td>
- <td align="center"><a href="https://csinva.io/imodels/tree/tao.html#imodels.tree.tao.TaoTreeClassifier">TaoTreeClassifier</a></td>
- <td align="center"><a href="https://csinva.io/imodels/tree/tao.html#imodels.tree.tao.TaoTreeRegressor">TaoTreeRegressor</a></td>
- <td></td>
- </tr>
- <tr>
- <td align="left">Iterative random forest</td>
- <td align="center"><a href="https://csinva.io/imodels/tree/iterative_random_forest/iterative_random_forest.html#imodels.tree.iterative_random_forest.iterative_random_forest.IRFClassifier">IRFClassifier</a></td>
- <td align="center"></td>
- <td>Requires <a href="https://pypi.org/project/irf/">irf</a></td>
- </tr>
- <tr>
- <td align="left">Sparse integer linear model</td>
- <td align="center"><a href="https://csinva.io/imodels/algebraic/slim.html#imodels.algebraic.slim.SLIMClassifier">SLIMClassifier</a></td>
- <td align="center"><a href="https://csinva.io/imodels/algebraic/slim.html#imodels.algebraic.slim.SLIMRegressor">SLIMRegressor</a></td>
- <td>Requires extra dependencies for speed</td>
- </tr>
- <tr>
- <td align="left">Greedy tree sums (FIGS)</td>
- <td align="center"><a href="https://csinva.io/imodels/tree/figs.html#imodels.tree.figs.FIGSClassifier">FIGSClassifier</a></td>
- <td align="center"><a href="https://csinva.io/imodels/tree/figs.html#imodels.tree.figs.FIGSRegressor">FIGSRegressor</a></td>
- <td></td>
- </tr>
- <tr>
- <td align="left">Hierarchical shrinkage</td>
- <td align="center"><a href="https://csinva.io/imodels/tree/hierarchical_shrinkage.html#imodels.tree.hierarchical_shrinkage.HSTreeClassifierCV">HSTreeClassifierCV</a></td>
- <td align="center"><a href="https://csinva.io/imodels/tree/hierarchical_shrinkage.html#imodels.tree.hierarchical_shrinkage.HSTreeRegressorCV">HSTreeRegressorCV</a></td>
- <td>Wraps any sklearn tree-based model</td>
- </tr>
- <tr>
- <td align="left">Distillation</td>
- <td align="center"></td>
- <td align="center"><a href="https://csinva.io/imodels/docs/util/distillation.html#imodels.util.distillation.DistilledRegressor">DistilledRegressor</a></td>
- <td>Wraps any sklearn-compatible models</td>
- </tr>
- </tbody>
- </table>
- <h3 id="extras">Extras</h3>
- <details>
- <summary><a href="https://csinva.io/imodels/util/data_util.html#imodels.util.data_util.get_clean_dataset">Data-wrangling functions</a> for working with popular tabular datasets (e.g. compas).</summary>
- These functions, in conjunction with <a href="https://github.com/csinva/imodels-data">imodels-data</a> and <a href="https://github.com/Yu-Group/imodels-experiments">imodels-experiments</a>, make it simple to download data and run experiments on new models.
- </details>
- <details>
- <summary><a href="https://csinva.io/imodels/util/explain_errors.html">Explain classification errors</a> with a simple posthoc function.</summary>
- Fit an interpretable model to explain a previous model's errors (ex. in <a href="https://github.com/csinva/imodels/blob/master/notebooks/error_detection_demo.ipynb">this notebookπ</a>).
- </details>
- <details>
- <summary><a href="https://csinva.io/imodels/discretization/index.html">Fast and effective discretizers</a> for data preprocessing.</summary>
- <table>
- <thead>
- <tr>
- <th>Discretizer</th>
- <th>Reference</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>MDLP</td>
- <td><a href="https://csinva.io/imodels/discretization/mdlp.html#imodels.discretization.mdlp.MDLPDiscretizer">ποΈ</a>, <a href="https://github.com/navicto/Discretization-MDLPC">π</a>, <a href="https://trs.jpl.nasa.gov/handle/2014/35171">π</a></td>
- <td>Discretize using entropy minimization heuristic</td>
- </tr>
- <tr>
- <td>Simple</td>
- <td><a href="https://csinva.io/imodels/discretization/simple.html#imodels.discretization.simple.SimpleDiscretizer">ποΈ</a>, <a href="https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.KBinsDiscretizer.html">π</a></td>
- <td>Simple KBins discretization</td>
- </tr>
- <tr>
- <td>Random Forest</td>
- <td><a href="https://csinva.io/imodels/discretization/discretizer.html#imodels.discretization.discretizer.RFDiscretizer">ποΈ</a></td>
- <td>Discretize into bins based on random forest split popularity</td>
- </tr>
- </tbody>
- </table>
- </details>
- <details>
- <summary><a href="https://csinva.io/imodels/util/index.html">Rule-based utils</a> for customizing models</summary>
- The code here contains many useful and customizable functions for rule-based learning in the [util folder](https://csinva.io/imodels/util/index.html). This includes functions / classes for rule deduplication, rule screening, and converting between trees, rulesets, and neural networks.
- </details>
- <h2 id="our-favorite-models">Our favorite models</h2>
- <p>After developing and playing with <code><a title="imodels" href="#imodels">imodels</a></code>, we developed a few new models to overcome limitations of existing interpretable models.</p>
- <h3 id="figs-fast-interpretable-greedy-tree-sums">FIGS: Fast interpretable greedy-tree sums</h3>
- <p><a href="https://arxiv.org/abs/2201.11931">π Paper</a>, <a href="https://demos.csinva.io/figs/">π Post</a>, <a href="https://scholar.google.com/scholar?hl=en&as_sdt=0%2C5&q=fast+interpretable+greedy-tree+sums&oq=fast#d=gs_cit&u=%2Fscholar%3Fq%3Dinfo%3ADnPVL74Rop0J%3Ascholar.google.com%2F%26output%3Dcite%26scirp%3D0%26hl%3Den">π Citation</a></p>
- <p>Fast Interpretable Greedy-Tree Sums (FIGS) is an algorithm for fitting concise rule-based models. Specifically, FIGS generalizes CART to simultaneously grow a flexible number of trees in a summation. The total number of splits across all the trees can be restricted by a pre-specified threshold, keeping the model interpretable. Experiments across a wide array of real-world datasets show that FIGS achieves state-of-the-art prediction performance when restricted to just a few splits (e.g. less than 20).</p>
- <p align="center">
- <img src="https://demos.csinva.io/figs/diabetes_figs.svg?sanitize=True" width="50%">
- </p>
- <p align="center">
- <i>Example FIGS model. FIGS learns a sum of trees with a flexible number of trees; to make its prediction, it sums the result from each tree.</i>
- </p>
- <h3 id="hierarchical-shrinkage-post-hoc-regularization-for-tree-based-methods">Hierarchical shrinkage: post-hoc regularization for tree-based methods</h3>
- <p><a href="https://arxiv.org/abs/2202.00858">π Paper</a>, <a href="https://demos.csinva.io/shrinkage/">π Post</a>, <a href="https://scholar.google.com/scholar?hl=en&as_sdt=0%2C5&q=hierarchical+shrinkage+singh&btnG=&oq=hierar#d=gs_cit&u=%2Fscholar%3Fq%3Dinfo%3Azc6gtLx-aL4J%3Ascholar.google.com%2F%26output%3Dcite%26scirp%3D0%26hl%3Den">π Citation</a></p>
- <p>Hierarchical shrinkage is an extremely fast post-hoc regularization method which works on any decision tree (or tree-based ensemble, such as Random Forest). It does not modify the tree structure, and instead regularizes the tree by shrinking the prediction over each node towards the sample means of its ancestors (using a single regularization parameter). Experiments over a wide variety of datasets show that hierarchical shrinkage substantially increases the predictive performance of individual decision trees and decision-tree ensembles.</p>
- <h2 id="references">References</h2>
- <details>
- <summary>Readings</summary>
- <ul>
- <li>Interpretable ML good quick overview: murdoch et al. 2019, <a href="https://arxiv.org/pdf/1901.04592.pdf">pdf</a></li>
- <li>Interpretable ML book: molnar 2019, <a href="https://christophm.github.io/interpretable-ml-book/">pdf</a></li>
- <li>Case for interpretable models rather than post-hoc explanation: rudin 2019, <a href="https://arxiv.org/pdf/1811.10154.pdf">pdf</a></li>
- <li>Review on evaluating interpretability: doshi-velez & kim 2017, <a href="https://arxiv.org/pdf/1702.08608.pdf">pdf</a></li>
- </ul>
- </details>
- <details>
- <summary>Reference implementations (also linked above)</summary>
- The code here heavily derives from the wonderful work of previous projects. We seek to to extract out, unify, and maintain key parts of these projects.
- <ul>
- <li><a href="https://github.com/corels/pycorels">pycorels</a> - by <a href="https://github.com/fingoldin">@fingoldin</a> and the <a href="https://github.com/corels/corels">original CORELS team</a>
- <li><a href="https://github.com/tmadl/sklearn-expertsys">sklearn-expertsys</a> - by <a href="https://github.com/tmadl">@tmadl</a> and <a href="https://github.com/kenben">@kenben</a> based on original code by <a href="http://lethalletham.com/">Ben Letham</a></li>
- <li><a href="https://github.com/christophM/rulefit">rulefit</a> - by <a href="https://github.com/christophM">@christophM</a></li>
- <li><a href="https://github.com/scikit-learn-contrib/skope-rules">skope-rules</a> - by the <a href="https://github.com/scikit-learn-contrib/skope-rules/blob/master/AUTHORS.rst">skope-rules team</a> (including <a href="https://github.com/ngoix">@ngoix</a>, <a href="https://github.com/floriangardin">@floriangardin</a>, <a href="https://github.com/datajms">@datajms</a>, <a href="">Bibi Ndiaye</a>, <a href="">Ronan Gautier</a>)</li>
- <li><a href="https://github.com/wangtongada/BOA">boa</a> - by <a href="https://github.com/wangtongada">@wangtongada</a></li>
- </ul>
- </details>
- <details>
- <summary>Related packages</summary>
- <ul>
- <li><a href="https://github.com/trevorstephens/gplearn/tree/ad57cb18caafdb02cca861aea712f1bf3ed5016e">gplearn</a>: symbolic regression/classification</li>
- <li><a href="https://github.com/MilesCranmer/PySR">pysr</a>: fast symbolic regression</li>
- <li><a href="https://github.com/dswah/pyGAM">pygam</a>: generative additive models</li>
- <li><a href="https://github.com/interpretml/interpret">interpretml</a>: boosting-based gam</li>
- <li><a href="https://github.com/h2oai/h2o-3">h20 ai</a>: gams + glms (and more)</li>
- <li><a href="https://github.com/guillermo-navas-palencia/optbinning">optbinning</a>: data discretization / scoring models</li>
- </ul>
- </details>
- <details>
- <summary>Updates</summary>
- <ul>
- <li>For updates, star the repo, <a href="https://github.com/csinva/csinva.github.io">see this related repo</a>, or follow <a href="https://twitter.com/csinva_">@csinva_</a></li>
- <li>Please make sure to give authors of original methods / base implementations appropriate credit!</li>
- <li>Contributing: pull requests <a href="https://github.com/csinva/imodels/blob/master/docs/contributing.md">very welcome</a>!</li>
- </ul>
- </details>
- <p>If it's useful for you, please star/cite the package, and make sure to give authors of original methods / base implementations credit:</p>
- <pre><code class="language-r">@software{
- imodels2021,
- title = {imodels: a python package for fitting interpretable models},
- journal = {Journal of Open Source Software},
- publisher = {The Open Journal},
- year = {2021},
- author = {Singh, Chandan and Nasseri, Keyan and Tan, Yan Shuo and Tang, Tiffany and Yu, Bin},
- volume = {6},
- number = {61},
- pages = {3192},
- doi = {10.21105/joss.03192},
- url = {https://doi.org/10.21105/joss.03192},
- }
- </code></pre>
- <details class="source">
- <summary>
- <span>Expand source code</span>
- </summary>
- <pre><code class="python">"""
- .. include:: ../readme.md
- """
- # Python `imodels` package for interpretable models compatible with scikit-learn.
- # Github repo available [here](https://github.com/csinva/imodels)
- from .algebraic.slim import SLIMRegressor, SLIMClassifier
- from .discretization.discretizer import RFDiscretizer, BasicDiscretizer
- from .discretization.mdlp import MDLPDiscretizer, BRLDiscretizer
- from .experimental.bartpy import BART
- from .rule_list.bayesian_rule_list.bayesian_rule_list import BayesianRuleListClassifier
- from .rule_list.corels_wrapper import OptimalRuleListClassifier
- from .rule_list.greedy_rule_list import GreedyRuleListClassifier
- from .rule_list.one_r import OneRClassifier
- from .rule_set import boosted_rules
- from .rule_set.boosted_rules import *
- from .rule_set.boosted_rules import BoostedRulesClassifier
- from .rule_set.brs import BayesianRuleSetClassifier
- from .rule_set.fplasso import FPLassoRegressor, FPLassoClassifier
- from .rule_set.fpskope import FPSkopeClassifier
- from .rule_set.rule_fit import RuleFitRegressor, RuleFitClassifier
- from .rule_set.skope_rules import SkopeRulesClassifier
- from .rule_set.slipper import SlipperClassifier
- from .tree.c45_tree.c45_tree import C45TreeClassifier
- from .tree.cart_ccp import DecisionTreeCCPClassifier, DecisionTreeCCPRegressor, HSDecisionTreeCCPClassifierCV, \
- HSDecisionTreeCCPRegressorCV
- # from .tree.iterative_random_forest.iterative_random_forest import IRFClassifier
- # from .tree.optimal_classification_tree import OptimalTreeModel
- from .tree.cart_wrapper import GreedyTreeClassifier, GreedyTreeRegressor
- from .tree.figs import FIGSRegressor, FIGSClassifier, FIGSRegressorCV, FIGSClassifierCV
- from .tree.gosdt.pygosdt import OptimalTreeClassifier
- from .tree.gosdt.pygosdt_shrinkage import HSOptimalTreeClassifier, HSOptimalTreeClassifierCV
- from .tree.hierarchical_shrinkage import HSTreeRegressor, HSTreeClassifier, HSTreeRegressorCV, HSTreeClassifierCV
- from .tree.tao import TaoTreeClassifier, TaoTreeRegressor
- from .util.data_util import get_clean_dataset
- from .util.distillation import DistilledRegressor
- from .util.explain_errors import explain_classification_errors
- CLASSIFIERS = [BayesianRuleListClassifier, GreedyRuleListClassifier, SkopeRulesClassifier,
- BoostedRulesClassifier, SLIMClassifier, SlipperClassifier, BayesianRuleSetClassifier,
- C45TreeClassifier, OptimalTreeClassifier, OptimalRuleListClassifier, OneRClassifier,
- SlipperClassifier, RuleFitClassifier, TaoTreeClassifier,
- FIGSClassifier, HSTreeClassifier, HSTreeClassifierCV] # , IRFClassifier
- REGRESSORS = [RuleFitRegressor, SLIMRegressor, GreedyTreeClassifier, FIGSRegressor,
- TaoTreeRegressor, HSTreeRegressor, HSTreeRegressorCV, BART]
- DISCRETIZERS = [RFDiscretizer, BasicDiscretizer, MDLPDiscretizer, BRLDiscretizer]</code></pre>
- </details>
- </section>
- <section>
- <h2 class="section-title" id="header-submodules">Sub-modules</h2>
- <dl>
- <dt><code class="name"><a title="imodels.algebraic" href="algebraic/index.html">imodels.algebraic</a></code></dt>
- <dd>
- <div class="desc"><p>Generic class for models that take the form of algebraic equations (e.g. linear models).</p></div>
- </dd>
- <dt><code class="name"><a title="imodels.discretization" href="discretization/index.html">imodels.discretization</a></code></dt>
- <dd>
- <div class="desc"></div>
- </dd>
- <dt><code class="name"><a title="imodels.experimental" href="experimental/index.html">imodels.experimental</a></code></dt>
- <dd>
- <div class="desc"></div>
- </dd>
- <dt><code class="name"><a title="imodels.rule_list" href="rule_list/index.html">imodels.rule_list</a></code></dt>
- <dd>
- <div class="desc"><p>Generic class for models that take the form of a list of rules.</p></div>
- </dd>
- <dt><code class="name"><a title="imodels.rule_set" href="rule_set/index.html">imodels.rule_set</a></code></dt>
- <dd>
- <div class="desc"><p>Generic class for models that take the form of a set of (potentially overlapping) rules.</p></div>
- </dd>
- <dt><code class="name"><a title="imodels.tree" href="tree/index.html">imodels.tree</a></code></dt>
- <dd>
- <div class="desc"><p>Generic class for models that take the form of a tree of rules.</p></div>
- </dd>
- <dt><code class="name"><a title="imodels.util" href="util/index.html">imodels.util</a></code></dt>
- <dd>
- <div class="desc"><p>Shared utilities for implementing different interpretable models.</p></div>
- </dd>
- </dl>
- </section>
- <section>
- </section>
- <section>
- </section>
- <section>
- </section>
- </article>
- <nav id="sidebar">
- <h1>Index π</h1>
- <div class="toc">
- <ul>
- <li><a href="#installation">Installation</a></li>
- <li><a href="#supported-models">Supported models</a></li>
- <li><a href="#whats-the-difference-between-the-models">What's the difference between the models?</a></li>
- <li><a href="#demo-notebooks">Demo notebooks</a></li>
- <li><a href="#support-for-different-tasks">Support for different tasks</a><ul>
- <li><a href="#extras">Extras</a></li>
- </ul>
- </li><li><a href="#references">References</a></li>
- </ul>
- </div>
- <ul id="index">
- <li><h3>Our favorite models</h3>
- <ul>
- <li><a href="https://csinva.io/imodels/shrinkage.html">Hierarchical shrinkage: post-hoc regularization for tree-based methods</a></li>
- <li><a href="https://csinva.io/imodels/figs.html">FIGS: Fast interpretable greedy-tree sums</a></li>
- </ul>
- </li>
- <li><h3><a href="#header-submodules">Sub-modules</a></h3>
- <ul>
- <li><code><a title="imodels.algebraic" href="algebraic/index.html">imodels.algebraic</a></code></li>
- <li><code><a title="imodels.discretization" href="discretization/index.html">imodels.discretization</a></code></li>
- <li><code><a title="imodels.experimental" href="experimental/index.html">imodels.experimental</a></code></li>
- <li><code><a title="imodels.rule_list" href="rule_list/index.html">imodels.rule_list</a></code></li>
- <li><code><a title="imodels.rule_set" href="rule_set/index.html">imodels.rule_set</a></code></li>
- <li><code><a title="imodels.tree" href="tree/index.html">imodels.tree</a></code></li>
- <li><code><a title="imodels.util" href="util/index.html">imodels.util</a></code></li>
- </ul>
- </li>
- </ul>
- <p><img align="center" width=100% src="https://csinva.io/imodels/img/anim.gif"> </img></p>
- <!-- add wave animation -->
- </nav>
- </main>
- <footer id="footer">
- </footer>
- </body>
- </html>
- <!-- add github corner -->
- <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>
- <!-- add wave animation stylesheet -->
- <link rel="stylesheet" href="github.css">
|