Skip to content

Instantly share code, notes, and snippets.

@jcrubino
jcrubino / wrapper.py
Created March 24, 2012 20:22
wraps IMDB class data function to provide fully complaint json
# JSON IMDbPY class wrapper
# Goal: wraps IMDB class data function to provide fully complaint json
# author: james , rubino <at> gmail , com
# note: contains wrapper and randomized test cases
from random import randint as r
import json
import imdb
ia = imdb.IMDb()
@jcrubino
jcrubino / sapd_parse.py
Created July 7, 2012 13:00
SAPD Neighborhood Watch Db
# SAPD Neighborhood Watch Db
# Parses San Antonio Police Neighborhood Calls pdfs into json for dbs
#
#
# Dev Env: Ubuntu 12.04
# Licensed under the GNU General Public License: http://www.gnu.org/licenses/gpl.html
# Requires xpdf utils available at the command line (not a python library (yet))
# pymongo & Mongodb
# pdfs from http://www.sanantonio.gov/neighborhoodpolicecalls/policecalls.aspx
#
@jcrubino
jcrubino / readme.txt
Created July 8, 2012 20:33
Project Nmes: Neighborhood Crunch, or SA Crunch or Kernel Crunch
This is a project to provide police event mapping and statistics for the citizens of San Antonio.
This project is meant to provide citizens with data to enable them to better watch their neighborhoods.
It was created after reading national best places to live rankings for cities. San Antonio was hindered by a nationally high ranking property theft rate.
Project Name Ideas:
* Nicolas
* Means "Victory of the People"
* Refers to: St Nicolas of Myra; protector from theft and more generally protector of the innocent
@jcrubino
jcrubino / notes
Created July 9, 2012 21:48
Project Notes 7/9/2012
I got the crazy idea that the project could be released as a Puppy / DSL linux or #! Linux distro
A debian or ubuntu compatible distro would be ideal, a tiny linux is very seductive.
1) Code Updates could be pushed to the nodes
2) A compute engine can be installed and used for grid operations (There goes the dream of tiny)
MOsix, OpenMosix, Rocks are all compute engines
SaltStack might be ideal, hacking a new setup with zeromq might be worth the effort.
3) Volunteers can run the distro in a vm maintaining their own computers and volunteering compute time.
I spent today looking into GIS shapefile utils
@jcrubino
jcrubino / intro.rst
Created July 10, 2012 12:00
Crime Crunchers Intro

rest

Welcome to Crime Crunchers! ======================== Time to Crunch Crime!

@jcrubino
jcrubino / online.py
Created August 13, 2012 17:12 — forked from alextp/online.py
A hacky, old, python implementation of leon bottou's lasvm
# coding: utf-8
"""Online learning."""
import numpy as np
from numpy import sign
import itertools as it
from numpy import array as A, zeros as Z
import math
@jcrubino
jcrubino / rbm.py
Created August 13, 2012 17:17
Some fairly clean (and fast) code for Restricted Boltzmann machines.
"""
Code for training RBMs with contrastive divergence. Tries to be as
quick and memory-efficient as possible while utilizing only pure Python
and NumPy.
"""
# Copyright (c) 2009, David Warde-Farley
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@jcrubino
jcrubino / gist:3342577
Created August 13, 2012 17:18 — forked from greeness/gist:1420935
tutorial ml codes
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):
@jcrubino
jcrubino / bayes.py
Created August 13, 2012 17:20 — forked from dejw/bayes.py
Naive Bayes Classifier
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import with_statement
import collections, operator, math, random, pprint
class Classifier(object):
AttrsToDump = ["value_counts", "class_counts", "features", "feature_counts"]
def __init__(self, features={}, verbose=False):