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
""" | |
Visualize points on the 3-simplex (eg, the parameters of a | |
3-dimensional multinomial distributions) as a scatter plot | |
contained within a 2D triangle. | |
David Andrzejewski ([email protected]) | |
""" | |
import numpy as NP | |
import matplotlib.pyplot as P | |
import matplotlib.ticker as MT |
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
""" | |
Simple matrix intensity plot, similar to MATLAB imagesc() | |
David Andrzejewski ([email protected]) | |
""" | |
import numpy as NP | |
import matplotlib.pyplot as P | |
import matplotlib.ticker as MT | |
import matplotlib.cm as CM |
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
""" | |
Visualization of matrix block structure | |
(eg, pairwise similarity or co-occurrence) | |
Requires scaledimage.py for intensity plots | |
David Andrzejewski | |
""" | |
import numpy as NP | |
import matplotlib.pyplot as P |
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
""" | |
Example blockviz usage with synthetic generated data | |
Requires scaledimage.py and blockviz.py | |
David Andrzejewski | |
""" | |
import numpy as NP | |
import numpy.random as NPR |
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
""" | |
Augment scatter plot with linear regression fit | |
David Andrzejewski | |
""" | |
import numpy as NP | |
import numpy.random as NPR | |
import matplotlib.pyplot as P | |
import matplotlib.lines as L | |
from scikits.learn.linear_model import LinearRegression |
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
;; Assumes examples are Clojure maps, | |
;; for example from clojure.contrib.sql | |
;; | |
;; {:eyecolor "brown" :heightmeters 1.7 ...} | |
;; {:eyecolor "blue" :heightmeters 1.5 ...} | |
;; | |
;; (def eye-encoder (discrete-feature-encoder :eyecolor myexamples)) | |
;; | |
(defn discrete-feature | |
"Create binary 1-of-N encoding of a discrete feature" |
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
; MaxWalkSAT weighted satisfiability solver | |
; | |
; A General Stochastic Approach to Solving Problems with Hard and Soft | |
; Constraints Henry Kautz, Bart Selman, and Yueyen Jiang. In The | |
; Satisfiability Problem: Theory and Applications, Dingzhu Gu, Jun Du, | |
; and Panos Pardalos (Eds.), DIMACS Series in Discrete Mathematics and | |
; Theoretical Computer Science, vol. 35, American Mathematical Society, | |
; 1997, pages 573-586. | |
; | |
; |
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
; Standard k nearest neighbors classifier | |
; Does not handle | |
; > 2 classes | |
; even values of k | |
; any bad input, really | |
; | |
; David Andrzejewski ([email protected]) | |
; | |
; Command-line arguments | |
; 0 training data filename |
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
; Calculate lines of code contained in a given directory | |
; -ignores empty lines | |
; -ignores comment-only lines | |
; -does *not* ignore block comments | |
; | |
; David Andrzejewski ([email protected]) | |
; | |
; Command-line arguments | |
; 0 Code root directory | |
; |
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
""" | |
Handful of tricks for making a print-friendly plot | |
David Andrzejewski | |
""" | |
import matplotlib as MPL | |
import matplotlib.pyplot as P | |
# Have plots be the exact same size | |
MPL.rc('figure', figsize=(14, 11)) # figure size in inches |
OlderNewer