Skip to content

Instantly share code, notes, and snippets.

View betatim's full-sized avatar
🤠
Not my first rodeo

Tim Head betatim

🤠
Not my first rodeo
View GitHub Profile
@betatim
betatim / SKILL.md
Last active October 27, 2026 12:59
A skill that helps collect information about an issue/PR to help judge if it is "worth it". The last three files should be in the `scripts/` directory of the skill (no way to do directories in a gist)
name pr-impact-brief
description Assemble source-linked evidence on whether a scikit-learn PR is worth carrying, one PR at a time, ending in the questions the decision hinges on and never in a verdict. Use when the user says "let's review some PRs for worth", asks to review or triage PRs for worth or impact, asks whether a PR is worth it or worth merging or worth carrying, or asks for an impact brief on a PR number or URL.

PR Impact Brief

Walk one unattended scikit-learn PR at a time and present the evidence a maintainer needs to answer "should we carry this?" — then stop. The human decides.

This skill exists because the cost side of a change is invisible by default. A PR that is small, correct, and green still adds permanent public surface, consumes review time, and displaces bigger work. Nobody asks whether it is worth that, so the question goes unanswered for years.

@betatim
betatim / SKILL.md
Created October 27, 2026 12:53
A PR walkthrough skill
name pr-walkthrough
description Produce a structured walkthrough of a GitHub PR ordered by causal dependency. Use when the user asks to walk through, analyze, or understand a PR's changes.

PR Walkthrough

Generate a causal-dependency-ordered walkthrough of a GitHub PR and write it to agents/reviews/ in the repository.

This skill is scoped to PRs in the current repository. Cross-repo PRs are out of scope.

@betatim
betatim / analyze_results.py
Created October 12, 2026 09:20
Analyse (partial) results from a https://github.com/NVIDIA/SkillEvaluator run
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
"""Summarise a SkillEvaluator tier3 run from its per-trial scores.
SkillEvaluator only reports a score for a condition (with or without the skill)
when every trial in it succeeded. One agent timeout or provider error leaves the
report at N/A and no ``lift.json`` is written, even though the other trials were
graded. This script reads each trial's ``reward.json`` instead. It skips trials
that errored or have no reward, and says how many were skipped.
@betatim
betatim / bench_pipeline_size_sweep.py
Created September 2, 2026 07:18
Benchmark for `fit` and `predct` at different `n_samples` for https://github.com/scikit-learn/scikit-learn/issues/34604
"""Sweep pipeline `fit` and `predict` runtime against the size of X.
This script times
StandardScaler -> Nystroem -> LogisticRegression
as a function of how much data it is given, in two independent sweeps:
fit GridSearchCV(pipeline, PARAM_GRID, cv=3).fit(X[:n], y[:n]),
for n from 2_000 to 100_000
@betatim
betatim / cuda-linux-1.txt
Created September 1, 2026 11:22
Always store attributes as numpy in scikit-learn GPU
numpy
as-is as numpy difference added
search 1.18s 1.18s -0.0% -164us
predict 24.2ms 19.1ms -20.9% -5.1ms
serve/call 897us 930us +3.7% 33us
score 10.4ms 10.9ms +4.8% 493us
one 10-row predict, step by step:
scale.transform 111us 135us +22.2% 24us
kernel.transform 572us 588us +2.8% 16us
clf.predict 206us 202us -2.2% -5us
@betatim
betatim / bench_store_fitted_as_numpy.py
Created August 10, 2026 14:59
Use this with https://github.com/scikit-learn/scikit-learn/pull/34667 (tested with `16de9236116f0dd3dcc769eaea781d389a6ae419`)
"""Benchmark storing fitted attributes as NumPy.
Times a PCA + LogisticRegression pipeline with and without the
`store_fitted_as_numpy` configuration option added in
https://github.com/scikit-learn/scikit-learn/pull/34667, for
https://github.com/scikit-learn/scikit-learn/issues/34604.
Needs that branch checked out. Run it with no arguments:
python bench_store_fitted_as_numpy.py
@betatim
betatim / SKILL.md
Created June 11, 2026 14:00
Produce a structured walkthrough of a GitHub PR ordered by causal dependency.
name pr-walkthrough
description Produce a structured walkthrough of a GitHub PR ordered by causal dependency. Use when the user asks to walk through, analyze, or understand a PR's changes.

PR Walkthrough

Generate a causal-dependency-ordered walkthrough of a GitHub PR and write it to agents/reviews/ in the repository.

This skill is scoped to PRs in the current repository. Cross-repo PRs are out of scope.

@betatim
betatim / salary_pipeline.py
Created June 2, 2026 12:40
Code from the skrub gallery
import numpy as np
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import cross_validate
from skrub import tabular_pipeline
from skrub.datasets import fetch_employee_salaries
def main():
print("Loading employee salaries dataset ...")
data = fetch_employee_salaries()
#!/usr/bin/env python3
"""
Employee Salary Prediction
==========================
Predict current annual salary for Montgomery County employees
using a scikit-learn pipeline with mixed feature types.
"""
try:
import cuml.accel
@betatim
betatim / AGENTS.md
Created April 30, 2026 07:36
My cuml `AGENTS.md`

AGENTS Instruction

This file contains is additional guidance for AI agents and other AI editors.


Core Principles

These principles reduce common LLM coding mistakes. Apply them to every task.