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
def asset_discussion_score(threads, k=1, theta=2): | |
X = np.array([max_thread_width(t) * max_thread_depth(t) for t in threads]) | |
n = len(X) | |
k = np.sum(X) + k | |
t = theta/(theta*n + 1) | |
return {'discussion_score': gamma_poission_model(X, n, k, theta, 0.05)} |
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
def gamma_poission_model(X, n, k, theta, quantile): | |
k = np.sum(X) + k | |
t = theta/(theta*n + 1) | |
return stats.gamma.ppf(quantile, k, scale=t) |
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
def beta_binomial_model(y, n, alpha, beta, quantile): | |
alpha_ = y + alpha | |
beta_ = n - y + beta | |
return stats.beta.ppf(quantile, alpha_, beta_) |
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
def asset_diversity_score(threads, alpha=2, beta=2): | |
X = set() | |
n = 0 | |
for t in threads: | |
users, n_comments = unique_participants(t) | |
X = X | users | |
n += n_comments | |
y = len(X) | |
return {'diversity_score': beta_binomial_model(y, n, alpha, beta, 0.05)} |
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
# To redirect all users to access the site WITHOUT the 'www.' prefix, | |
# (http://www.example.com/... will be redirected to http://example.com/...) | |
# Make sure to replace example.com with your own site name | |
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] | |
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301] |
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
# To redirect all users to access the site WITH the 'www.' prefix, | |
# (http://example.com/... will be redirected to http://www.example.com/...) | |
# Make sure to replace example.com with your own site name | |
RewriteCond %{HTTP_HOST} ^example\.com$ [NC] | |
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] |
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
RewriteEngine on |
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
# Thanks to http://stackoverflow.com/questions/9884353/xls-to-csv-convertor | |
import os, csv, xlrd | |
excel_file = '/path/to/file.xls' | |
#we're specifying a directory here because we'll have several files | |
#be sure to include end slash | |
csv_filepath = 'path/to/csv/directory/' | |
def csv_from_excel(excel_file): | |
workbook = xlrd.open_workbook(excel_file) |
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 sys import argv | |
import datetime, os, logging | |
from django.core.management.base import BaseCommand, CommandError | |
class Command(BaseCommand): | |
def handle(self, *args, **options): | |
self.print_date() | |
def print_date(self): |
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
state | county | |
---|---|---|
Alabama | Bibb | |
Alabama | Blount | |
Alabama | Calhoun | |
Alabama | Chambers | |
Alabama | Cherokee | |
Alabama | Chilton | |
Alabama | Clay | |
Alabama | Cleburne | |
Alabama | Colbert |
OlderNewer