This file contains 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
class OnlineLearner(object): | |
def __init__(self, **kwargs): | |
self.last_misses = 0. | |
self.iratio = 0. | |
self.it = 1. | |
self.l = kwargs["l"] | |
self.max_ratio = -np.inf | |
self.threshold = 500. | |
def hinge_loss(self, vector, cls, weight): |
This file contains 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
# Requires pstoedit (http://www.pstoedit.net/) and gdal ( http://www.gdal.org/ ) | |
# Convert PDF to DXF format, assign each color to a different layer, and only write the layer that corresponds to | |
# hex color #B8B9BA | |
pstoedit -f 'dxf: -ctl -dumplayernames -layers CB8-B9-BA' map_housing_stock_north.pdf parcels.dxf | |
# Convert DXF to KML | |
ogr2ogr -f "KML" parcels.kml parcels.dxf | |
This file contains 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
def recordDistances(candidates, data_d, data_model): | |
# The record array has two elements, the first element is an array | |
# of floats that has length equal the number of fields. The second | |
# argument is a array of length 2 which stores the id of the | |
# considered elements in the pair. | |
fields = data_model['fields'] | |
field_dtype = [('names', 'a20', len(fields)), ('values', 'f4', |
This file contains 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
# In local_settings.py | |
def topic_classifier(title) : | |
if 'Damage to vehicle claim' in title : | |
return ['Routine', 'Damage to vehicle claim'] | |
if 'Damage to property claim' in title : | |
return ['Routine', 'Damage to property claim'] | |
if 'Excessive water rate claim' in title : |
This file contains 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
# Read in the data | |
days <- read.csv('all_years.csv') | |
# Plot all the data | |
plot(total_count ~ temp_max, days, col=rgb(0,0,0, .3)) | |
# Fit a cubic polynomial to the data | |
m1 <- lm(total_count ~ temp_max + I(temp_max^2) + I(temp_max^3), days) | |
# Extract the coefficents |
This file contains 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
from numpy import * | |
import pymc | |
from scipy import stats | |
from scipy.stats import distributions as d | |
#parameters about the da | |
dimensions = 5 | |
observations = 30 | |
shape = (dimensions, observations) |
This file contains 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
from numpy import * | |
import pymc | |
from scipy import stats | |
from scipy.stats import distributions as d | |
#parameters about the da | |
dimensions = 5 | |
observations = 30 | |
shape = (dimensions, observations) |
This file contains 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
""" | |
Author: Oliver Mitevski | |
References: | |
A Generalized Linear Model for Principal Component Analysis of Binary Data, | |
Andrew I. Schein; Lawrence K. Saul; Lyle H. Ungar | |
The code was translated and adapted from Jakob Verbeek's | |
"Hidden Markov models and mixtures for Binary PCA" implementation in MATLAB |
This file contains 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 three | |
chi = three.city('chicago') | |
yesterday_graffiti = chi.requests(service_code='4fd3b167e750846744000005', | |
extensions='true', | |
page_size=500, | |
start='10-25-2012') | |
print len(yesterday_graffiti) |
This file contains 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
City of Chicago | |
Individual Contributor License Agreement ("Agreement") | |
Thank you for your interest in [Project Name] by the City of Chicago (the "City"), a municipal corporation and home rule unit of local government existing under the Constitution of the State of Illinois. In order to clarify the intellectual property license granted with Contributions from any person or entity, the City must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of the City and its users; it does not change your rights to use your own Contributions for any other purpose. | |
You accept and agree to the following terms and conditions for Your present and future Contributions submitted to the City. In return, the City shall not use Your Contributions in a way that it believes is contrary to the public benefit. Except for the license granted herein to the City an |
OlderNewer