Skip to content

Instantly share code, notes, and snippets.

metaknowledge = .1
cognition = .2
time = 100
steps_per_unit_time = 4
for i in range(time * steps_per_unit_time):
if i % steps_per_unit_time == 0:
print("At t = %d, cognition is %.2f and metaknowledge is %.2f." % (i / steps_per_unit_time, cognition, metaknowledge))
d_metaknowledge = .2 * metaknowledge * cognition
d_cognition = .2 * metaknowledge * cognition
@johnmaxwelliv
johnmaxwelliv / lw_survey_dk_analysis.py
Last active December 10, 2015 01:19
Analysis of data here (http://lesswrong.com/lw/fp5/2012_survey_results/) for possible Dunning-Kruger effects.
from scipy.stats.stats import pearsonr
import csv
def show_correlation(data, var1, var2):
has_both_vars = [line for line in data if line[var1] != ' ' and line[var2] != ' ']
r = pearsonr([float(line[var1]) for line in has_both_vars], [float(line[var2]) for line in has_both_vars])[0]
print('Correlation between "%s" and "%s": %.4f' % (var1, var2, r))
print(' ')
@johnmaxwelliv
johnmaxwelliv / summary.py
Created December 8, 2012 03:36
Conditional probability calculator for LW akrasia survey
import csv
"""
0 First I heard of this hack
1 I feel I should try this hack, but have never actually tried it
2 I tried this hack with disappointing results
3 I tried this hack with good results, but it stopped working
4 I tried this hack with good results, and I don't use it consistently, though I'd like to
5 I tried this hack with good results, and now use it consistently
6 I don't think this hack is worth trying