Skip to content

Instantly share code, notes, and snippets.

View thomasjpfan's full-sized avatar

Thomas J. Fan thomasjpfan

View GitHub Profile
@thomasjpfan
thomasjpfan / rustimport.ipynb
Last active December 26, 2023 19:55
rustimport in Jupyter!
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thomasjpfan
thomasjpfan / bench_missing_rf.py
Created May 17, 2023 14:41
Benchmarking random forest with missing values
"""Instructions
1. Build this PR and run:
```bash
python bench_missing_rf.py bench ~/bench_results_rf pr
```
2. On main run:
```bash
@thomasjpfan
thomasjpfan / plot_results.py
Last active May 23, 2023 14:56
Array API backend results
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
results = pd.read_csv("results_backend.csv")
sns.set_theme(context="paper", font_scale=1.4)
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(8, 4), constrained_layout=True, sharey=True)
sns.barplot(y="backend", x="duration", data=results[results["method"] == "fit"], ax=ax1)
ax1.set_xlabel("duration (sec)")
@thomasjpfan
thomasjpfan / pytorch_array_api_switch.ipynb
Created April 28, 2023 14:43
PyTorch + scikit-learn benchmark
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thomasjpfan
thomasjpfan / torch_dynamo_experiments.ipynb
Created April 19, 2023 21:25
Torch Dynamo + numpy_pytorch_interop experiments
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thomasjpfan
thomasjpfan / bench_hist_early_stopping.py
Last active April 12, 2023 17:58
Benchmark for early stopping in hist gradient boosting
"""Benchmark for early stopping with predefined metric strings.
```python
python bench_hist_early_stopping.py --problem classification
python bench_hist_early_stopping.py --problem regression
```
"""
import argparse
from time import perf_counter
@thomasjpfan
thomasjpfan / solutions_sympy.ipynb
Last active April 8, 2023 17:50
exact solutions
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""Instructions
1. Build this PR and run:
```bash
python bench_missing.py bench ~/bench_results pr
```
2. On main run:
```bash
@thomasjpfan
thomasjpfan / pytorch_array_api_switch.ipynb
Last active March 23, 2023 18:54
Scikit-learn running on PyTorch using ArrayAPI
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.