This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import mean, quantile | |
from scipy.stats import beta | |
################# Parameters ################# | |
control_successes = 10 | |
control_failures = 20 | |
treatment_successes = 40 | |
treatment_failures = 23 | |
############################################## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Navigating quickly to commonly used directories (change to your own) | |
export CDPATH=.:~:/Users/kristiewirth/Documents:/Users/kristiewirth/Documents/work | |
# Changing command line beginning to just be directory and $ | |
export PS1="\W/ $ " | |
# Expanding bash completion | |
if [ -f /etc/bash_completion ]; then | |
. /etc/bash_completion | |
elif [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import pandas as pd | |
import json | |
# Update these for your use case | |
folder = 'FOLDER' | |
csv_filename = 'CSV_FILENAME' | |
concated_df = pd.DataFrame() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datto as dt | |
import pandas as pd | |
import spacy | |
from featurestore import FeatureStore | |
from sklearn.ensemble import RandomForestClassifier | |
from sklearn.feature_extraction.text import ENGLISH_STOP_WORDS, TfidfVectorizer | |
from sklearn.metrics import ( | |
accuracy_score, | |
mean_squared_error, | |
median_absolute_error, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import numpy as np | |
from langdetect import detect | |
from sklearn.feature_extraction.text import TfidfVectorizer | |
from sklearn.metrics.pairwise import linear_kernel | |
from toolz.functoolz import pipe | |
def find_non_sentences(sentences: list, nlp): | |
non_sentences = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### | |
# Source: some commands from https://medium.com/@waxzce/keeping-macos-clean-this-is-my-osx-brew-update-cli-command-6c8f12dc1731 | |
# Run: $ `bash update-all-the-things.sh` | |
#### | |
# Update command line tools | |
softwareupdate --all --install --force | |
# Clean up brew | |
brew update && brew upgrade && brew cleanup -s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Interstate must be a unique prime number | |
interstate = 227 | |
percent_in_control = 0.5 | |
identity_id = 4545136090 | |
assignment_number = identity_id % interstate | |
lane_divider = interstate * percent_in_control | |
if assignment_number > lane_divider: | |
condition = 'treatment' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH birth_events AS | |
(SELECT identity_id, MIN(timestamp) AS first_timestamp | |
FROM fact_experiment_birth_events | |
-- Experiment name chosen | |
WHERE experiment_name LIKE '%experiment-1%' | |
GROUP BY identity_id), | |
death_events AS | |
(SELECT identity_id, MIN(timestamp) AS first_timestamp | |
-- Table with chosen metric |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, jsonify, request | |
import pandas as pd | |
# Intialize app | |
app = Flask(__name__) | |
# Need the liveness & readiness routes in order to pass Kubernetes checks | |
@app.route('/liveness') | |
def liveness(): | |
return "alive" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.6 | |
COPY /requirements.txt /app/requirements.txt | |
COPY /src/app.py /app/src/app.py | |
WORKDIR /app/src | |
RUN pip install -r /app/requirements.txt | |
ENTRYPOINT ["python", "app.py"] |
NewerOlder