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
clear all | |
frame create maternal_depr | |
frame maternal_depr { | |
use "IABR7EFL.DTA" | |
keep if midx==1 | |
gen no_trained_assist = (m3a==0 & m3b==0 & m3c==0) | |
gen few_antenatal = m14<4 | |
gen missed = missing(m14) | missing(m3a) | missing(m3b) | missing(m3c) | m14>=98 | |
collapse (max) no_trained_assist few_antenatal missed, by(v001 v002) | |
gen deprived = no_trained_assist|few_antenatal |
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
memlimited: memlimited.cc calc_mean.cc calc_mean.h | |
clang++ -o memlimited -O3 --std=c++17 \ | |
-ffast-math -march=native \ | |
memlimited.cc calc_mean.cc -pthread |
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
memlimited: memlimited.cc calc_mean.cc calc_mean.h | |
g++ -o memlimited -O3 -march=native -fopenmp memlimited.cc calc_mean.cc |
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
#include <cstdio> | |
#include <cstdlib> | |
#include <vector> | |
#include <unordered_map> | |
#include <utility> | |
using namespace std; | |
#include <time.h> | |
#include <sys/time.h> | |
#include <sys/resource.h> |
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
counters = {key:collections.Counter() for key in ['child','mother','father']} | |
with open("day2/names.csv") as f: | |
rdr = csv.DictReader(f) | |
for r in rdr: | |
for key in counters: | |
l = r[key].split() | |
if len(l)>0: | |
counters[key][l[0]] += 1 | |
commonize = lambda ctr,N: {t[0] for t in ctr.most_common(N)} |
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
with open("code/test2.txt") as fin: | |
sbj_counts = {} | |
for l in fin: | |
l = l.strip() | |
m = re.fullmatch(r"((?:\w|\.)+)\s+in\s+(\w+)",l) | |
if m: | |
degree,subject = m.group(1,2) | |
print(f"{degree} ({subject})") | |
if subject in sbj_counts: | |
sbj_counts[subject].add(degree) |
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
section ‹A Simple Graph Problem: Second Attempt› | |
text ‹ | |
We shall prove the following: "In a finite group of people, some of whom are friends with some | |
of the others there must be at least two people who have the same number of friends." | |
› | |
theory Friends | |
imports Main | |
Finite_Set |
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
section ‹A Simple Graph Problem› | |
text ‹ | |
We shall prove the following: "In a finite group of people, some of whom are friends with some | |
of the others there must be at least two people who have the same number of friends." | |
› | |
theory Friends | |
imports Main | |
Finite_Set |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 numpy as np | |
import numpy.random as nr | |
def gen(N): | |
X = nr.choice([0,1],size=N,p=[0.6,0.4]) | |
D = nr.choice([0,1],size=N,p=[0.6,0.4]) | |
epsi = nr.uniform(0,2,N) | |
Y = X+D*epsi | |
return X,D,epsi,Y | |
def estim(D,Y): |
NewerOlder