- Categoical data - a fixed list of values, eg: gender, country/market/language, age group
- Ordinal data - order is important. Exmaple: ranking, datetime
- Numeric data
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
class color(object): | |
PURPLE = '\033[95m' | |
CYAN = '\033[96m' | |
DARKCYAN = '\033[36m' | |
BLUE = '\033[94m' | |
GREEN = '\033[92m' | |
YELLOW = '\033[93m' | |
RED = '\033[91m' | |
BOLD = '\033[1m' | |
UNDERLINE = '\033[4m' |
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
# create a new bridge network with your subnet and gateway for your ip block | |
$ docker network create --subnet 203.0.113.0/24 --gateway 203.0.113.254 iptastic | |
# run a nginx container with a specific ip in that block | |
$ docker run --rm -it --net iptastic --ip 203.0.113.2 nginx | |
# curl the ip from any other place (assuming this is a public ip block duh) | |
$ curl 203.0.113.2 | |
# BOOM golden |
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
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """ | |
import numpy as np | |
import cPickle as pickle | |
import gym | |
# hyperparameters | |
H = 200 # number of hidden layer neurons | |
batch_size = 10 # every how many episodes to do a param update? | |
learning_rate = 1e-4 | |
gamma = 0.99 # discount factor for reward |
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
#!/bin/bash | |
set -e | |
# Usage: | |
# rsync_parallel.sh [--parallel=N] [rsync args...] | |
# | |
# Options: | |
# --parallel=N Use N parallel processes for transfer. Defaults to 10. | |
# | |
# Notes: |
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
{ | |
"files.exclude": { | |
"**/.git": true, | |
"**/.svn": true, | |
"**/.hg": true, | |
"**/CVS": true, | |
"**/.DS_Store": true, | |
"**/*.pyc": true | |
}, | |
"telemetry.enableTelemetry": false, |
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
But here some highlights that might be of interest: | |
- discussion of approximation error, estimation error, and optimization error, rather than the more vague “bias / variance” trade off; | |
- full treatment of gradient boosting, one of the most successful ML algorithms in use today (along with neural network models); | |
- more emphasis on conditional probability modeling than is typical (you give me an input, I give you a probability distribution over outcomes — useful for anomaly detection and prediction intervals, among other things), | |
- geometric explanation for what happens with ridge, lasso, and elastic net in the [very common in practice] case of correlated features; | |
- guided derivation of when the penalty forms and constraint forms of regularization are equivalent, using Lagrangian duality (in homework), proof of the representer theorem with simple linear algebra, | |
- independent of kernels, but then applied to kernelize linear methods; | |
- a general treatment of backpropagation |
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: https://stackoverflow.com/questions/37471346/automatically-and-elegantly-flatten-dataframe-in-spark-sql | |
from pyspark.sql.types import StructType, ArrayType | |
def flatten(schema, prefix=None): | |
fields = [] | |
for field in schema.fields: | |
name = prefix + '.' + field.name if prefix else field.name | |
dtype = field.dataType | |
if isinstance(dtype, ArrayType): | |
dtype = dtype.elementType |
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 cv2 | |
import time | |
import math | |
import numpy as np | |
import tensorflow as tf | |
class SsdAnchorsCalculatorOptions: | |
def __init__(self, input_size_width, input_size_height, min_scale, max_scale | |
, num_layers, feature_map_width, feature_map_height | |
, strides, aspect_ratios, anchor_offset_x=0.5, anchor_offset_y=0.5 |