Skip to content

Instantly share code, notes, and snippets.

View hschnegg's full-sized avatar

Herve Schnegg hschnegg

View GitHub Profile
from __future__ import division
import numpy as np
import scipy.stats
import math
__author__ = 'herve.schnegg'
class MultiGaussianAnomalyDetection(object):
from __future__ import division
import numpy as np
import scipy.stats
import math
__author__ = 'herve.schnegg'
class GaussianAnomalyDetection(object):
@hschnegg
hschnegg / PostgreSQL test if text can be cast to numeric
Created January 28, 2014 15:08
PostgreSQL: Test if text can be cast to numeric
select (mytext ~ '^([0-9]+[.]?[0-9]*|[.][0-9]+)$');
@hschnegg
hschnegg / higher-order-functions.r
Last active December 15, 2015 21:09
Higher Order Functions in R
# Dummy attributes matrix
x <- matrix(c(1:12), ncol=4)
# Select attributes for combination (TRUE: in)
s1 <- c(TRUE, TRUE, FALSE, FALSE)
s2 <- c(FALSE, TRUE, FALSE, TRUE)
sel.x <- data.frame(s1, s2)
# Use higher order functions