Skip to content

Instantly share code, notes, and snippets.

@justmytwospence
justmytwospence / Logit.ipynb
Created February 17, 2014 06:47
Logistic regression with sci-kit learn. Second homework for MSAN 630. Learning curves, shuffle splits, L1 regularization, and more.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<html>
<head>
<title>#!title#</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
@justmytwospence
justmytwospence / Vectorization.ipynb
Created February 26, 2014 05:23
Vectorization for text mining. Includes the Porter Stemmer, a custom regular expression tokenizer, and the sklearn term frequency - inverse document frequency vectorizer.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@justmytwospence
justmytwospence / TextMining.ipynb
Created March 13, 2014 05:16
Various applications of text mining. Includes multinomial naive Bayes, TFIDF vectorizer, cross-validation over pipelines, confusion matrix of classifications, cosine distances between documents, collocation matrices, graph visualization with NetworkX and Gephi, various uses of textutils.py, and connecting to the Twitter API.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@justmytwospence
justmytwospence / contract-optimization.ipynb
Created March 14, 2014 06:21
Business Strategies for Big Data assignment
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>D3 Page Template</title>
<script type="text/javascript" src="d3/d3.js"></script>
<script type="text/javascript" src="d3/lib/colorbrewer/colorbrewer.js"></script>
<style>
rect:active {
fill: 'orange';
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<style>
#chart {
height: 500px;
}
.node rect {
cursor: move;
fill-opacity: .9;
@justmytwospence
justmytwospence / preamble.tex
Created July 4, 2014 02:37
Basic LaTeX preamble, especially for Rnoweb files.
\documentclass{article}
\usepackage{graphicx,hyperref,amsmath,natbib,bm,url} % Common packages
\usepackage[australian]{babel} % Ascending date format
\usepackage[a4paper,text={16.5cm,25.2cm},centering]{geometry} % Document size
\usepackage[compact,small]{titlesec} % Title spacing
\setlength{\parskip}{1.2ex} % Paragraph spacing
\setlength{\parindent}{0em} % Paragraph indentation
\clubpenalty = 10000 % Prevent orphans
\widowpenalty = 10000 % Prevent widows
@justmytwospence
justmytwospence / cache.py
Created July 10, 2014 18:44
A decorator that "caches" results of an arbitrary function based on its arguments.
def cache(func):
saved = {}
@wraps(func)
def newfunc(*args):
if args in saved:
return newfunc(*args)
result = func(*args)
saved[args] = result
return result
return newfunc