Skip to content

Instantly share code, notes, and snippets.

View thomasjpfan's full-sized avatar

Thomas J. Fan thomasjpfan

View GitHub Profile
@thomasjpfan
thomasjpfan / getting_feature_names.ipynb
Last active February 18, 2020 18:15
Feature names pass through
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thomasjpfan
thomasjpfan / cupy_pca_nep37.ipynb
Last active December 16, 2020 17:18
scikit-learn PCA with cupy and nep 37
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thomasjpfan
thomasjpfan / hacks.py
Last active March 7, 2020 00:06
Do not use this anywhere
from abc import ABC, abstractmethod
from inspect import signature
from functools import wraps
from numbers import Integral
from typing import Optional
def _isinstance(item, type_to_check):
if hasattr(type_to_check, '__origin__'):
if type_to_check.__origin__ == typing.Union:
@thomasjpfan
thomasjpfan / bench_adult.py
Last active April 13, 2020 13:38
Benchmarking native categorical support
from sklearn.model_selection import cross_validate
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import fetch_openml
from sklearn.experimental import enable_hist_gradient_boosting # noqa
from sklearn.ensemble import HistGradientBoostingClassifier
from sklearn.pipeline import make_pipeline
from sklearn.compose import make_column_transformer
from sklearn.compose import make_column_selector
@thomasjpfan
thomasjpfan / option1.py
Last active June 27, 2020 20:59
Interface for parameters
# Base injects the docstring description into `_parameters`? meh, `__init_subclass__`
class Model(Base):
"""This is a cool model
Parameters
----------
penalty :
This is a something cool.
- This is a list
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thomasjpfan
thomasjpfan / pytorch_hub.ipynb
Created December 17, 2020 22:29
pytorch_hub
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thomasjpfan
thomasjpfan / pytorch_hub.ipynb
Created December 17, 2020 23:44
pytorch_hub
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thomasjpfan
thomasjpfan / bayesian_decision.ipynb
Created January 21, 2021 23:54
Lets Sell Some Bayesian Keyboards
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thomasjpfan
thomasjpfan / update_docstring_numpydoc_validation.py
Created November 10, 2021 15:11
Update issue with PRs script
from collections import defaultdict
from github import Github
import os
token = os.environ["GITHUB_TOKEN"]
gh = Github(token)
sk_repo = gh.get_repo("scikit-learn/scikit-learn")