.. highlightlang:: rest
Time to Crunch Crime!
# 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() |
# 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 | |
# |
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 |
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 |
# 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 |
""" | |
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 |
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): |
#!/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): |