Skip to content

Instantly share code, notes, and snippets.

import math
def conv1d(input_array, input_filter):
window_size = len(input_filter)
window_norm = math.sqrt(sum([x**2 for x in input_filter]))
output_array = []
for i in range(window_size, len(input_array) + 1):
#include <sys/ioctl.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#define ANSI_COLOR_MAGENTA "\x1b[1;35m"
#define ANSI_COLOR_RESET "\x1b[1;0m"
#define ANSI_COLOR_CYAN "\x1b[1;36m"
#define ANSI_COLOR_GREY "\x1b[0;37m"
@hexgnu
hexgnu / gpu_vs_cpu.py
Created February 19, 2018 10:21
This is a gist made from https://medium.com/@erikhallstrm/hello-world-tensorflow-649b15aed18c showing the differences between CPU and GPU speed with matrix operations
from __future__ import print_function
import matplotlib
import matplotlib.pyplot as plt
import tensorflow as tf
import time
def get_times(maximum_time):
device_times = {
"/gpu:0":[],
#ifndef _PANDAS_MATH_H_
#define _PANDAS_MATH_H_
#if defined(_MSC_VER) && (_MSC_VER < 1800)
#include <cmath>
namespace std {
__inline int signbit(double num) { return _copysign(1.0, num) < 0; }
}
#else
#include <cmath>

This book was meant to come out in October 2015 but was delayed over a year. It was a tough book for me to finish. In August of that year I was diagnosed with testicular cancer, and had to delay at least until the end of the year. Then my world was turned upside down with the sudden death of my dad weeks before my second surgery. It was a tough experience for me personally. Even though I wanted to finish this last year I just wasn't ready. But now that I've waited to finish the book as long as I have, I'm quite pleased with the result.

I am grateful for the support I received in writing this book:

Everybody who helped me at O'Reilly and writing the book. Shannon Cutt, my editor who was a rock and consistently uplifting. Liz Rush, the sole technical reviewer who was able to make it through the process with me. Stephen Elston, who gave wonderful feedback. Mike Loukides for humoring my idea and letting this grow into what it is now.

My friends, most especially Curtis. We've known each other since we were 5 an

Originally when I wrote the first edition of Thoughtful Machine Learning it was out of frustration with a lack of discipline with co-workers. Back in 2009 I was working on lots of machine learning projects and found that as soon as we introduced support vector machines, neural nets or anything else all of a sudden common coding practice just went out the window.
Thoughtful Machine Learning was a response to that. At the time I focused 100% of my time writing code in Ruby and wrote Thoughtful Machine Learning in Ruby. Well as you could imagine that was a tough challenge and I'm excited to present a new edition of this book rewritten in Python.
I have gone through most chapters, changed examples and made it much more up to date and useful for people who will write machine learning code. I hope you enjoy it.
As I stated in the original edition of Thoughtful Machine Learning: my door is always open. If you want to talk to me for any reason feel free to drop me a line at matt@matthewkirk.com. If you ever make i
@hexgnu
hexgnu / thml_8.rkt
Last active December 1, 2016 15:06
(require plot)
(plot-font-size 24)
(plot-width 800)
(plot-height 800)
(plot
(list
(function (lambda (x) (- (/ 2 (+ 1 (exp (* -2 x)))) 1)) -5 5 #:color 'black #:style 1 #:label "Sigmoid")
(function (lambda (x) (- (/ 2 (exp (sqr x))) 1)) -5 5 #:style 2 #:color 'black #:label "Gaussian")
(function (lambda (x) (/ x (+ 1 (abs x)))) -5 5 #:label "Elliott" #:style 3 #:color 'black)
(require plot)
(plot-font-size 24)
(plot-height 800)
(plot-width 800)
(define f (λ (x) (+ (* 3 x) 2 )))
(define xs (range -30 30 0.1))
(define ys (map
(lambda (x)
(+
(f x)

Post Mortems for infrastructure

Post mortems are an essential part of keeping our site up and reliable. The point of them is not to cast blame, it's not to point fingers, and if anything it's only about one thing:

  • Learning

This doc explains when to run a post mortem, who should be involved, where it should happen, and what the outcome is.

When to run a post mortem?

if true
if another?
if zomg?
if hai?
if ok?
puts "Something"
end
end
end
end