Skip to content

Instantly share code, notes, and snippets.

@cykl
cykl / HLLMergeBenchmark.java
Created Jun 2, 2013
Benchmarks for stream-lib/faster_hll
View HLLMergeBenchmark.java
package bench;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.BenchmarkType;
import org.openjdk.jmh.annotations.GenerateMicroBenchmark;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.State;
@dmbates
dmbates / gist:5303570
Last active Dec 15, 2015
Formula, ModelFrame and ModelMatrix types
View gist:5303570

Formula, ModelFrame and ModelMatrix types

In R, the functions for fitting statistical models based on a linear predictor usually allow for a formula/data specification of the model. The data part is a data.frame object in R. In Julia the corresponding type is a DataFrame as implemented in the DataFrames package.

A formula object in R is an expression whose top-level operator is a unary or binary tilde, ~. The interpretation of many operators, including +, *, ^, \ and : are overridden in the formula language. See the result of

?formula

in R for the details.

anonymous
anonymous / Chutes.jl
Created Dec 24, 2012
Graphs in Julia... some preliminary thoughts
View Chutes.jl
module Chutes
abstract Graph
abstract DGraph <: Graph
abstract UGraph <: Graph
typealias LabelType Dict{Int,Any}
type DenseGraph <: Graph
mat :: Matrix{Uint8}
@kjhealy
kjhealy / st2binding
Created Nov 5, 2012
R and ST2's REPL. Keybinding Example
View st2binding
[
// Modified Sublime-REPL keybindings for an "R-friendly" set of shortcuts.
// Copy and paste this text into the Key Bindings - User (under Preferences menu).
// For more information, see http://tomschenkjr.net/2012/05/17/using-sublime-text-2-for-r/
// Executes a selection of text in REPL, latter only displays code and does not execute
{ "keys": ["super+shift+enter"], "command": "repl_transfer_current", "args": {"scope": "selection"}},
// I disabled this one
//{ "keys": ["super+shift+enter", "r"], "command": "repl_transfer_current", "args": {"scope": "selection", "action":"view_write"}},
@simonbyrne
simonbyrne / jbug.jl
Created Oct 15, 2012
A bugs-type sampler in julia
View jbug.jl
require("extras/distributions.jl")
require("slicesampler.jl")
import Distributions.*
macro buildslicesampler(model)
# pull apart the model into variables and distributions
variables = Dict{Symbol,Expr}()
unboundvars = Set{Symbol}()
for line in model.args
@pprett
pprett / boston.json
Created Oct 1, 2012
Decision Tree Viewer (D3 and Sklearn)
View boston.json
{"error": 42716.2954, "samples": 506, "value": [22.532806324110698], "label": "RM <= 6.94", "type": "split", "children": [{"error": 17317.3210, "samples": 430, "value": [19.93372093023257], "label": "LSTAT <= 14.40", "type": "split", "children": [{"error": 6632.2175, "samples": 255, "value": [23.349803921568636], "label": "DIS <= 1.38", "type": "split", "children": [{"error": 390.7280, "samples": 5, "value": [45.58], "label": "CRIM <= 10.59", "type": "split", "children": [{"error": 0.0000, "samples": 4, "value": [50.0], "label": "Leaf - 4", "type": "leaf"}, {"error": 0.0000, "samples": 1, "value": [27.9], "label": "Leaf - 5", "type": "leaf"}]}, {"error": 3721.1632, "samples": 250, "value": [22.90520000000001], "label": "RM <= 6.54", "type": "split", "children": [{"error": 1636.0675, "samples": 195, "value": [21.629743589743576], "label": "LSTAT <= 7.57", "type": "split", "children": [{"error": 129.6307, "samples": 43, "value": [23.969767441860473], "label": "TAX <= 222.50", "type": "split", "children": [{"err
@pao
pao / iface_test.jl
Created Apr 20, 2012
Julia interfaces prototype
View iface_test.jl
load("interface.jl")
type Blah; end
type Bluh; end
@interface FooBar{T} [
(:foo, :(T, Integer,))
(:bar, :(T, String, Integer))
]