Skip to content

Instantly share code, notes, and snippets.

View mattsgithub's full-sized avatar
🐞
Making bugs in software since 2001

Robert M. Johnson mattsgithub

🐞
Making bugs in software since 2001
View GitHub Profile
@mattsgithub
mattsgithub / 2D_holes_dataset.py
Last active November 5, 2021 15:43
2D Hole Dataset
import numpy as np
import pandas as pd
def get_disk_holes(r, r_hole, n_hole, allow_center=True):
"""
Returns disks that are can be used to
cut data from a disk of radius `r`
"""
df = pd.DataFrame(columns=['r_hole', 'r', 'theta', 'x', 'y'])
@mattsgithub
mattsgithub / ssvm.ipynb
Last active April 25, 2022 09:23
Learning how to build a structural svm. WIP
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mattsgithub
mattsgithub / counterfactual_preparation.py
Last active December 4, 2019 18:58
Prepares Pandas DataFrame for Counterfactual Predictions
def get_pandas_df_for_counterfactual_prediction(df,
df_treatments,
id_column='customer_id',
suffix='_assigned'):
"""Returns a pandas dataframe prepared for counterfactual predictions
Args
df (pd.DataFrame):
The dataframe from which to prepare counterfactuals for
@mattsgithub
mattsgithub / cross_validation_time.py
Created October 1, 2019 17:49
Cross validation is a bit more complicated when dealing with time series. This class provides dates to train, validate, and test on.
class SampleForwardChainCV(object):
def __init__(self,
dates,
obs_count,
min_start_date=None,
max_end_date=None,
n_min_train_obs=20,
n_min_validate_obs=20,
n_min_test_obs=20):
@mattsgithub
mattsgithub / ROC_AUC_Ibotta_Blog.ipynb
Last active April 9, 2019 04:05
Code for IBotta ROC AUC Blog
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mattsgithub
mattsgithub / ANNs in TensflowFlow Example.ipynb
Created July 1, 2018 22:20
This code demonstrates how to use Tensorflow to build a basic neural network
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.