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
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
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 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 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)} |
NewerOlder