Skip to content

Instantly share code, notes, and snippets.


Joseph Allen joseph-allen

View GitHub Profile
import seaborn as sns
g = sns.distplot(dataset["Feature"], color="m", label="Skewness : %.2f"%(dataset["Feature"].skew()))
g = g.legend(loc="best")
# Apply log to Feature to reduce skewness distribution
# dataset["Feature"] = dataset["Feature"].map(lambda i: np.log(i) if i > 0 else 0)
joseph-allen / outlier_detection
Created Dec 29, 2017
Tukey method outlier detection
View outlier_detection
import numpy as np
from collections import Counter
def detect_outliers(df, n, features):
Takes a dataframe df of features and returns a list of the indices
corresponding to the observations containing more than n outliers according
to the Tukey method.
joseph-allen / useful imports
Created Dec 29, 2017
Useful imports for a jupyter investigation
View useful imports
# Ignore warnings
import warnings
# Handle table-like data and matrices
import numpy as np
import pandas as pd
# Modelling Algorithms
from sklearn.tree import DecisionTreeClassifier
View gist:9e89e627915e6ea291cf06d3af928299
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from sklearn.tree import DecisionTreeClassifier
def plot_histograms(df, variables, n_rows, n_cols):
fig = plt.figure(figsize=(16, 12))
for i, var_name in enumerate(variables):
ax = fig.add_subplot(n_rows, n_cols, i+1)
@pytest.fixture(params=[('input', 'expected')])
def get_input(request):
return request.param
def get_function_result(get_input):
return test_function(get_input[0])
joseph-allen / gist:f50306ba76d5c539feeb281384702a80
Created Sep 28, 2017
exporting jupyter notebook without input
View gist:f50306ba76d5c539feeb281384702a80
jupyter nbconvert --to pdf Report.ipynb --TemplateExporter.exclude_input=True
import pandas as pd
import sys
import itertools
def permute(df):
columns = [df[column] for column in list(df)]
uniq_columns = [columns[x].unique() for x in range(0, len(columns))]
return pd.DataFrame(list(itertools.product(*uniq_columns)),
View setup github issues
echo -n "GitHub User: "
read USER
echo -n "GitHub Password: "
read -s PASS
echo ""
echo -n "GitHub Repo (e.g. foo/bar): "
View gist:df15cbba395114a2dd9db63f25e84629
"cells": [
"cell_type": "code",
"execution_count": 518,
"metadata": {
"collapsed": true
"outputs": [],
"source": [
View no-clone-deep.js
* @fileoverview Rule to flag use of _.cloneDeep
* @author Joseph Allen
// Rule Definition
module.exports = function(context) {
You can’t perform that action at this time.