Skip to content

Instantly share code, notes, and snippets.

@sglyon
sglyon / violins.ipynb
Created March 22, 2016 14:00
violin plots in PlotlyJS.jl
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file has been truncated, but you can view the full file.
{
"cells": [
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
@sglyon
sglyon / website_charts.ipynb
Created August 13, 2015 03:15
interactive returns
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sglyon
sglyon / ode_event_solver.jl
Last active August 29, 2015 14:23
events using ODE.jl
using Roots
using ODE
@doc doc"""
ode_events{TY}(f::Function, y0::TY, tspan, odeint::Function; kwargs...)
### Arguments
* `f`: function such that dy/dt = f(t, y)
* `y0`: initial condition for y
@sglyon
sglyon / exploration.ipynb
Created May 26, 2015 00:56
Exploring revolutionary war continental loan loan data
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sglyon
sglyon / comments.md
Last active August 29, 2015 14:20
osx vs linux performance

Notice that when running it on a Linux VM on OSX I get about a 4x speedup relative to running it natively on OSX.

Also notice from the profile that the Linux version spends about 90% of its time in the myexp call and only about 3% in the line @inbounds d_i2_j += ((points[k, i] - data[k, j])^2). (I know these aren't actually times, but rather times when the profiler registered that line. But it gives an approximation to time spent).

The OSX version spends about 57% of its time (so about 5.3 seconds on average) in myexp and about 33% of its time (about 3 seconds on average) in the line @inbounds d_i2_j += ((points[k, i] - data[k, j])^2).

I can't explain why, on the same hardware, the OSX version is so much slower here.

@sglyon
sglyon / density.m
Last active June 8, 2019 04:24
exp performance
function [density, pts_PCn, di_min] = eval_density(data, points)
[n,d] = size(data);
n_points = size(points,1);
Datan = (data-ones(n,1)*mean(data))./(ones(n,1)*std(data));
[U,S,V] = svd(Datan,0);
PC = Datan*V;
PCn = PC./(ones(n,1)*std(PC));
Pointsn = (points-ones(n_points,1)*mean(data))./(ones(n_points,1)*std(data));
@sglyon
sglyon / MisspecifiedRecovery.ipynb
Created April 7, 2015 14:59
Misspecified Recovery replication figure
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sglyon
sglyon / Hessians
Created March 23, 2015 18:05
Testing 3 ways of computing Hessian in Julia: analytically, ForwardDiff.jl, ReverseDiffSource.jl
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [