Skip to content

Instantly share code, notes, and snippets.

@bllchmbrs
bllchmbrs / Untitled.ipynb
Created February 3, 2016 02:21
Challenges
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# coding: utf-8
import loader
import pickle
from sklearn.feature_extraction.text import TfidfVectorizer
x = loader.load_xy2()
with open('temp.pkl', 'wb') as f:
pickle.dump(x, f)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bllchmbrs
bllchmbrs / 2014-10-21.json
Created May 10, 2015 18:49
World Cup Crime
{
"geojson_crime": [
{
"features": [
{
"geometry": {
"coordinates": [
-122.415085666416,
37.7792390689538
],
@bllchmbrs
bllchmbrs / Pyspark_ipython_startup.py
Last active August 29, 2015 14:18
Pyspark IPython Start up File
import os
import sys
spark_home = os.environ.get('SPARK_HOME', None)
# check if it exists
if not spark_home:
raise ValueError('SPARK_HOME environment variable is not set')
# check if it is a directory
@bllchmbrs
bllchmbrs / tf_idf_part1.py
Created December 23, 2014 02:02
TF IDF & Jaccard Similarity Explained for my Blog Post
from __future__ import division
import string
import math
tokenize = lambda doc: doc.lower().split(" ")
document_0 = "China has a strong economy that is growing at a rapid pace. However politically it differs greatly from the US Economy."
document_1 = "At last, China seems serious about confronting an endemic problem: domestic violence and corruption."
document_2 = "Japan's prime minister, Shinzo Abe, is working towards healing the economic turmoil in his own country for his view on the future of his people."
document_3 = "Vladimir Putin is working hard to fix the economy in Russia as the Ruble has tumbled."
@bllchmbrs
bllchmbrs / tfpdf.py
Last active December 29, 2021 14:10
TF IDF Explained in Python Along with Scikit-Learn Implementation
from __future__ import division
import string
import math
tokenize = lambda doc: doc.lower().split(" ")
document_0 = "China has a strong economy that is growing at a rapid pace. However politically it differs greatly from the US Economy."
document_1 = "At last, China seems serious about confronting an endemic problem: domestic violence and corruption."
document_2 = "Japan's prime minister, Shinzo Abe, is working towards healing the economic turmoil in his own country for his view on the future of his people."
document_3 = "Vladimir Putin is working hard to fix the economy in Russia as the Ruble has tumbled."
@bllchmbrs
bllchmbrs / markdown to quiver.py
Created December 2, 2014 01:52
Convert Markdown Files to Quiver notes
import argparse
import json
import re
import os
from time import time
parser = argparse.ArgumentParser(description='Convert to Quiver Format')
parser.add_argument("src", help="The Source File You want to Convert")
args = parser.parse_args()
cells = []