Skip to content

Instantly share code, notes, and snippets.

View alexshires's full-sized avatar

Alex Shires alexshires

View GitHub Profile
@samrogerson
samrogerson / urlstrip.c
Last active December 22, 2015 19:49
An example url protocol stripper for bryn
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
char *urlStrip(char *inputUrl, int *ret_sz) {
/* if inputUrl isn't allocated dynamically you doin't need to pass sz_url you can just do sizeof(inputUlr) */
int pos = 0;
int sz_url = strlen(inputUrl);
while(pos < sz_url - 1 && inputUrl[pos] != '/' && inputUrl[pos+1] != '/') {
/*printf("%d -> %c\n", pos, inputUrl[pos]);*/
#include <iostream>
#include <gsl/gsl_integration.h>
#include <functional>
class A
{
public :
A(const double & _z = 1.0) : z(_z) {;}
double f( double x ) { return z*x*x ; }
double test( double x, void * y ) { return f(x) ; }
@lukovkin
lukovkin / multi-ts-lstm.py
Last active November 25, 2022 16:23
Time series prediction with multiple sequences input - LSTM - 1
# Time Series Testing
import keras.callbacks
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Dense, Dropout
from keras.layers.recurrent import LSTM
# Call back to capture losses
class LossHistory(keras.callbacks.Callback):
def on_train_begin(self, logs={}):
self.losses = []
@optilude
optilude / find-cpu-hogs.sh
Created March 15, 2020 20:09
Capture processes with significant CPU usage (Bash shell script)
#!/bin/bash
# Output CSV-formatted statistics about each process using > ${threshold}% CPU,
# sampling every ${delay} seconds. Assume we'll find them in the top ${max}
# processes returned by `top` sorting by CPU usage.
threshold=${1:-5}
delay=${2:-5}
max=${3:-25}

This book is all about patterns for doing ML. It's broken up into several key parts, building and serving. Both of these are intertwined so it makes sense to read through the whole thing, there are very many good pieces of advice from seasoned professionals. The parts you can safely ignore relate to anything where they specifically use GCP. The other issue with the book it it's very heavily focused on deep learning cases. Not all modeling problems require these. Regardless, let's dive in. I've included the stuff that was relevant to me in the notes.

Most Interesting Bullets:

  • Machine learning models are not deterministic, so there are a number of ways we deal with them when building software, including setting random seeds in models during training and allowing for stateless functions, freezing layers, checkpointing, and generally making sure that flows are as reproducible as possib