Skip to content

Instantly share code, notes, and snippets.

View willkurt's full-sized avatar

Will Kurt willkurt

View GitHub Profile
# NOTE: This is gross, but it contains the plotting code to build this:
# https://twitter.com/willkurt/status/1351242237963874311
# ImageMagick does all the gif work: convert *.png -delay 60 -duplicate 20,22 logistic.gif
# This optimization loop is not idea for any other purpose than snapshotting the learning
lr = 0.000005
init_nll = nll(y_train,X_train,w)
next_nll = 0
img_ctr = 0
iters = 10
while (init_nll - next_nll) > 10:
"""
This just a quick example of how creating derivatives easily allows us to
think about mathematics in a very different, computationally focused way.
In this example we consider the defintion of e as the value of x in
f(t) = x^t
Where the derivative of f, f', is equal to f.
f(t) = f'(t)
@willkurt
willkurt / prob_logic.ipynb
Last active September 16, 2021 17:25
Implementing probability as logic using Python's data model methods
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@willkurt
willkurt / reverse in 3 langauges
Created October 5, 2016 23:43
Why referential transparency matters...
//this is valid Ruby, Python and JavaScript
myList = [1,2,3]
myList.reverse()
newList = myList.reverse()
//Q. What is the value of newList in each of those three languages??
//answers below!!!
.
.

Keybase proof

I hereby claim:

  • I am willkurt on github.
  • I am willkurt (https://keybase.io/willkurt) on keybase.
  • I have a public key whose fingerprint is 9CAB A806 1376 8BE0 90D2 8E8C 3379 3FAC C91C AA2B

To claim this, I am signing this object:

@willkurt
willkurt / gist:e7ddafca09295f13327a
Created October 7, 2014 22:45
DTM -> Sparse matrix
dtm.to.sm <- function(dtm){
sparseMatrix(i=dtm$i, j=dtm$j,x=dtm$v,
dims=c(dtm$nrow, dtm$ncol))
}
@willkurt
willkurt / gist:6747378
Last active December 24, 2015 04:59
Quote from Jacques Ellul's "The Technological Society"
"The techniques of the police, which are developing at an extremely rapid tempo, have as their necessary end the transformation of the entire nation into a concentration camp. This is no perverse decision on the part of some party or government. To be sure of apprehending criminials, it is necessary that everyone be supervised. It is necessary to know exactly what every citizen is up to, to know his relations, his amusements, etc. And the state is increasingly in a position to know these things." - Jacques Ellul "The Technological Society"
@willkurt
willkurt / gist:5172225
Created March 15, 2013 19:02
processing location tree
import csv
with open("locations.csv","w") as csvfile:
cw = csv.writer(csvfile)
cw.writerow(["country","city","region1","location1","location2","location3"])
with open("Location_Tree.csv","r") as infile:
for l in infile:
cw.writerow(map(lambda x: x.strip().replace('"',''),l.split('~')))
@willkurt
willkurt / gist:3095463
Created July 12, 2012 03:20
StringInquirer example
1.9.2-p290 :001 > exp = ActiveSupport::StringInquirer.new('example')
=> "example"
1.9.2-p290 :002 > exp.example?
=> true
1.9.2-p290 :003 > exp.what?
=> false
1.9.2-p290 :004 >
@willkurt
willkurt / overloading.js
Created February 16, 2011 20:12
function overloading in JavaScript
//first some exmaples
//overload examples
var add = function(x,y){
return x+y;
}
overload("add",function(x,y,z){
return x+y+z;
});