Skip to content

Instantly share code, notes, and snippets.

View jonahwilliams's full-sized avatar

Jonah Williams jonahwilliams

View GitHub Profile
@jonahwilliams
jonahwilliams / FiftyStates.json
Last active August 29, 2015 14:17
Hispanic Voting Choropleth
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jonahwilliams
jonahwilliams / CensusBlockData.json
Last active August 29, 2015 14:18
Census Block Group - Omaha Metro Area
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jonahwilliams
jonahwilliams / AutoMpg.json
Last active August 29, 2015 14:18
Error Surface of a Simple Linear Regression
[{"mpg":18.0,"cylinders":8,"displacement":307.0,"horsepower":130.0,"weight":3504,"acceleration":12.0,"model_year":70,"origin":1,"car_name":"chevrolet chevelle malibu"},{"mpg":15.0,"cylinders":8,"displacement":350.0,"horsepower":165.0,"weight":3693,"acceleration":11.5,"model_year":70,"origin":1,"car_name":"buick skylark 320"},{"mpg":18.0,"cylinders":8,"displacement":318.0,"horsepower":150.0,"weight":3436,"acceleration":11.0,"model_year":70,"origin":1,"car_name":"plymouth satellite"},{"mpg":16.0,"cylinders":8,"displacement":304.0,"horsepower":150.0,"weight":3433,"acceleration":12.0,"model_year":70,"origin":1,"car_name":"amc rebel sst"},{"mpg":17.0,"cylinders":8,"displacement":302.0,"horsepower":140.0,"weight":3449,"acceleration":10.5,"model_year":70,"origin":1,"car_name":"ford torino"},{"mpg":15.0,"cylinders":8,"displacement":429.0,"horsepower":198.0,"weight":4341,"acceleration":10.0,"model_year":70,"origin":1,"car_name":"ford galaxie 500"},{"mpg":14.0,"cylinders":8,"displacement":454.0,"horsepower":220.0,"weig
@jonahwilliams
jonahwilliams / AutoMpg.json
Last active August 29, 2015 14:18
L2 Regularization
[{"mpg":18.0,"cylinders":8,"displacement":307.0,"horsepower":130.0,"weight":3504,"acceleration":12.0,"model_year":70,"origin":1,"car_name":"chevrolet chevelle malibu"},{"mpg":15.0,"cylinders":8,"displacement":350.0,"horsepower":165.0,"weight":3693,"acceleration":11.5,"model_year":70,"origin":1,"car_name":"buick skylark 320"},{"mpg":18.0,"cylinders":8,"displacement":318.0,"horsepower":150.0,"weight":3436,"acceleration":11.0,"model_year":70,"origin":1,"car_name":"plymouth satellite"},{"mpg":16.0,"cylinders":8,"displacement":304.0,"horsepower":150.0,"weight":3433,"acceleration":12.0,"model_year":70,"origin":1,"car_name":"amc rebel sst"},{"mpg":17.0,"cylinders":8,"displacement":302.0,"horsepower":140.0,"weight":3449,"acceleration":10.5,"model_year":70,"origin":1,"car_name":"ford torino"},{"mpg":15.0,"cylinders":8,"displacement":429.0,"horsepower":198.0,"weight":4341,"acceleration":10.0,"model_year":70,"origin":1,"car_name":"ford galaxie 500"},{"mpg":14.0,"cylinders":8,"displacement":454.0,"horsepower":220.0,"weig
@jonahwilliams
jonahwilliams / VotingInformation.tsv
Last active March 22, 2019 06:00
Interactive Bar Chart I
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 13 columns, instead of 11 in line 7.
Year State TotalPopulation TotalCitizen TotalRegistered TotalVoted HispanicPopulation HispanicCitizen HispanicRegistered HispanicVoted PercentHispanicPopulation PercentHispanicRegistered PercentHispanicVoted
2012 ALABAMA 3594.0 3479.0 2556.0 2154.0 107.0 35.0 12.0 0.0 0.029771841958820256 0.004694835680751174 0.0
2012 ALASKA 516.0 495.0 361.0 289.0 23.0 18.0 10.0 7.0 0.044573643410852716 0.027700831024930747 0.02422145328719723
2012 ARIZONA 4863.0 4314.0 2812.0 2412.0 1396.0 989.0 516.0 400.0 0.2870655973678799 0.18349928876244664 0.16583747927031509
2012 ARKANSAS 2198.0 2109.0 1376.0 1124.0 143.0 73.0 16.0 14.0 0.06505914467697907 0.011627906976744186 0.012455516014234875
2012 CALIFORNIA 28357.0 23419.0 15356.0 13462.0 9935.0 6510.0 3684.0 3157.0 0.35035440984589344 0.23990622557957803 0.2345119595899569
2012 COLORADO 3817.0 3544.0 2635.0 2495.0 681.0 497.0 284.0 259.0 0.17841236573225047 0.10777988614800758 0.10380761523046092
2012 CONNECTICUT 2726.0 2499.0 1760.0 1568.0 292.0 220.0 127.0 103.0 0.1071166544
@jonahwilliams
jonahwilliams / README.md
Last active August 29, 2015 14:18
The Boxcar Kernel

A kernel is any smooth function K such that K(x) >= 0 and $\int K(x)dx = 1$, $\int xK(x)dx = 0$, and $\theta^2_K = \int x^2K(x)dx \geq 0$.

The boxcar kernel is 0 across the domain of X, except for at a specified distance from x. We can use the boxcar kernel to take local averages for nonparametric estimation. Here the bandwidth parameter controls the specified distance. As $bandwidth \rightarrow \infty$, $K(x) \rightarrow mean(x)$.

@jonahwilliams
jonahwilliams / VotingInformationTable.tsv
Last active August 29, 2015 14:18
Interactive html Table I
Year State Total Population Total Citizen Total Registered Total Voted Hispanic Population Hispanic Citizen Hispanic Registered Hispanic Voted Percent Hispanic Population Percent Hispanic Registered Percent Hispanic Voted
2012 Alabama 3594 3479 2556 2154 107 35 12 0 2% 0% 0%
2012 Alaska 516 495 361 289 23 18 10 7 4% 2% 2%
2012 Arizona 4863 4314 2812 2412 1396 989 516 400 28% 18% 16%
2012 Arkansas 2198 2109 1376 1124 143 73 16 14 6% 1% 1%
2012 California 28357 23419 15356 13462 9935 6510 3684 3157 35% 23% 23%
2012 Colorado 3817 3544 2635 2495 681 497 284 259 17% 10% 10%
2012 Connecticut 2726 2499 1760 1568 292 220 127 103 10% 7% 6%
2012 Delaware 693 641 470 431 56 24 11 10 8% 2% 2%
2012 District Of Columbia 517 461 385 350 48 19 14 13 9% 3% 3%
@jonahwilliams
jonahwilliams / LinearRegression.js
Last active April 13, 2017 07:29
Under-fitting versus Over-fitting
function LinearRegression(data){
var X = [],
y = [];
for (var i = 0; i < data.length; i ++){
var tempX = [];
for(var j = 0; j < data[0]['x'].length; j++){
tempX.push(data[i]['x'][j]);
}
X.push(tempX);
y.push([data[i].y]);
@jonahwilliams
jonahwilliams / index.html
Last active August 29, 2015 14:19
Gaussian Smoother
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<style>
.axis {
font: 10px sans-serif;
}
path {
stroke: steelblue;
stroke-width: 2;
@jonahwilliams
jonahwilliams / Counties.json
Last active August 29, 2015 14:19
Kansas City Choropleth
[{"geometry": {"type": "Polygon", "coordinates": [[[-94.121361, 38.803422], [-94.121312, 38.804311], [-94.12131, 38.804344], [-94.121274, 38.80501], [-94.12121, 38.806709], [-94.121009, 38.809792], [-94.120997, 38.809981], [-94.120985, 38.810158], [-94.120948, 38.810688], [-94.120936, 38.810918], [-94.120783, 38.813753], [-94.120782, 38.813774], [-94.120766, 38.814067], [-94.120765, 38.814098], [-94.120702, 38.815578], [-94.12069, 38.815747], [-94.120679, 38.81591], [-94.120619, 38.816772], [-94.120625, 38.817495], [-94.120626, 38.81757], [-94.120626, 38.817617], [-94.120623, 38.817631], [-94.120559, 38.817887], [-94.120407, 38.818198], [-94.120354, 38.818306], [-94.120336, 38.818342], [-94.12031, 38.818469], [-94.120334, 38.818617], [-94.12034, 38.818655], [-94.120409, 38.818879], [-94.120418, 38.818967], [-94.120396, 38.819048], [-94.120312, 38.819185], [-94.120269, 38.819317], [-94.120257, 38.819422], [-94.120272, 38.819522], [-94.120312, 38.81961], [-94.12036, 38.819827], [-94.120394, 38.82027], [-94.1203