Skip to content

Instantly share code, notes, and snippets.

View jandremarais's full-sized avatar

Jan jandremarais

  • Cape Town, South Africa
View GitHub Profile
@jandremarais
jandremarais / image_ml_ext.py
Created June 14, 2017 19:48
Edit of Keras image.py to allow for multiple labels per image
"""Fairly basic set of tools for real-time data augmentation on image data.
Can easily be extended to include new transformations,
new preprocessing methods, etc...
"""
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import re
from scipy import linalg
@jandremarais
jandremarais / image_ml_ext.py
Created June 14, 2017 19:48
Edit of Keras image.py to allow for multiple labels per image
"""Fairly basic set of tools for real-time data augmentation on image data.
Can easily be extended to include new transformations,
new preprocessing methods, etc...
"""
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import re
from scipy import linalg
@jandremarais
jandremarais / cartpole_Qlearn_lm.R
Created January 20, 2017 08:02
Code for my Q-learning approach on the Cart Pole problem using a linear model
# load necessary libraries
library(gym)
library(tidyverse)
# adjust env_reset and env_step functions for custom output
my_env_reset <- function(x, instance_id) {
route <- paste0("/v1/envs/", instance_id, "/reset/", sep = "")
response <- post_request(x, route)
observation <- response[["observation"]]
names(observation) <- paste0("obs", 1:length(observation))