Skip to content

Instantly share code, notes, and snippets.

View AlexanderFabisch's full-sized avatar

Alexander Fabisch AlexanderFabisch

View GitHub Profile
@AlexanderFabisch
AlexanderFabisch / load_sarcos.py
Last active September 1, 2020 09:45
Load SARCOS data in Python
# Get the dataset here: http://www.gaussianprocess.org/gpml/data/
import scipy.io
# Load training set
train = scipy.io.loadmat("sarcos_inv.mat")
# Inputs (7 joint positions, 7 joint velocities, 7 joint accelerations)
Xtrain = train["sarcos_inv"][:, :21]
# Outputs (7 joint torques)
Ytrain = train["sarcos_inv"][:, 21:]
@AlexanderFabisch
AlexanderFabisch / create_toy.py
Last active December 16, 2015 09:28
Create toy dataset for regression
from numpy import *
from pylab import *
import numpy
from sklearn.mixture import GMM
from mpl_toolkits.mplot3d import axes3d
numpy.random.seed(0)
X = arange(0, 2*numpy.pi, 0.01)
N = len(X)
@AlexanderFabisch
AlexanderFabisch / generalization.py
Last active December 16, 2015 16:58
Plot that depicts generalization problems that can occur when training a classifier.
import numpy
import pylab
steps = 100
zeros = numpy.zeros(steps)
ideal = numpy.linspace(0, 1, steps)
pylab.figure()
pylab.xlabel("Training Error")
pylab.ylabel("Test Error")
@AlexanderFabisch
AlexanderFabisch / error.gnuplot
Last active December 16, 2015 17:29
Visualizes very simple error functions of neural networks with tanh activation functions and sum of squared errors.
reset
set pm3d
set hidden3d
set isosample 100, 100
unset surface
unset xtics
unset ytics
unset ztics
unset border
unset key
@AlexanderFabisch
AlexanderFabisch / hungering-arrow.rb
Created June 5, 2013 10:29
Compare different skill runes for hungering arrow in Diablo 3.
max_hits = 3
puts "HA"
dps_ha = 1.15 * (0...max_hits).map do |i| 0.35**i end.reduce(:+)
puts sprintf("%.3f", dps_ha)
puts ""
puts "PA"
dps_pa = 1.15 * (0...max_hits).map do |i| 0.5**i end.reduce(:+)
puts sprintf("%.3f", dps_pa)
@AlexanderFabisch
AlexanderFabisch / cmpchars.rb
Created June 5, 2013 10:34
Compare PVP scores of characters in Diablo 3.
require 'rubygems'
require 'diablo3-api-client'
# TODO
# fury / barb attributes
# block
# edp only for dh
# efp for barbs?
# monks
# wizards
@AlexanderFabisch
AlexanderFabisch / JuliaOctaveNumpy.md
Last active July 28, 2023 16:26
Comparison of Julia, NumPy and Octave

Comparison of Julia, Python and Octave

Overview

Julia is a new languange for technical computing. It is a mix of R, Matlab, Python and other similar languages. Its main advantage is its speed: it is just in time (JIT) compiled and almost as fast as C. Another advantage is its type inference, i.e. you do not have to specify types (although you can), but all variables are statically typed. It is a high level language that is fast as well. Here I compare the behavior to similar

@AlexanderFabisch
AlexanderFabisch / xor_elm.py
Created October 18, 2013 12:17
XOR with ELM (Extreme Learning Machine)
from openann import *
import numpy
if __name__ == "__main__":
# Create dataset
X = numpy.array([[0, 1], [0, 0], [1, 1], [1, 0]])
Y = numpy.array([[1], [0], [0], [1]])
D = X.shape[1]
F = Y.shape[1]
N = X.shape[0]
@AlexanderFabisch
AlexanderFabisch / gpr.py
Last active July 18, 2023 12:54
Simple Gaussian Process Regression implementation without hyperparameter optimization.
import numpy
def sq_exp(x1, x2, w, sigma_f):
#return sigma_f**2 * numpy.exp(-(numpy.abs(x1-x2)/w).sum()) # Ornstein-Uhlenbeck
return sigma_f**2 * numpy.exp(-0.5*((x1-x2)**2/w**2).sum())
class GPR(object):
def __init__(self, w, sigma_f, sigma_n):
self.w = w
self.sigma_f = sigma_f
@AlexanderFabisch
AlexanderFabisch / git.md
Last active October 18, 2016 16:04
Working with git