Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import sys | |
import matplotlib.pyplot as plot | |
import csv | |
# read the arguments - need two files | |
if len(sys.argv) < 3: | |
quit('python parse.py [raw data file] [mahout output]') | |
# read the files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plot | |
import sys | |
def exp(mean, samples = 100): | |
y = [] | |
lambda_param = (1 / mean) | |
for i in range(0, samples): | |
rand = np.random.rand() | |
y.append(np.log(1 - rand) / (-1.0 * lambda_param)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A great deal of this code was inspired by Codeflow. | |
// http://codeflow.org/entries/2010/aug/22/html5-canvas-and-the-flying-dots/ | |
// I just added the bit where the particles explode :) | |
var Universe = function() { this.init.apply(this, arguments); }; | |
Universe.prototype = { | |
init: function(numParticles, interval, maxVelocity, maxAcceleration, criticalMass, criticalRadius) { | |
var canvas = document.getElementById('particles'); | |
var context = canvas.getContext('2d'); |
NewerOlder