Skip to content

Instantly share code, notes, and snippets.

View arnaudsj's full-sized avatar

Sébastien Arnaud arnaudsj

View GitHub Profile
@daveliepmann
daveliepmann / application.clj
Last active July 12, 2017 14:12
Clojure source for Part 2 of "Implementing the k-means jump method" — see https://gist.github.com/daveliepmann/3df6599128edfc24ea02267ec6b047b5
(ns jump-sugar-james.application
(:require [incanter.core :as i]
[incanter.stats :as incs]
[incanter.charts :as incc]
[clj-ml.clusterers :as mlc]
[clj-ml.data :as mld]
[clojure.string :as s]))
;;;; We'll need some functions from earlier.
@daveliepmann
daveliepmann / application.markdown
Last active May 25, 2016 17:30
Implementing Sugar & James’ paper, "Finding the number of clusters in a data set: An information theoretic approach" in Clojure — Part 2

Implementing the k-means jump method: Part Two

After implementing Sugar & James' jump method and exploring its application to Fisher's iris data in Part One of this series, we're now ready to apply the jumps-in-distortions test to some other sample data sets. Pure Clojure source here.

Remember these functions from earlier? We'll be using them again.

(defn assoc-distortions
  "Given a number `transformation-power-y` and a seq of maps
#!/usr/bin/env bash
# For opening a file from the heads up display of Figwheel in IntelliJ IDEA
# Made for OS X but should work similarly on Linux with a different CMD variable
# Add this script to your path (ex. ~/bin) and use from
# :open-file-command in the :figwheel section of project.clj
INTELLIJ_VERSION=14 # Change for your (whole number) version of IntelliJ IDEA
CMD="/Applications/IntelliJ IDEA ${INTELLIJ_VERSION}.app/Contents/MacOS/idea"
"$CMD" "$PWD" --line $2 "$PWD/$1"
@karpathy
karpathy / min-char-rnn.py
Last active May 1, 2024 11:00
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@ptaoussanis
ptaoussanis / clj-1.8.0-alpha2-tuple-perf.clj
Last active August 29, 2015 14:25
Clojure 1.8.0-alpha2 tuple performance
;;
;; LATEST UPDATE: 25 July 2015
;;
;; ****************************************************************
;; ** NB false alarm! My original benchmarks showing large perf **
;; ** improvements with tuples turned out to be noise, **
;; ** unfortunately. Current (+more reliable) numbers seem[1] to **
;; ** show no consistent significant advantage using currently **
;; ** available tuple implementations against real-world code. **
;; ** **
"""
This is a batched LSTM forward and backward pass
"""
import numpy as np
import code
class LSTM:
@staticmethod
def init(input_size, hidden_size, fancy_forget_bias_init = 3):
@karpathy
karpathy / gist:587454dc0146a6ae21fc
Last active March 19, 2024 05:50
An efficient, batched LSTM.
"""
This is a batched LSTM forward and backward pass
"""
import numpy as np
import code
class LSTM:
@staticmethod
def init(input_size, hidden_size, fancy_forget_bias_init = 3):
@aarondunnington
aarondunnington / queue.lua
Created March 21, 2015 14:11
Array-Based Queue on Aerospike
local ENQUEUE_CAPACITY = 100
local function l_exists(rec, bin)
if aerospike:exists(rec)
and rec[bin] ~= nil
and type(rec) == "userdata" then
return true
end
return false
end
@deanrad
deanrad / service-checklist.md
Last active August 29, 2015 14:17
So You Want To Build A Service ?

So you want to build a service?

This checklist, Chris Brown > Jonathan Locker > Dean Radcliffe

Do we need to build it in house? (We ♥ not reinventing the wheel)

  • Have we researched commercially available products?
  • Are there any licensed tools that we can add to our service to save on development costs?
@mrocklin
mrocklin / pandat.py
Created February 5, 2015 16:37
A tiny command line interface to into
#!/usr/bin/env python
from sys import argv
from into import into, Iterator
from toolz import partition
literals = [True, False, None]
def parse(s):
""" Parse strings to booleans, integers, or strings """