Skip to content

Instantly share code, notes, and snippets.

View freeman-lab's full-sized avatar

Jeremy Freeman freeman-lab

View GitHub Profile
@freeman-lab
freeman-lab / StreamingKMeans.scala
Last active February 26, 2019 07:13
Spark Streaming + MLLib integration examples
package thunder.streaming
import org.apache.spark.{SparkConf, Logging}
import org.apache.spark.rdd.RDD
import org.apache.spark.SparkContext._
import org.apache.spark.streaming._
import org.apache.spark.streaming.dstream.DStream
import org.apache.spark.mllib.clustering.KMeansModel
import scala.util.Random.nextDouble
@freeman-lab
freeman-lab / gbl-analysis-presentation.md
Last active September 14, 2016 17:04
gbl analysis presentation

principles

  • commitment to open source
  • scalability
  • transparency
  • modularity
  • standardization
  • iteration
  • avoiding reinvention
@freeman-lab
freeman-lab / index.js
Created March 2, 2016 17:39
redux + hyperx + main-loop
var redux = require('redux')
var vdom = require('virtual-dom')
var hyperx = require('hyperx')
var hx = hyperx(vdom.h)
var reducer = require('./reducer')
var store = redux.createStore(reducer)
var item = function (state) {
function onclick () {
@freeman-lab
freeman-lab / example-neurofinder-notebook.ipynb
Created July 6, 2016 17:41
example neurofinder notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@freeman-lab
freeman-lab / local-nmf.py
Created July 4, 2016 03:39
neurofinder algorithm : local nmf
# neurofinder submission
# local nmf
#
# requirements:
# thunder-python v1.2.0
# thunder-extraction v1.1.0
import json
import thunder as td
from extraction import NMF
@freeman-lab
freeman-lab / random-neurofinder-algorithm.py
Last active June 8, 2016 18:49
example neurofinder algorithm : generates random regions
import json
from numpy import zeros, random, asarray, where, ones
from scipy.ndimage.morphology import binary_closing, binary_dilation
datasets = ['00.00.test', '00.01.test', '01.00.test', '01.01.test', '02.00.test', '02.01.test', '03.00.test', '04.00.test', '04.01.test']
dims = [500,500]
margin = 20
n = 200
@freeman-lab
freeman-lab / terrible-neurofinder-algorithm.py
Last active June 8, 2016 18:46
example neurofinder algorithm : uses a fixed two-pixel region for all neurons
import json
datasets = ['00.00.test', '00.01.test', '01.00.test', '01.01.test', '02.00.test', '02.01.test', '03.00.test', '04.00.test', '04.01.test']
submission = []
for dataset in datasets:
result = {'dataset': dataset, 'regions': [{'coordinates': [[0, 0], [0, 1]]}]}
submission.append(result)
@freeman-lab
freeman-lab / render-light.js
Created June 1, 2016 04:23
red sphere with lightning in regl
const mat4 = require('gl-mat4')
const sphere = require('primitive-icosphere')
const fit = require('canvas-fit')
const normals = require('angle-normals')
const regl = require('regl')()
const camera = require('lookat-camera')()
var mesh = sphere(1, {
subdivisions: 5
})
@freeman-lab
freeman-lab / render.js
Last active May 31, 2016 18:39
looming red sphere in regl
const mat4 = require('gl-mat4')
const sphere = require('primitive-icosphere')
const regl = require('regl')()
const camera = require('lookat-camera')()
var mesh = sphere(1, {subdivisions: 1})
const cube = regl({
frag: `
precision mediump float;
@freeman-lab
freeman-lab / example.txt
Created April 5, 2016 18:01
minidocs highlight js test
```python
# create shifted copies
from numpy import arange
from scipy.ndimage.interpolation import shift
```
```python
# create shifted copies