Skip to content

Instantly share code, notes, and snippets.

Avatar

Tomáš Křehlík tomaskrehlik

View GitHub Profile
View keybase.md

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 Aug 29, 2015
Settings for Julia linter
View julialinter.py
#
# 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 Aug 25, 2014
Miscellaneous tests for time series.
View gist:ce7ac48a523e7b7a0895
# 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 Nov 19, 2013
A cusom function to use jordan recurrent neural network from RSNNS package with caret.
View jordan_caret.R
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
Exporting citations for all the packages from R that you have used in some work.
View citations_export
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 Dec 15, 2015
Data.table: apply window function by index variable
View gist:5262087
# 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"