Skip to content

Instantly share code, notes, and snippets.

View paulhendricks's full-sized avatar

Paul Hendricks paulhendricks

View GitHub Profile
@paulhendricks
paulhendricks / genetic.py
Created November 18, 2015 18:35 — forked from bellbind/genetic.py
[python]Genetic Algorithm example
"""Genetic Algorithmn Implementation
see:
http://www.obitko.com/tutorials/genetic-algorithms/ga-basic-description.php
"""
import random
class GeneticAlgorithm(object):
def __init__(self, genetics):
self.genetics = genetics
pass
@paulhendricks
paulhendricks / mario.lua
Created November 18, 2015 19:01 — forked from mathhun/mario.lua
MarI/O by SethBling http://pastebin.com/ZZmSNaHX
-- MarI/O by SethBling
-- Feel free to use this code, but please do not redistribute it.
-- Intended for use with the BizHawk emulator and Super Mario World or Super Mario Bros. ROM.
-- For SMW, make sure you have a save state named "DP1.state" at the beginning of a level,
-- and put a copy in both the Lua folder and the root directory of BizHawk.
if gameinfo.getromname() == "Super Mario World (USA)" then
Filename = "DP1.state"
ButtonNames = {
"A",
--
-- A simple genetic algorithm for function optimization, in lua
-- Copyright (c) 2009 Jason Brownlee
--
-- It uses a binary string representation, tournament selection,
-- one-point crossover, and point mutations. The test problem is
-- called one max (a string of all ones)
--
-- configuration
@paulhendricks
paulhendricks / miniCRAN.R
Created January 20, 2016 20:00 — forked from stephlocke/miniCRAN.R
Getting a local CRAN that combines internal and external packages
## ------------------------------------------------------------------------
# Set the repo for use throughout
cran <- "https://cran.rstudio.org"
# Install
if(!require(miniCRAN)){
install.packages("miniCRAN", repos = cran)
}
## ------------------------------------------------------------------------
install.packages('caret')
install.packages('ccd')
install.packages('d3Network')
install.packages('data.table')
install.packages('dplyr')
install.packages('DMwR')
install.packages('e1071')
install.packages('ergm')
install.packages('ff')
install.packages('foreach')
require(Mcomp)
nseries <- length(M3)
theta <- as.matrix(M3Forecast$THETA)
fpro <- as.matrix(M3Forecast$ForecastPro)
fcx <- as.matrix(M3Forecast$ForcX)
bjauto <- as.matrix(M3Forecast$`B-J auto`)
ab1 <- as.matrix(M3Forecast$AutoBox1)
ab2 <- as.matrix(M3Forecast$AutoBox2)
ab3 <- as.matrix(M3Forecast$AutoBox3)
@paulhendricks
paulhendricks / pi_ga.py
Created February 10, 2016 14:51 — forked from paulmdx/pi_ga.py
from random import randint
def create_population(create, pop_size=1000):
"""Create population list"""
return [create() for i in xrange(pop_size)]
def crossover(combine, population, pop_size):
"""Increase population size by combining"""
original_size = len(population)
while len(population) < pop_size:
@paulhendricks
paulhendricks / ssm_py_est.ipynb
Created March 10, 2016 16:44 — forked from ChadFulton/ssm_py_est.ipynb
State space models in Python: Bayesian and Classical estimation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paulhendricks
paulhendricks / gist:55fd59ae60729e21f0f7a758f32a7566
Created July 13, 2016 20:29 — forked from debasishg/gist:b4df1648d3f1776abdff
another attempt to organize my ML readings ..
  1. Feature Learning
  1. Deep Learning
@paulhendricks
paulhendricks / hmm.py
Created August 22, 2016 18:03 — forked from fonnesbeck/hmm.py
Hidden Markov model in PyMC
import numpy as np
import pymc
import pdb
def unconditionalProbability(Ptrans):
"""Compute the unconditional probability for the states of a
Markov chain."""
m = Ptrans.shape[0]