Skip to content

Instantly share code, notes, and snippets.

View tjburch's full-sized avatar
🏠
Working from home

Tyler Burch tjburch

🏠
Working from home
View GitHub Profile
@tjburch
tjburch / OrthogonalPolynomialTransformer.py
Created February 21, 2024 01:29
Sklearn-style transformer to create orthogonal polynomials
from typing import Optional
from sklearn.base import BaseEstimator, TransformerMixin
class OrthogonalPolynomialTransformer(BaseEstimator, TransformerMixin):
"""Transforms input data using orthogonal polynomials."""
def __init__(self, degree: int = 1) -> None:
self.degree = degree + 1 # Account for constant term
self.norm2 = None
self.alpha = None
@tjburch
tjburch / baseball-data-in-julia
Last active December 14, 2023 19:44
Using interoperability to load baseball data into Julia
# For pybaseball (https://github.com/jldbc/pybaseball)
using DataFrames, PyCall, CSV
pybaseball = pyimport("pybaseball")
python_df = pybaseball.statcast("2021-04-06")
julia_df = CSV.read(IOBuffer(python_df.to_csv()), DataFrame)
# For baseballr (https://billpetti.github.io/baseballr/)
using RCall
@rlibarary baseballr
julia_df = rcopy(R"baseballr::scrape_statcast_savant(start_date = '2021-04-06', end_date = '2021-04-06')"
@tjburch
tjburch / tabpfn_census_compare.ipynb
Last active October 24, 2022 14:23
tabpfn_census_compare.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.