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
from wtforms import Form, BooleanField, TextField, PasswordField, validators | |
class RegistrationForm(Form): | |
username = TextField('Username', [validators.Length(min=4, max=25)]) | |
email = TextField('Email Address', [validators.Length(min=6, max=35)]) | |
password = PasswordField('New Password', [ | |
validators.Required(), | |
validators.EqualTo('confirm', message='Passwords must match') | |
]) | |
confirm = PasswordField('Repeat Password') |
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
import site | |
from os import environ | |
from os.path import join | |
from sys import version_info | |
if 'VIRTUAL_ENV' in environ: | |
virtual_env = join(environ.get('VIRTUAL_ENV'), | |
'lib', | |
'python%d.%d' % version_info[:2], | |
'site-packages') |
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
# /bin/sh | |
# Setup | |
datfile=$(mktemp) | |
echo "ElapsedTime MemUsed" > $datfile | |
starttime=$(date +%s.%N) | |
# Run the specified command in the background | |
$@ & |
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
from PIL import Image | |
from PIL.ExifTags import TAGS, GPSTAGS | |
def get_exif_data(image): | |
"""Returns a dictionary from the exif data of an PIL Image item. Also converts the GPS Tags""" | |
exif_data = {} | |
info = image._getexif() | |
if info: | |
for tag, value in info.items(): | |
decoded = TAGS.get(tag, tag) |
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
""" | |
Benchmark sklearn's SGDClassifier on RCV1-ccat dataset. | |
So generate the input files see http://leon.bottou.org/projects/sgd . | |
Results | |
------- | |
ACC: 0.9479 | |
AUC: 0.9476 |
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
import itertools | |
import numpy as np | |
from sklearn.linear_model import SGDClassifier, SGDRanking | |
from sklearn import metrics | |
from minirank.compat import RankSVM as MinirankSVM | |
from scipy import stats | |
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
import pandas, re, numpy as np | |
def load_file(filename, num_cols, dtypes, delimiter='\t'): | |
data = None | |
try: | |
data = np.fromfile(filename + '.npy', dtype=dtypes) | |
except: | |
splitter = re.compile(delimiter) | |
def items(infile): |
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
from collections import Counter | |
import numpy as np | |
counter = Counter(y) | |
num_neg = counter[counter.keys()[0]] | |
num_pos = counter[counter.keys()[1]] | |
n_samples = len(y) |
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
patching file lib/jobs/build.xml | |
Hunk #1 FAILED at 97. | |
1 out of 1 hunk FAILED -- saving rejects to file lib/jobs/build.xml.rej | |
patching file lib/operators/build.xml | |
Hunk #1 FAILED at 116. | |
1 out of 1 hunk FAILED -- saving rejects to file lib/operators/build.xml.rej |
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
20110908_NO@GB,1,,0,NO,GB,,,,T.Morstead kicks 68 yards from NO 35 to GB -3. R.Cobb to GB 24 for 27 yards (L.Torrence).,0,0,2011 | |
20110908_NO@GB,1,59,55,GB,NO,1,10,76,(14:55) (Shotgun) A.Rodgers pass short right to G.Jennings to GB 33 for 9 yards (T.Porter).,0,0,2011 | |
20110908_NO@GB,1,59,25,GB,NO,2,1,67,(14:25) (Shotgun) R.Grant right tackle to GB 37 for 4 yards (C.Jordan).,0,0,2011 | |
20110908_NO@GB,1,58,58,GB,NO,1,10,63,(13:58) A.Rodgers pass short right to J.Nelson to GB 43 for 6 yards (J.Greer).,0,0,2011 | |
20110908_NO@GB,1,58,25,GB,NO,2,4,57,(13:25) (Shotgun) A.Rodgers sacked at GB 35 for -8 yards (J.Casillas).,0,0,2011 | |
20110908_NO@GB,1,57,51,GB,NO,3,12,65,(12:51) (Shotgun) A.Rodgers pass short right to D.Driver to NO 49 for 16 yards (M.Jenkins).,0,0,2011 | |
20110908_NO@GB,1,57,17,GB,NO,1,10,49,(12:17) (Shotgun) A.Rodgers pass deep left to J.Nelson to NO 13 for 36 yards (P.Robinson).,0,0,2011 | |
20110908_NO@GB,1,56,29,GB,NO,1,10,13,(11:29) (Shotgun) A.Rodgers scrambles up the middle to NO 12 for 1 yard (J.Casillas).,0, |
OlderNewer