Skip to content

Instantly share code, notes, and snippets.

View youqad's full-sized avatar
🇬🇧
Research internship at Cambridge University

Younesse Kaddar youqad

🇬🇧
Research internship at Cambridge University
View GitHub Profile
@youqad
youqad / MontyHall_WebPPL_wlog.js
Last active July 24, 2020 17:02
WebPPL: Monty Hall (Solution 2: without loss of generality, suppose that we originally pick the 1st door and Monty opens the 2nd one)
var MontyHall = function () {
var car = randomInteger({n: 3})
var our_choice = randomInteger({n: 3})
var monty = categorical({vs: filter(
function(d){return d != car & d != our_choice }, [0,1,2])})
condition((our_choice == 0) & (monty == 1))
return car == 2 ? "change wins": "keep wins"
}
@youqad
youqad / MontyHall_WebPPL_no-wlog.js
Last active July 25, 2020 11:11
WebPPL: Monty Hall (Solution 1: doesn't resort to any "without loss of generality" argument)
var MontyHall = function () {
var car = randomInteger({n: 3})
var our_choice = randomInteger({n: 3})
var all_doors_but = function (d1, d2) {
return filter(function(d){return d != d1 & d != d2 }, [0,1,2])
}
var monty = categorical({vs: all_doors_but(car, our_choice)})
var door_not_opened = all_doors_but(monty, our_choice)[0]
return car == door_not_opened ? "change wins": "keep wins"
@youqad
youqad / retina_variance_OOP_3.txt
Created June 8, 2018 05:26
Inferring Space from Sensorimotor dependencies: OOP: varying retina variance (seed=3)
var = 0.1 / dim of compensated mov. = 0 (5 1 6)
var = 0.2 / dim of compensated mov. = 0 (5 1 6)
var = 0.3 / dim of compensated mov. = 0 (5 1 6)
var = 0.4 / dim of compensated mov. = 0 (5 1 6)
var = 0.5 / dim of compensated mov. = 0 (5 1 6)
var = 0.6 / dim of compensated mov. = 0 (5 1 6)
var = 0.7 / dim of compensated mov. = 0 (5 1 6)
var = 0.8 / dim of compensated mov. = 0 (5 1 6)
var = 0.9 / dim of compensated mov. = 0 (5 1 6)
var = 1.0 / dim of compensated mov. = 0 (5 1 6)
@youqad
youqad / retina_variance_2.txt
Created June 7, 2018 07:52
Inferring Space from Sensorimotor dependencies: varying retina variance (seed=2)
var = 0.1 / dim of compensated mov. = 4 (10 6 12)
var = 0.2 / dim of compensated mov. = 4 (10 6 12)
var = 0.3 / dim of compensated mov. = 0 (10 6 16)
var = 0.4 / dim of compensated mov. = 0 (10 6 16)
var = 0.5 / dim of compensated mov. = 11 (10 6 5)
var = 0.6 / dim of compensated mov. = 2 (10 4 12)
var = 0.7 / dim of compensated mov. = 4 (3 4 3)
var = 0.8 / dim of compensated mov. = 4 (3 4 3)
var = 0.9 / dim of compensated mov. = 6 (3 6 3)
var = 1.0 / dim of compensated mov. = 6 (10 6 10)
@youqad
youqad / retina_variance_1.txt
Last active June 7, 2018 06:05
Inferring Space from Sensorimotor dependencies: varying retina variance (seed=1)
var = 0.1 / dim of compensated mov. = -1 (9 2 12)
var = 0.2 / dim of compensated mov. = 3 (9 5 11)
var = 0.3 / dim of compensated mov. = 3 (9 5 11)
var = 0.4 / dim of compensated mov. = -1 (9 5 15)
var = 0.5 / dim of compensated mov. = 3 (9 5 11)
var = 0.6 / dim of compensated mov. = 3 (9 5 11)
var = 0.7 / dim of compensated mov. = 0 (9 2 11)
var = 0.8 / dim of compensated mov. = 3 (9 5 11)
var = 0.9 / dim of compensated mov. = -1 (9 5 15)
var = 1.0 / dim of compensated mov. = 4 (10 5 11)
/*************************************************************
*
* MathJax/extensions/TeX/xypic.js
*
* Implements Xy-pic environment.
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2011-2014 Isao Sonobe <sonoisa@gmail.com>.
*
@youqad
youqad / concours-meilleur-dev.py
Created April 4, 2017 16:34
Concours Meilleur Dev : problème final
import sys
from collections import deque
lines = []
for line in sys.stdin:
lines.append(line.rstrip('\n'))
N = int(lines[0])
G = [set() for _ in range(N)]
20
20
3
5
2 3
2 4
2 4
9 3
7 6
5 4 3
20
20
1 1 1 2
1 5 3 2
1 5 1 2
1 5 1 2
1 5 2
1 4 2
1 5 2
1 7 2
20
20
3 3 7
2 4 7
1 5 8
8 6 1
8 3 3
3 3 2 2 3
2 2 3 2 1 4
3 1 3 3 5