This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Time series forecasting based on multiple time series, including the original one | |
# This script is based on the following examples and discussions: | |
# https://gist.github.com/lukovkin/1aefa4509e066690b892 | |
# https://groups.google.com/forum/#!topic/keras-users/9GsDwkSdqBg | |
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import random | |
import theano |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encrypt stdin | |
echo "secret" | openssl rsautl -encrypt -inkey ~/.ssh/id_rsa -out secret.enc | |
# encrypt file | |
openssl rsautl -encrypt -inkey ~/.ssh/id_rsa -in secret.txt -out secret.enc | |
# decrypt to stdout | |
openssl rsautl -decrypt -inkey ~/.ssh/id_rsa -in secret.enc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bl_info = { | |
"name": "FILL ME MO", | |
"author": "", | |
"version": (0, 1), | |
"blender": (2, 7, 6), | |
"category": "3D View" | |
} | |
import os | |
import bpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def approximate_entropy(self, bin_data: str, pattern_length=10): | |
""" | |
Note that this description is taken from the NIST documentation [1] | |
[1] http://csrc.nist.gov/publications/nistpubs/800-22-rev1a/SP800-22rev1a.pdf | |
As with the Serial test of Section 2.11, the focus of this test is the frequency of all possible overlapping | |
m-bit patterns across the entire sequence. The purpose of the test is to compare the frequency of overlapping | |
blocks of two consecutive/adjacent lengths (m and m+1) against the expected result for a random sequence. | |
:param bin_data: a binary string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Model of a Zombie outbreak in France, starting in Grenoble | |
This is a rewrite from this blog post by Max Berrgren: | |
http://maxberggren.github.io/2014/11/27/model-of-a-zombie-outbreak/ | |
with a different country, a slightly different model, and different | |
libraries. The map of population density is taken from Wikimedia Commons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Non-parametric computation of entropy and mutual-information | |
Adapted by G Varoquaux for code created by R Brette, itself | |
from several papers (see in the code). | |
This code is maintained at https://github.com/mutualinfo/mutual_info | |
Please download the latest code there, to have improvements and | |
bug fixes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SLIDES := $(patsubst %.md,%.md.slides.pdf,$(wildcard *.md)) | |
HANDOUTS := $(patsubst %.md,%.md.handout.pdf,$(wildcard *.md)) | |
all : $(SLIDES) $(HANDOUTS) | |
%.md.slides.pdf : %.md | |
pandoc $^ -t beamer --slide-level 2 -o $@ | |
%.md.handout.pdf : %.md | |
pandoc $^ -t beamer --slide-level 2 -V handout -o $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# | |
# Highlight a given file and copy it as RTF. | |
# | |
# Simon Olofsson <[email protected]> | |
# | |
set -o errexit | |
set -o nounset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import numpy | |
import theano | |
import theano.tensor as T | |
from theano import function, config, shared, sandbox | |
from theano import ProfileMode | |
from sklearn import cluster, datasets | |
import matplotlib.pyplot as plt | |
def rsom(data, cluster_num, alpha, epochs = -1, batch = 1, verbose = False): |