This file contains hidden or 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
def power_set(orignal_list): | |
''' | |
PowerSet of a List | |
@param orignal_list: list from which to construct a powerset | |
''' | |
list_size = len(orignal_list) | |
num_sets = 2**list_size | |
powerset = [] | |
# Don't include empty set |
This file contains hidden or 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
def rand_seq(alphabet, length): | |
""" | |
generates a random sequence of length over alphabet | |
@param alphabet: alphabet from which to choose characters | |
@type alphabet: list<str> | |
@param length: length of random string | |
@type length: int | |
""" |
This file contains hidden or 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
import cPickle | |
import bz2 | |
def save(filename, myobj): | |
""" | |
save object to file using pickle | |
@param filename: name of destination file | |
@type filename: str |
This file contains hidden or 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
import pylab | |
def plot_roc(y, out, label="", out_fn=None): | |
""" | |
show or save ROC curve | |
""" | |
pylab.figure() | |
plot_roc_noshow(y, out, label=label) |
This file contains hidden or 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
import pylab | |
data1 = [1,2,3,4] | |
data2 = [2,3,4,5] | |
pylab.plot(data1, "-o", label="meh") | |
pylab.plot(data2, "-o", label="arr") | |
pylab.title("example") | |
pylab.grid(True) |
NewerOlder