Skip to content

Instantly share code, notes, and snippets.

View tomaskrehlik's full-sized avatar

Tomáš Křehlík tomaskrehlik

View GitHub Profile

Keybase proof

I hereby claim:

  • I am tomaskrehlik on github.
  • I am tkrhlk (https://keybase.io/tkrhlk) on keybase.
  • I have a public key ASD1cPESRfDE76MuVyWvWzcERmG9gpfjlf6gVQGnl-W-Xgo

To claim this, I am signing this object:

@tomaskrehlik
tomaskrehlik / julialinter.py
Last active August 29, 2015 14:09
Settings for Julia linter
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Tomas Krehlik
# Copyright (c) 2014 Tomas Krehlik
#
# License: MIT
#
@tomaskrehlik
tomaskrehlik / gist:ce7ac48a523e7b7a0895
Created August 25, 2014 07:31
Miscellaneous tests for time series.
# Critical values for the Augmented Dickey-Fuller test.
# http://home.cerge-ei.cz/petrz/GDN/crit_values_ADF_KPSS_Perron.pdf
# The p-vals are 0.01, 0.025, 0.05, 0.1
# Number of observations is in the Ts
# Small test only for the df test
# Should print something close to critical value
# using Distributions
# mean([sort([df(cumsum(rand(Normal(), 1000)), "None")[1] for i=1:500])[25] for j=1:200])
@tomaskrehlik
tomaskrehlik / jordan_caret.R
Created November 19, 2013 17:23
A cusom function to use jordan recurrent neural network from RSNNS package with caret.
grid <- expand.grid(.size=5:10)
modelFunc <- function(data, parameter, levels, last, ...)
{
library(RSNNS)
list(fit = jordan(data[,setdiff(names(data),".outcome")], data$.outcome, size = parameter$.size, initFuncParams = c(1,-1, 0.3, 1, 0.5)))
}
predFunc <- function(object, newdata)
{
library(RSNNS)
@tomaskrehlik
tomaskrehlik / citations_export
Created May 13, 2013 18:38
Exporting citations for all the packages from R that you have used in some work.
temp <- lapply(c("data.table","reshape","ggplot2","wavelets", "Rcpp", "compiler", "base", "stringr", "RSNNS", "forecast", "rugarch", "parallel"),function(x) toBibtex(citation(x)))
cat(str_join(unlist(temp), "\n"), file="~/.../R.bib")
@tomaskrehlik
tomaskrehlik / gist:5262087
Last active December 15, 2015 12:39
Data.table: apply window function by index variable
# Lag-function lags the given variable by the date_variable
lag_variable <- function(data, variable, lags, date_variable = c("Date")) {
if (lags == 0) {
return(data)
}
if (lags>0) {
name <- "lag"
} else {
name <- "forward"